/* Planeta Endurance — Presentación de Proyectos */
:root {
  --pe-red: #E11D48;
  --pe-red-light: #fff1f4;
  --pe-dark: #0f1117;
  --pe-text: #1a1a2e;
  --pe-muted: #6b7280;
  --pe-border: #e5e7eb;
  --pe-bg: #f8fafc;
  --pe-white: #ffffff;
  --pe-success: #16a34a;
  --pe-danger: #dc2626;
  --pe-warning: #d97706;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'Lexend', system-ui, sans-serif;
  background: var(--pe-bg);
  color: var(--pe-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Auth ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-box {
  background: var(--pe-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}

.brand { text-align: center; margin-bottom: 2rem; }
.logo { height: 48px; margin-bottom: 1rem; }
.brand h1 { font-size: 1.25rem; font-weight: 600; color: var(--pe-dark); }
.subtitle { font-size: .9rem; color: var(--pe-muted); margin-top: .25rem; }

.field { margin-bottom: 1.25rem; }
.field label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .4rem; color: var(--pe-text); }
.field input, .field textarea, .field select {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--pe-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .95rem;
  transition: border-color .15s;
  background: var(--pe-white);
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--pe-red);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.auth-links { text-align: center; margin-top: 1.5rem; font-size: .875rem; color: var(--pe-muted); }
.auth-links a { color: var(--pe-red); text-decoration: none; margin: 0 .4rem; }
.auth-links a:hover { text-decoration: underline; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.25rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--pe-red); color: #fff; border-color: var(--pe-red); }
.btn-primary:hover { background: #c01741; border-color: #c01741; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-outline { background: transparent; color: var(--pe-red); border-color: var(--pe-red); }
.btn-outline:hover { background: var(--pe-red-light); }
.btn-ghost { background: transparent; color: var(--pe-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--pe-border); color: var(--pe-text); }
.btn-danger { background: var(--pe-danger); color: #fff; border-color: var(--pe-danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-xs { padding: .2rem .55rem; font-size: .75rem; }
.btn-lg { padding: .8rem 2rem; font-size: 1rem; }

/* ── Alerts ── */
.alert {
  padding: .85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: .9rem;
}
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert ul { margin: .5rem 0 0 1.25rem; }

/* ── App layout ── */
.app-layout { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.5rem;
  background: var(--pe-white);
  border-bottom: 1px solid var(--pe-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.logo-sm { height: 32px; }
.header-title { font-size: .95rem; font-weight: 600; color: var(--pe-dark); flex: 1; }
.header-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.user-name { font-size: .85rem; color: var(--pe-muted); }

/* ── Dashboard ── */
.dashboard-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.dashboard-card {
  background: var(--pe-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 560px;
}
.dashboard-card h2 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.dashboard-actions { display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }

.progress-section { margin: 1rem 0; }
.progress-label { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: .5rem; }
.progress-bar { background: var(--pe-border); border-radius: 999px; height: 10px; overflow: hidden; }
.progress-fill { background: var(--pe-red); height: 100%; border-radius: 999px; transition: width .4s; }

.progress-bar-mini { background: rgba(255,255,255,.3); border-radius: 999px; height: 6px; width: 120px; overflow: hidden; }

.status-badge { display: inline-block; padding: .25rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 600; margin-bottom: 1rem; }
.status-done { background: #dcfce7; color: #166534; }

/* ── Form layout ── */
.form-layout { background: var(--pe-bg); }
.form-container { display: flex; flex: 1; }

.form-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--pe-white);
  border-right: 1px solid var(--pe-border);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
  overflow-y: auto;
}

.sidebar-section {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem 1.25rem;
  text-decoration: none;
  color: var(--pe-text);
  border-left: 3px solid transparent;
  transition: all .15s;
  font-size: .875rem;
}
.sidebar-section:hover { background: var(--pe-bg); }
.sidebar-section.active { border-left-color: var(--pe-red); background: var(--pe-red-light); color: var(--pe-red); }

.sec-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--pe-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-section.active .sec-num { background: var(--pe-red); color: #fff; }
.sec-title { line-height: 1.3; }
.sidebar-footer { margin-top: auto; padding: 1rem; }

.form-main {
  flex: 1;
  padding: 2rem;
  max-width: 780px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--pe-dark);
  margin-bottom: 1.5rem;
}
.sec-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--pe-red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.instruccion-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: .85rem 1rem;
  font-size: .875rem;
  color: #78350f;
  margin-bottom: 1.5rem;
}

.pregunta-card {
  background: var(--pe-white);
  border: 1.5px solid var(--pe-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  transition: border-color .15s;
}
.pregunta-card:focus-within { border-color: var(--pe-red); }

.pregunta-header { margin-bottom: .75rem; }
.pregunta-titulo { font-size: .95rem; font-weight: 500; display: block; }
.instruccion-inline { font-size: .8rem; color: var(--pe-muted); margin-top: .3rem; }
.badge-required {
  display: inline-block;
  background: var(--pe-red);
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  padding: .1rem .4rem;
  border-radius: 4px;
  margin-left: .5rem;
  vertical-align: middle;
}

.pregunta-textarea {
  width: 100%;
  border: 1.5px solid var(--pe-border);
  border-radius: 8px;
  padding: .65rem .85rem;
  font-family: inherit;
  font-size: .9rem;
  resize: vertical;
  min-height: 90px;
  transition: border-color .15s;
}
.pregunta-textarea:focus { outline: none; border-color: var(--pe-red); }

.save-indicator { font-size: .75rem; color: var(--pe-success); display: block; margin-top: .25rem; min-height: 1rem; }
.save-ok { color: var(--pe-success); }
.save-error { color: var(--pe-danger); }

.url-field-wrap { display: flex; flex-direction: column; gap: .25rem; }
.url-input-row {
  display: flex; align-items: center;
  border: 1px solid var(--pe-border); border-radius: var(--radius);
  background: var(--pe-white); overflow: hidden;
  transition: border-color .15s;
}
.url-input-row:focus-within { border-color: var(--pe-red); }
.url-prefix-icon {
  display: flex; align-items: center; padding: 0 .6rem;
  color: var(--pe-muted); flex-shrink: 0;
}
.pregunta-url-input {
  flex: 1; border: none; outline: none; padding: .6rem .5rem .6rem 0;
  font-family: inherit; font-size: .9rem; color: var(--pe-text);
  background: transparent; min-width: 0;
}
.pregunta-url-input::placeholder { color: var(--pe-muted); }

.mic-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--pe-border); border-radius: 6px;
  cursor: pointer; color: var(--pe-muted); padding: .25rem .5rem;
  margin-top: .35rem; transition: color .15s, border-color .15s, background .15s;
  vertical-align: middle;
}
.mic-btn:hover { color: var(--pe-red); border-color: var(--pe-red); }
.mic-btn.mic-active {
  color: var(--pe-white); background: var(--pe-red); border-color: var(--pe-red);
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225,29,72,.4); }
  50%       { box-shadow: 0 0 0 6px rgba(225,29,72,0); }
}

/* ── Upload ── */
.upload-zone {
  border: 2px dashed var(--pe-border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.upload-zone.drag-over { border-color: var(--pe-red); background: var(--pe-red-light); }
.upload-prompt { display: flex; flex-direction: column; align-items: center; gap: .5rem; color: var(--pe-muted); font-size: .875rem; }
.upload-prompt svg { stroke: var(--pe-muted); }
.upload-link { color: var(--pe-red); cursor: pointer; }
.upload-link:hover { text-decoration: underline; }
.upload-input { display: none; }

.file-list { margin-top: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.file-item { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; background: var(--pe-bg); border-radius: 6px; font-size: .875rem; }
.file-name { flex: 1; color: var(--pe-text); word-break: break-all; }
.file-name a { color: var(--pe-red); text-decoration: none; }
.file-name a:hover { text-decoration: underline; }
.file-size { color: var(--pe-muted); font-size: .8rem; white-space: nowrap; }
.file-delete { background: none; border: none; cursor: pointer; color: var(--pe-muted); font-size: 1.1rem; line-height: 1; padding: 0 .25rem; }
.file-delete:hover { color: var(--pe-danger); }

.form-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--pe-border); }

.header-progress { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--pe-muted); }

/* ── Revisión ── */
.revision-main { max-width: 800px; margin: 0 auto; padding: 2rem; }
.section-title-rev {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--pe-dark);
  margin: 2rem 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--pe-red);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rev-item { padding: .75rem 0; border-bottom: 1px solid var(--pe-border); }
.rev-pregunta { font-size: .875rem; font-weight: 500; color: var(--pe-muted); margin-bottom: .35rem; }
.rev-respuesta { font-size: .9rem; white-space: pre-wrap; }
.rev-archivo { font-size: .875rem; color: var(--pe-red); }
.rev-vacio { font-size: .875rem; color: #9ca3af; font-style: italic; }

.entrega-box {
  background: var(--pe-white);
  border: 1.5px solid var(--pe-border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-top: 2rem;
  text-align: center;
}
.entrega-box h3 { font-size: 1.2rem; margin-bottom: .5rem; }
.entrega-box p { color: var(--pe-muted); margin-bottom: 1.5rem; }

/* ── Success ── */
.text-center { text-align: center; }
.success-icon {
  width: 64px; height: 64px;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 50%;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

/* ── Admin ── */
.admin-main { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.admin-section { background: var(--pe-white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.5rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-header h2 { font-size: 1.05rem; font-weight: 600; }

.inline-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.inline-form input { flex: 1; padding: .45rem .8rem; border: 1.5px solid var(--pe-border); border-radius: 8px; font-family: inherit; font-size: .875rem; }
.hidden { display: none !important; }

.conv-list { display: flex; flex-direction: column; gap: .5rem; }
.conv-item { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 8px; background: var(--pe-bg); }
.conv-item.active { background: var(--pe-red-light); }
.conv-name { flex: 1; font-size: .875rem; font-weight: 500; color: var(--pe-text); text-decoration: none; }
.conv-name:hover { color: var(--pe-red); }
.conv-status { font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 4px; }
.conv-status.open { background: #dcfce7; color: #166534; }
.conv-status.closed { background: var(--pe-border); color: var(--pe-muted); }

.admin-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.admin-table th { text-align: left; padding: .6rem .75rem; font-weight: 600; color: var(--pe-muted); border-bottom: 2px solid var(--pe-border); }
.admin-table td { padding: .6rem .75rem; border-bottom: 1px solid var(--pe-border); vertical-align: middle; }
.admin-table tr:hover td { background: var(--pe-bg); }
.actions-cell { display: flex; gap: .3rem; flex-wrap: wrap; }

.badge { display: inline-block; padding: .15rem .5rem; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef9c3; color: #92400e; }

.admin-alumno-main { max-width: 900px; margin: 0 auto; padding: 2rem; }
.alumno-meta { display: flex; gap: 2rem; font-size: .875rem; color: var(--pe-muted); margin-bottom: 2rem; padding: 1rem; background: var(--pe-white); border-radius: var(--radius); box-shadow: var(--shadow); }

.admin-pregunta-card { background: var(--pe-white); border: 1.5px solid var(--pe-border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.admin-respuesta-original label, .admin-edicion-pendiente label, .admin-edit-form label { font-size: .75rem; font-weight: 600; color: var(--pe-muted); display: block; margin-bottom: .4rem; }
.resp-text { font-size: .9rem; white-space: pre-wrap; padding: .6rem; background: var(--pe-bg); border-radius: 6px; }
.edit-text { background: #fffbeb; border: 1px dashed var(--pe-warning); }
.resp-date { font-size: .75rem; color: var(--pe-muted); }
.admin-edicion-pendiente { margin: .75rem 0; padding: .75rem; background: #fffbeb; border-radius: 8px; border: 1px solid #fde68a; }
.admin-edit-form { margin-top: .75rem; }
.admin-textarea { width: 100%; border: 1.5px solid var(--pe-border); border-radius: 8px; padding: .6rem .8rem; font-family: inherit; font-size: .875rem; resize: vertical; margin-bottom: .5rem; }
.admin-textarea:focus { outline: none; border-color: var(--pe-red); }

.text-muted { color: var(--pe-muted); }

@media (max-width: 768px) {
  .form-sidebar { display: none; }
  .form-main { padding: 1rem; }
  .admin-table { font-size: .8rem; }
  .actions-cell { flex-direction: column; }
  .field-row { grid-template-columns: 1fr; }
}
