/* =========================================================
   SEARCA S.A. — Portal Interno de Entrenamiento
   styles.css
   =======================================================*/

/* -----------------------
   Variables de color/tema
   ----------------------- */
:root {
  --bg: #f4f7fa;
  --bg-elev: #ffffff;
  --text: #1b1f24;
  --muted: #5b6b7c;
  --brand: #27486e;
  --brand-2: #2f6aa1;
  --accent: #4fa3ff;
  --danger: #e0565b;
  --ok: #35c48b;

  --border: #d0d8e0;
  --shadow: 0 8px 22px rgba(0,0,0,.08);

  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 14px;

  --space-1: .5rem;
  --space-2: .75rem;
  --space-3: 1rem;
  --space-4: 1.25rem;
  --space-5: 1.75rem;
  --space-6: 2.25rem;
  --space-8: 3rem;
}

/* Reset + tipografía */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: .5rem 0 0; }
h1, h2, h3 { margin: 0 0 .25rem 0; line-height: 1.2; }
small { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Helpers */
.hidden { display: none !important; }
.center { display:flex; align-items:center; justify-content:center; }
.container { width: min(1200px, 100%); margin: 0 auto; padding: 0 var(--space-3); }
[hidden] { display: none !important; }

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: -999px;
  padding: .5rem .75rem;
  background: #fff;
  color: #000;
  border-radius: 6px;
}
.skip-link:focus {
  left: .5rem;
  top: .5rem;
  z-index: 9999;
}

/* Foco global */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* =======================
   PANTALLA DE ACCESO
   ======================= */
