/* ==========================================================================
   ENCUESTA CLIMA LABORAL — INDUSTRIAS TAJÍN
   Sistema de diseño. Paleta corporativa: verde, rojo y teal (sutiles).
   ========================================================================== */

:root {
  /* Marca Tajín */
  --green:        rgba(51, 151, 63, 1);      /* #33973F */
  --green-hover:  rgba(43, 128, 54, 1);
  --green-soft:   rgba(51, 151, 63, 0.10);
  --red:          rgba(207, 43, 34, 1);      /* #CF2B22 */
  --red-soft:     rgba(207, 43, 34, 0.08);
  --teal:         rgba(30, 98, 107, 1);      /* #1E626B */
  --teal-deep:    rgba(24, 89, 98, 1);       /* #185962 */
  --teal-soft:    rgba(30, 98, 107, 0.08);

  /* Base neutra */
  --background: #f6f7f5;
  --card:       #ffffff;
  --text-strong:#15201c;
  --text-body:  #3c4844;
  --text-muted: #6b7671;
  --border:     #e6e8e4;
  --muted:      #eef0ec;

  /* Radios */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  /* Sombras sutiles */
  --shadow-sm: 0 1px 2px rgba(21, 32, 28, 0.05);
  --shadow-md: 0 10px 34px rgba(21, 32, 28, 0.08);
  --shadow-lg: 0 20px 56px rgba(21, 32, 28, 0.12);

  /* Espaciado */
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px;
  --space-6:24px; --space-8:32px; --space-12:48px; --space-16:64px; --space-24:96px;

  /* Tipografía */
  --font-sans: 'Inter','Manrope','Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs-body: clamp(1rem, 0.96rem + 0.15vw, 1.08rem);
  --fs-h2:   clamp(1.5rem, 1.2rem + 1.3vw, 2.2rem);
  --fs-h1:   clamp(2rem, 1.5rem + 2vw, 3rem);
  --fs-hero: clamp(2.4rem, 1.8rem + 3vw, 4rem);
  --lh-body: 1.6; --lh-heading: 1.15;

  --transition-fast:150ms ease; --transition-base:200ms ease; --transition-slow:260ms ease;
  --container-max: 1180px;
}

/* ------------------------------ Reset --------------------------------- */
*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-body);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
button, input, select { font: inherit; color: inherit; }
h1,h2,h3,h4 { color: var(--text-strong); line-height: var(--lh-heading); font-weight: 700; letter-spacing: -0.01em; }
a { color: var(--teal); }

/* ---------------------------- Utilidades ------------------------------ */
.container { width: 100%; max-width: var(--container-max); margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }
.center { text-align: center; }
.stack > * + * { margin-top: var(--space-4); }
.muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* ------------------------------ Botones ------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: none; cursor: pointer; font-weight: 600;
  border-radius: var(--radius-md); padding: 14px 26px;
  transition: background var(--transition-base), transform var(--transition-fast), box-shadow var(--transition-base);
  text-decoration: none; line-height: 1;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 3px solid rgba(51,151,63,0.35); outline-offset: 2px; }

.btn-primary { background: var(--green); color: #fff; box-shadow: 0 6px 18px rgba(51,151,63,0.25); }
.btn-primary:hover { background: var(--green-hover); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-ghost { background: transparent; color: var(--teal-deep); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--muted); }

.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover { background: var(--teal-deep); }

.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { filter: brightness(0.94); }

.btn-lg { padding: 18px 40px; font-size: 1.15rem; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }

/* ------------------------------ Cards --------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: clamp(20px, 4vw, 40px);
}

/* ============================ PORTADA ================================= */
.hero-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 0 var(--space-8);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--teal-soft), transparent 60%),
    radial-gradient(1000px 500px at -10% 110%, var(--green-soft), transparent 55%);
}
.hero-banner {
  width: 100%;
  display: block;
  margin-bottom: var(--space-12);
  background: var(--teal-deep);
}
.hero {
  text-align: center; max-width: 720px; animation: fadeUp 0.6s ease both;
  padding-inline: clamp(16px, 4vw, 40px);
}
.hero-logo {
  width: min(420px, 78vw); margin: 0 auto var(--space-8);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.hero .eyebrow {
  display: inline-block; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--teal); background: var(--teal-soft);
  padding: 7px 16px; border-radius: 999px; margin-bottom: var(--space-6);
}
.hero h1 { font-size: var(--fs-hero); margin-bottom: var(--space-4); }
.hero h1 .accent { color: var(--green); }
.hero p.lead { font-size: 1.15rem; color: var(--text-body); max-width: 560px; margin: 0 auto var(--space-8); }