.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--space-6) var(--space-3);
  padding-top: calc(var(--space-6) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  padding-left: calc(var(--space-3) + env(safe-area-inset-left, 0px));
  padding-right: calc(var(--space-3) + env(safe-area-inset-right, 0px));
}
.gate-card {
  width: min(680px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  padding: var(--space-6) var(--space-5);
}
.gate-header {
  text-align: center;
  margin-bottom: var(--space-5);
}
.logo-login {
  margin-inline: auto;
  margin-bottom: var(--space-3);
}

.form {
  display: grid;
  gap: .75rem;
}
.form label { font-weight: 600; }
.form input[type="text"],
.form input[type="password"] {
  width: 100%;
  padding: .9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f9fbfd;
  color: var(--text);
  font-size: 16px;
}
.form input::placeholder { color: #9aa9b7; }
.external-link { margin-top: .5rem; }

.error {
  color: #a4000f;
  background: #ffeef0;
  border: 1px solid #f5c2c7;
  padding: .6rem .75rem;
  border-radius: 10px;
}

/* Mostrar/ocultar contraseña */
.password-group {
  position: relative;
  display: grid;
}
.password-group input {
  padding-right: 3rem; /* espacio para el botón */
}
.toggle-password {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: .35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.toggle-password svg { display: block; }

/* =======================
   CABECERA / NAVEGACIÓN
   ======================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  padding-top: env(safe-area-inset-top, 0px);
}
.site-header .brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem var(--space-3);
}
.logo-header { object-fit: contain; }

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .25rem var(--space-3) var(--space-3);
}
.site-nav [role="tablist"] {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.tab-btn {
  border: 1px solid var(--border);
  background: #f4f7fa;
  color: var(--text);
  padding: .6rem .9rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
.tab-btn[aria-selected="true"] {
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  color: #fff;
  border-color: transparent;
}

/* =======================
   BOTONES
   ======================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-weight: 600;
  padding: .8rem 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  color: #fff;
}
.btn-outline {
  background: transparent;
  color: var(--brand);
  border-color: var(--border);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: transparent;
  padding: .6rem .8rem;
}
.btn-block { width: 100%; }
.small { font-size: .9rem; padding: .55rem .75rem; }

/* =======================
   CONTENIDO PRINCIPAL
   ======================= */
main {
  padding: var(--space-4) var(--space-3) var(--space-6);
}
.section { display: grid; gap: var(--space-4); }
.section-lead { color: var(--muted); }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.iframe-wrap { padding: var(--space-3); }
.iframe-wrap iframe {
  width: 100%;
  height: min(70vh, 680px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.card-actions {
  padding: var(--space-3);
  text-align: right;
}

/* =======================
   LISTA DE CONTACTOS
   ======================= */
.team-list {
  list-style: none;
  display: grid;
  gap: var(--space-3);
  padding: 0;
  margin: 0;
}
.team-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
}
.team-item img {
  width: 64px; height: 64px;
  border-radius: 999px; /* foto redonda */
  object-fit: cover;
  border: 1px solid #ccc;
}
.team-item p { margin-top: .35rem; color: var(--muted); }

/* =======================
   PIE DE PÁGINA
   ======================= */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-4) var(--space-3) var(--space-6);
  text-align: center;
  background: #f9fafb;
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
}

/* =======================
   ESTADOS / ROLES
   ======================= */
.admin-only { display: none; }

/* =======================
   RESPONSIVE
   ======================= */
@media (min-width: 640px) {
  .team-list { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .team-list { grid-template-columns: 1fr 1fr 1fr; }
}

/* =======================
   Impresión (básico)
   ======================= */
@media print {
  .site-header, .site-nav, .btn, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .team-item { border: 1px solid #bbb; box-shadow: none; }
}

/* Garantiza que [hidden] siempre oculte */
[hidden] { 
  display: none !important;
}
/* Login 1.8 — estilos mínimos, respetando tu V1 */
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 1000; }
.modal-content { background: #fff; padding: 1.5rem; border-radius: 12px; width: min(420px, 90vw); }
.password-wrapper { position: relative; }
.password-wrapper input { width: 100%; padding-right: 2.5rem; }
#toggle-pass { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; }
.error { color: #b00020; margin-top: .5rem; }

/* Chips de estado (se usarán en Turnos más adelante) */
.chip { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .75rem; }
.chip.pendiente { background: #fff3cd; }
.chip.en_curso { background: #cfe2ff; }
.chip.aprobado { background: #d1e7dd; }
.chip.rechazado { background: #f8d7da; }
/* Turnos 3.6 — Grid de tarjetas */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

/* Tarjeta turno */
.turno-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
  cursor: pointer;
}
.turno-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

.turno-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.turno-title { font-weight: 600; }
.chip { display:inline-block; padding:.15rem .5rem; border-radius:999px; font-size:.75rem; }
.chip.pendiente { background:#fff3cd; }
.chip.en_curso { background:#cfe2ff; }
.chip.aprobado { background:#d1e7dd; }
.chip.rechazado { background:#f8d7da; }
.meta { color:#6b7280; font-size:.85rem; }

/* Drawer lateral para resumen del piloto */
.drawer {
  position: fixed; top: 0; right: 0; width: min(420px, 90vw); height: 100%;
  background:#fff; border-left:1px solid #e5e7eb; box-shadow: -4px 0 16px rgba(0,0,0,.08);
  padding:16px; overflow:auto; z-index:2000;
}
.hidden { display: none !important; }
/* Feedback 5.4 — Controles del formulario */
textarea, select {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  font: inherit;
  background: #fff;
}
textarea:focus, select:focus { outline: 2px solid #c7d2fe; outline-offset: 1px; }
/* Admin 6.0 – Inputs y tabla */
#sec-admin label { display:block; margin-top:8px; font-weight:600; }
#sec-admin input, #sec-admin select {
  width:100%; padding:8px; border:1px solid #e5e7eb; border-radius:8px;
  font:inherit; background:#fff;
}
#sec-admin input:focus, #sec-admin select:focus {
  outline:2px solid #c7d2fe; outline-offset:1px;
}
#users-table td, #users-table th { padding:8px; border-bottom:1px solid #eee; }
/* ========== Admin 6.A — Layout limpio ========== */

/* Tarjeta consistente */
#sec-admin .card { padding: 14px; border-radius: 12px; }

/* Grid responsivo del formulario */
#sec-admin .form-grid {
  display: grid;
  gap: 10px;
}
@media (min-width: 640px) {
  #sec-admin .form-grid {
    grid-template-columns: 1fr 1fr; /* dos columnas */
  }
  #sec-admin .form-grid .col-span-2 { grid-column: 1 / -1; } /* ocupa todo */
}

/* Labels e inputs */
#sec-admin label { font-weight: 600; margin-bottom: 4px; display: block; }
#sec-admin input[type="text"],
#sec-admin input[type="password"],
#sec-admin select,
#sec-admin textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  font: inherit;
}
#sec-admin input:focus,
#sec-admin select:focus,
#sec-admin textarea:focus {
  outline: 2px solid #c7d2fe;
  outline-offset: 1px;
}

/* Checkbox en línea */
#sec-admin .form-row-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botón */
#sec-admin .actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
#sec-admin .actions .btn-primary {
  min-width: 160px;
}

/* Tabla limpia y uniforme */
#users-table {
  border-collapse: collapse;
  width: 100%;
}
#users-table thead th {
  position: sticky; top: 0;
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
}
#users-table tbody td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
#users-table tbody tr:nth-child(odd) { background: #fcfcfd; }

/* Columnas: ancho sugerido */
#users-table th:nth-child(1), #users-table td:nth-child(1) { width: 40%; }
#users-table th:nth-child(2), #users-table td:nth-child(2) { width: 20%; }
#users-table th:nth-child(3), #users-table td:nth-child(3) { width: 40%; color:#64748b; }

/* Truncar si es muy largo */
.truncate {
  max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Admin 6.B – Columna Acciones */
#users-table th:last-child, #users-table td:last-child { width: 220px; }
.btn.btn-outline { border:1px solid #e5e7eb; background:#fff; border-radius:8px; padding:6px 10px; cursor:pointer; }
.btn.btn-outline:hover { background:#f9fafb; }
/* ===== Overrides de maquetación Perfil (Chrome) ===== */

/* Contenedor de la tarjeta principal */
#pilot-profile .card{
  margin: 8px 0 16px 0;
  border-radius: 14px;
}

/* Cabecera: foto + datos bien alineados */
#pilot-profile .profile-head{
  display:flex;
  align-items:center;
  gap:16px;
  padding: 6px 2px 2px 2px;
}
#pilot-profile .profile-head img{
  flex: 0 0 64px;
  width:64px; height:64px; border-radius:50%;
  object-fit: cover; object-position:center;
  background:#f2f5f9; border:1px solid #e6e9f0;
}
#pilot-profile .profile-head .name{ display:block; line-height:1.25; }
#pilot-profile .profile-head .meta{ margin-top:2px; }

/* Banda “último feedback”: título, chip y comentario debajo */
#pilot-profile .lastfb{
  display:grid;
  grid-template-columns: auto 1fr;
  align-items:center;
  gap:10px 12px;
}
#pilot-profile .lastfb .label{ grid-column:1/2; white-space:nowrap; }
#pilot-profile .lastfb .chip { grid-column:1/2; }
#pilot-profile .lastfb .comment{
  grid-column:1/3;
  color:#475569; font-size:.92rem;
  margin-top:2px;
}

/* Tabla con mejor respiración */
#pilot-profile table{ width:100%; border-collapse:separate; border-spacing:0; }
#pilot-profile thead th{
  padding:12px; background:#f8fafc; border-bottom:1px solid #e6eaf0;
}
#pilot-profile tbody td{
  padding:12px; border-bottom:1px solid #eef2f7;
}
#pilot-profile tbody tr:last-child td{ border-bottom:none; }

/* Anchos sugeridos de columnas (evita “salto” en chrome) */
#pilot-profile th:nth-child(1), #pilot-profile td:nth-child(1){ width:140px; }  /* Fecha */
#pilot-profile th:nth-child(2), #pilot-profile td:nth-child(2){ width:28%; }   /* Simulador */
#pilot-profile th:nth-child(3), #pilot-profile td:nth-child(3){ width:28%; }   /* Instructor */
#pilot-profile th:nth-child(4), #pilot-profile td:nth-child(4){ width:120px; text-align:center; }

/* Chip estados (consistente con resto del portal) */
#pilot-profile .chip{
  display:inline-flex; align-items:center;
  padding:4px 10px; border-radius:999px;
  font-size:.80rem; font-weight:600; line-height:1;
  border:1px solid transparent;
}
#pilot-profile .chip.aprobado{ background:#ecfdf5; color:#065f46; border-color:rgba(6,95,70,.15); }
#pilot-profile .chip.rechazado{ background:#fef2f2; color:#991b1b; border-color:rgba(153,27,27,.15); }
#pilot-profile .chip.en_curso, 
#pilot-profile .chip.en-curso{ background:#fff7ed; color:#9a3412; border-color:rgba(154,52,18,.15); }

/* Responsive suave */
@media (max-width: 900px){
  #pilot-profile .profile-head{ align-items:flex-start; }
  #pilot-profile th:nth-child(2), #pilot-profile td:nth-child(2),
  #pilot-profile th:nth-child(3), #pilot-profile td:nth-child(3){ width:auto; }
}