/* ---------------------- Barra superior encuesta ----------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(246,247,245,0.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--text-strong); }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); }
.brand small { display:block; font-weight: 500; color: var(--text-muted); font-size: 0.78rem; letter-spacing: 0.02em; }

/* --------------------------- Progreso --------------------------------- */
.progress { padding-top: var(--space-6); }
.progress-meta { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.progress-bar { height: 8px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--teal), var(--green)); border-radius: 999px; transition: width var(--transition-slow); }

/* --------------------------- Pantalla de pregunta --------------------- */
.survey-main { padding: var(--space-8) 0 var(--space-16); }
.question-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-md);
  padding: clamp(22px, 4vw, 48px);
  animation: cardIn 0.35s ease both;
}
.q-index { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green); margin-bottom: 12px; }
.q-title { font-size: clamp(1.25rem, 1rem + 1.4vw, 1.9rem); margin-bottom: 6px; }
.q-help { color: var(--text-muted); font-size: 0.95rem; margin-bottom: var(--space-6); }
.q-body { margin-top: var(--space-6); }

/* Opciones tipo tarjeta seleccionable */
.opt-list { display: grid; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  padding: 16px 18px; cursor: pointer; background: var(--card);
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}
.opt:hover { border-color: var(--green); background: var(--green-soft); }
.opt input { accent-color: var(--green); width: 20px; height: 20px; flex: 0 0 auto; }
.opt.selected { border-color: var(--green); background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green); }
.opt .opt-label { font-weight: 500; color: var(--text-strong); }

/* Campo de texto */
.field-text {
  width: 100%; padding: 16px 18px; border: 1.5px solid var(--border);
  border-radius: var(--radius-md); background: var(--card); color: var(--text-strong);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.field-text:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

/* Matriz: cada fila es su propio bloque con botones de escala */
.matrix { display: grid; gap: var(--space-6); }
.mrow { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; background: var(--card); }
.mrow-label { font-weight: 600; color: var(--text-strong); margin-bottom: 12px; }
.scale { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.scale label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-align: center; padding: 12px 8px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem; color: var(--text-body);
  transition: border-color var(--transition-fast), background var(--transition-fast);
  min-height: 74px;
}
.scale label:hover { border-color: var(--teal); background: var(--teal-soft); }
.scale input { accent-color: var(--green); width: 18px; height: 18px; }
.scale label.selected { border-color: var(--green); background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green); color: var(--text-strong); font-weight: 600; }

/* Navegación < > */
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: var(--space-8); }
.nav-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 56px; height: 56px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--card); cursor: pointer; color: var(--teal-deep);
  transition: all var(--transition-fast); flex: 0 0 auto;
}
.nav-btn:hover:not(:disabled) { border-color: var(--green); color: var(--green); transform: translateY(-1px); }
.nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.nav-btn svg { width: 22px; height: 22px; }
.nav-center { flex: 1; text-align: center; font-size: 0.85rem; color: var(--text-muted); }

.inline-alert { color: var(--red); font-size: 0.9rem; margin-top: 12px; min-height: 1.2em; }

/* --------------------------- Pantalla gracias ------------------------- */
.thanks {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--space-8) 0;
  background: radial-gradient(1000px 500px at 50% -10%, var(--green-soft), transparent 60%);
}
.thanks-inner { max-width: 620px; text-align: center; animation: fadeUp 0.6s ease both; }
.check-badge {
  width: 92px; height: 92px; border-radius: 50%; margin: 0 auto var(--space-8);
  display: grid; place-items: center; background: var(--green); color: #fff; box-shadow: 0 12px 30px rgba(51,151,63,0.35);
}
.check-badge svg { width: 46px; height: 46px; }

/* --------------------------- Mensaje ya contestó ---------------------- */
.notice { border-left: 4px solid var(--red); background: var(--red-soft); border-radius: var(--radius-md); padding: 20px 22px; text-align: left; }
.notice.info { border-left-color: var(--teal); background: var(--teal-soft); }

/* ============================ LOGIN ================================== */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--space-8) 0;
  background: radial-gradient(900px 500px at 100% 0%, var(--teal-soft), transparent 55%); }
.auth-card { width: min(440px, 92vw); }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.form-group { margin-bottom: var(--space-4); }
.form-group label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; color: var(--text-strong); }

/* ============================ ADMIN ================================== */
.admin-header { background: var(--teal-deep); color: #fff; padding: var(--space-6) 0; }
.admin-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-header h1 { color: #fff; font-size: 1.4rem; }
.admin-header .who { font-size: 0.9rem; opacity: 0.85; }
.admin-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin: var(--space-8) 0; }

.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-6); }
.quad { border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow-sm); overflow: hidden; }
.quad-head { padding: 18px 20px; color: #fff; }
.quad-head h3 { color: #fff; font-size: 1.05rem; line-height: 1.3; }
.quad-head .legal { font-size: 0.78rem; opacity: 0.9; margin-top: 2px; }
.quad-body { padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.donut { position: relative; width: 160px; height: 160px; }
.donut .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.7rem; font-weight: 800; color: var(--text-strong); }
.quad-stats { display: flex; gap: 18px; font-size: 0.9rem; color: var(--text-muted); }
.quad-stats b { color: var(--text-strong); font-size: 1.05rem; display: block; }

.total-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-8); }
.total-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; }
.total-card .n { font-size: 1.9rem; font-weight: 800; color: var(--green); }
.total-card .l { font-size: 0.85rem; color: var(--text-muted); }

/* ============================ TABLA usuarios ========================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data thead th { background: var(--green); color: #fff; font-weight: 600; position: sticky; top: 0; }
table.data tbody tr:hover { background: var(--green-soft); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.no { background: var(--red-soft); color: var(--red); }

.toolbar-search { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: var(--space-4); }
.toolbar-search input, .toolbar-search select { padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--card); }

.flash { padding: 14px 18px; border-radius: var(--radius-md); margin-bottom: var(--space-4); font-weight: 500; }
.flash.ok { background: var(--green-soft); color: var(--green); border: 1px solid rgba(51,151,63,0.3); }
.flash.err { background: var(--red-soft); color: var(--red); border: 1px solid rgba(207,43,34,0.3); }

/* Modal simple */
.modal-backdrop { position: fixed; inset: 0; background: rgba(21,32,28,0.45); display: none; place-items: center; z-index: 50; padding: 20px; }
.modal-backdrop.open { display: grid; }
.modal { width: min(520px, 94vw); background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: clamp(20px,4vw,32px); animation: cardIn 0.3s ease both; }
.modal h3 { margin-bottom: var(--space-4); }

/* ------------------------------ Animaciones --------------------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px);} to { opacity:1; transform:none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(0.99);} to { opacity:1; transform:none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------ Responsive ---------------------------- */
@media (max-width: 520px) {
  .nav-btn { width: 50px; height: 50px; }
  .scale { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
  .admin-toolbar { flex-direction: column; }
  .admin-toolbar .btn { width: 100%; }
}
