/* ==========================================================================
   Theme de login CTC — "Login unificado" (Figma ayfGBr4r1aEuagF5ESBdgY).
   Layout split: hero gradiente (izq) + panel form blanco (der) en desktop;
   hero full-bleed + card flotante en mobile. Mobile-first.
   ========================================================================== */

/* --- Fuentes propietarias CTC (woff2 en resources/fonts/) ------------------- */
@font-face {
  font-family: "NT Bau";
  src: url("../fonts/NTBau-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "NT Bau";
  src: url("../fonts/NTBau-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "RocaOne";
  src: url("../fonts/RocaOne-Light.woff2") format("woff2");
  font-weight: 300 400; font-style: normal; font-display: swap;
}

:root {
  /* Tokens del Figma (get_variable_defs) */
  --ctc-white: #ffffff;
  --ctc-gray-00: #fcfffe;
  --ctc-gray-20: #edf2f0;
  --ctc-gray-40: #b9bfbd;
  --ctc-gray-60: #494d4b;
  --ctc-gray-80: #303333;
  --ctc-gray-100: #171a1a;
  --ctc-blue: #468eff;
  --ctc-blue-light: #bfe1fc;
  --ctc-error: #c00808;
  --ctc-error-light: #ffe5e5;
  --ctc-success: #206614;
  --ctc-success-light: #e5ffea;
  --ctc-font-body: "NT Bau", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ctc-font-display: "RocaOne", "Recoleta", "Georgia", serif;
  --ctc-shadow-media: 0 5px 16px rgba(0, 0, 0, 0.08), 0 2px 10px rgba(0, 0, 0, 0.10);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body.ctc-login {
  margin: 0;
  font-family: var(--ctc-font-body);
  letter-spacing: -0.5px;
  color: var(--ctc-gray-80);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Layout split (base = mobile: hero full-bleed + card flotante)
   ========================================================================== */
.ctc-split {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Hero: fondo gradiente + toros/esferas. Mobile = pantalla completa fija. */
.ctc-hero {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #6a8ecb no-repeat center / cover;
  background-image: url("../img/hero-mobile.png?v=2");
}
.ctc-hero__logo {
  position: absolute;
  top: 54px; left: 20px;
  width: 103px; height: auto;
  z-index: 1;
}

/* Panel: contenedor del form. Mobile = card blanca flotante sobre el hero. */
.ctc-panel {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 128px 10px 32px;
}
.ctc-panel__inner {
  width: 100%;
  max-width: 340px;
  background: var(--ctc-white);
  border-radius: 24px;
  box-shadow: var(--ctc-shadow-media);
  padding: 48px 24px 32px;
}

/* --- Header ------------------------------------------------------------------ */
.ctc-panel__header { text-align: center; margin-bottom: 32px; }
.ctc-title {
  font-family: var(--ctc-font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 30px;
  letter-spacing: 1px;
  margin: 0;
  color: var(--ctc-gray-100);
}

/* ==========================================================================
   Form
   ========================================================================== */
.ctc-form { display: flex; flex-direction: column; }
.ctc-field { margin-bottom: 24px; }

.ctc-label {
  display: block;
  font-size: 14px; line-height: 20px;
  color: var(--ctc-gray-60);
  margin-bottom: 6px;
}

.ctc-input-wrap { position: relative; }
.ctc-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: -0.5px;
  color: var(--ctc-gray-100);
  background: var(--ctc-white);
  border: 1.5px solid var(--ctc-gray-80);
  border-radius: 12px;
  outline: none;
}
.ctc-input::placeholder { color: var(--ctc-gray-40); }
.ctc-input:focus { border-color: var(--ctc-gray-80); }
.ctc-input[aria-invalid="true"] { border-color: var(--ctc-error); }
.ctc-input-wrap .ctc-input { padding-right: 48px; }

.ctc-eye {
  position: absolute;
  top: 50%; right: 8px;
  transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  padding: 0; border: 0;
  background: transparent;
  color: var(--ctc-gray-60);
  cursor: pointer;
}
.ctc-eye:hover { color: var(--ctc-gray-80); }
.ctc-eye__icon { width: 22px; height: 22px; }

.ctc-field-error {
  display: block;
  margin-top: 6px;
  font-size: 13px; line-height: 18px;
  color: var(--ctc-error);
}

/* Password requirements: always visible, the ones already met turn green (JS is-ok). */
.ctc-pwd-reqs__title {
  margin: 10px 0 6px;
  font-size: 13px; line-height: 18px;
  color: var(--ctc-gray-60);
}

.ctc-pwd-reqs {
  margin: 0; padding: 0;
  list-style: none;
  font-size: 13px; line-height: 18px;
}
.ctc-pwd-reqs li {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
  color: var(--ctc-gray-40);
}
.ctc-pwd-reqs li::before {
  content: "○";
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}
.ctc-pwd-reqs li.is-ok { color: var(--ctc-success); }
.ctc-pwd-reqs li.is-ok::before { content: "✓"; }

/* Botón Ingresar: disabled gris por defecto; azul al completar (JS is-active). */
.ctc-submit {
  height: 48px;
  margin-top: 8px;
  border: 0;
  border-radius: 32px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.5px;
  background: var(--ctc-gray-20);
  color: var(--ctc-gray-40);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ctc-submit.is-active {
  background: var(--ctc-blue);
  color: var(--ctc-white);
}
.ctc-submit.is-active:hover { filter: brightness(1.05); }
.ctc-submit:disabled { opacity: 0.7; cursor: default; }

/* The default hidden state comes from the 'hidden' attribute in the markup; this
   rule reinforces it. If this CSS arrives stale from cache, the spinner stays hidden. */
.ctc-submit__spinner {
  display: none;
  animation: ctc-spin 0.8s linear infinite;
}
.ctc-submit.is-loading .ctc-submit__text { display: none; }
.ctc-submit.is-loading .ctc-submit__spinner { display: inline-block; }

@keyframes ctc-spin { to { transform: rotate(360deg); } }

/* --- Checkbox para páginas con opciones adicionales ------------------------- */
.ctc-field--checkbox { margin-bottom: 16px; }
.ctc-checkbox-label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  font-size: 14px;
  line-height: 20px;
  color: var(--ctc-gray-60);
}
.ctc-checkbox-label input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 10px 0 0;
  accent-color: var(--ctc-blue);
  cursor: pointer;
}
.ctc-checkbox-text {
  flex: 1;
}

/* --- Botón de link (cancelar, volver, etc.) -------------------------------- */
.ctc-link-btn,
a.ctc-link-btn {
  background: none;
  border: none;
  color: var(--ctc-blue);
  font-family: inherit;
  font-size: 14px;
  letter-spacing: -0.3px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  display: inline-block;
}
.ctc-link-btn:hover,
a.ctc-link-btn:hover {
  text-decoration: none;
}

/* --- Mensaje global / alerta ------------------------------------------------- */
.ctc-alert {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px; line-height: 20px;
}
.ctc-alert--error   { background: var(--ctc-error-light);   color: var(--ctc-error); }
.ctc-alert--warning { background: #fff6e5;                  color: #8a5a00; }
.ctc-alert--success { background: var(--ctc-success-light); color: var(--ctc-success); }
.ctc-alert--info    { background: #eaf1fb;                  color: #28527a; }

/* ==========================================================================
   Social (IdPs) — se renderiza solo si social.providers tiene contenido.
   Botones outlined blancos con icono de marca.
   ========================================================================== */
.ctc-social { margin-top: 32px; text-align: center; }
.ctc-social__label {
  font-size: 14px; line-height: 20px;
  color: var(--ctc-gray-80);
  margin: 0 0 16px;
}
.ctc-social__list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.ctc-social__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 207px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--ctc-gray-40);
  border-radius: 8px;
  font-size: 14px;
  letter-spacing: -0.3px;
  color: var(--ctc-gray-80);
  text-decoration: none;
  background: var(--ctc-white);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ctc-social__btn:hover { background: var(--ctc-gray-20); }
.ctc-social__icon {
  flex: none;
  width: 18px; height: 18px;
  background: no-repeat center / contain;
}
.ctc-social__icon--google {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='%234285F4' d='M45.12 24.5c0-1.56-.14-3.06-.4-4.5H24v8.51h11.84c-.51 2.75-2.06 5.08-4.39 6.64v5.52h7.11c4.16-3.83 6.56-9.47 6.56-16.17z'/%3E%3Cpath fill='%2334A853' d='M24 46c5.94 0 10.92-1.97 14.56-5.33l-7.11-5.52c-1.97 1.32-4.49 2.1-7.45 2.1-5.73 0-10.58-3.87-12.31-9.07H4.34v5.7C7.96 41.07 15.4 46 24 46z'/%3E%3Cpath fill='%23FBBC05' d='M11.69 28.18c-.44-1.32-.69-2.73-.69-4.18s.25-2.86.69-4.18v-5.7H4.34A21.99 21.99 0 0 0 2 24c0 3.55.85 6.91 2.34 9.88l7.35-5.7z'/%3E%3Cpath fill='%23EA4335' d='M24 9.75c3.23 0 6.13 1.11 8.41 3.29l6.31-6.31C34.91 2.97 29.93 1 24 1 15.4 1 7.96 5.93 4.34 13.12l7.35 5.7c1.73-5.2 6.58-9.07 12.31-9.07z'/%3E%3C/svg%3E");
}
.ctc-social__icon--microsoft {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 23 23'%3E%3Cpath fill='%23F35325' d='M1 1h10v10H1z'/%3E%3Cpath fill='%2381BC06' d='M12 1h10v10H12z'/%3E%3Cpath fill='%2305A6F0' d='M1 12h10v10H1z'/%3E%3Cpath fill='%23FFBA08' d='M12 12h10v10H12z'/%3E%3C/svg%3E");
}
.ctc-social__icon--generic {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8' r='4' fill='%23494d4b'/%3E%3Cpath fill='%23494d4b' d='M4 21c0-4 3.6-7 8-7s8 3 8 7z'/%3E%3C/svg%3E");
}

/* --- Footer cookies ---------------------------------------------------------- */
.ctc-cookies {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
  font-size: 12px; line-height: 16px;
  color: var(--ctc-gray-80);
  text-align: center;
}
.ctc-cookies__icon { flex: none; color: var(--ctc-gray-80); }
.ctc-cookies__btn {
  display: inline-flex; align-items: center;
  padding: 0; margin: 0; border: 0;
  background: none; cursor: pointer;
  font: inherit;
  color: var(--ctc-blue);
  text-decoration: none;
}
.ctc-cookies__btn:hover { text-decoration: underline; }

/* ==========================================================================
   Modal de cookies (base = bottom-sheet mobile). Fade + slide.
   ========================================================================== */
body.ctc-no-scroll { overflow: hidden; }

.ctc-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(22, 30, 48, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.ctc-modal-backdrop[hidden] { display: none; }
.ctc-modal-backdrop.is-open { opacity: 1; visibility: visible; }

.ctc-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 88vh;
  background: var(--ctc-white);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -2px 24px rgba(0, 0, 0, 0.18);
  transform: translateY(100%);
  transition: transform 0.30s cubic-bezier(0.22, 0.61, 0.36, 1);
  overflow: hidden;
}
.ctc-modal-backdrop.is-open .ctc-modal { transform: translateY(0); }

.ctc-modal__handle {
  flex: none;
  width: 48px; height: 5px;
  margin: 12px auto 2px;
  border-radius: 5px;
  background: #d6dbd9;
}
.ctc-modal__close { display: none; }

.ctc-modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 24px 8px;
  -webkit-overflow-scrolling: touch;
}
.ctc-modal__body::-webkit-scrollbar { width: 8px; }
.ctc-modal__body::-webkit-scrollbar-thumb { background: var(--ctc-gray-40); border-radius: 8px; }
.ctc-modal__body::-webkit-scrollbar-track { background: transparent; }

.ctc-modal__title {
  margin: 8px 0 20px;
  font-family: var(--ctc-font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 30px;
  letter-spacing: 0.8px;
  text-align: center;
  color: var(--ctc-gray-80);
}
.ctc-modal__text { color: var(--ctc-gray-80); }
.ctc-modal__text p {
  margin: 0;
  font-size: 18px;
  line-height: 24px;
  text-align: center;
}

.ctc-modal__footer {
  flex: none;
  padding: 20px 24px 28px;
}
.ctc-modal__ok {
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 32px;
  background: var(--ctc-blue-light);
  color: var(--ctc-gray-80);
  font-family: var(--ctc-font-body);
  font-size: 20px;
  letter-spacing: -0.5px;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.ctc-modal__ok:hover { filter: brightness(0.97); }

/* ==========================================================================
   Desktop — split 708/732 del frame "Desktop - Login" 1440x900
   ========================================================================== */
@media (min-width: 768px) {
  .ctc-split { flex-direction: row; }

  .ctc-hero {
    position: relative;
    inset: auto;
    flex: 0 0 49.17%;             /* 708 / 1440 */
    align-self: stretch;
    overflow: hidden;
    background-image: url("../img/hero-desktop.png?v=2");
  }
  .ctc-hero__logo { display: none; }  /* en desktop el logo va horneado en el hero */

  /* Hover del isotipo (desktop-only): wordmark -> cara sonriendo -> guiño en loop.
     Las 3 imágenes comparten decoración; sólo cambia el logo central, así que el
     crossfade se lee como el logo transformándose. */
  .ctc-hero::before,
  .ctc-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: no-repeat center / cover;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
  }
  .ctc-hero::before { background-image: url("../img/hero-desktop-smile.png?v=2"); }
  .ctc-hero::after  { background-image: url("../img/hero-desktop-wink.png?v=2"); }
  /* Ciclo infinito mientras hay hover: wordmark -> cara normal -> guiño -> wordmark. */
  .ctc-hero:hover::before { animation: ctc-smile 3s ease-in-out infinite; }
  .ctc-hero:hover::after  { animation: ctc-wink 3s ease-in-out infinite; }

  @keyframes ctc-smile {   /* capa "cara normal" (bajo el guiño) */
    0%, 100%  { opacity: 0; }   /* wordmark */
    16%, 66%  { opacity: 1; }   /* aparece la cara y se mantiene durante el guiño */
    80%       { opacity: 0; }   /* vuelve al wordmark */
  }
  @keyframes ctc-wink {    /* capa "guiño" (sobre la cara normal) */
    0%, 42%   { opacity: 0; }
    52%, 66%  { opacity: 1; }   /* guiña */
    80%, 100% { opacity: 0; }   /* se va junto con la cara -> wordmark */
  }
  @media (prefers-reduced-motion: reduce) {
    /* sin loop de movimiento: hover muestra la cara normal estática */
    .ctc-hero:hover::before { animation: none; opacity: 1; }
    .ctc-hero:hover::after  { animation: none; }
  }

  .ctc-panel {
    flex: 1;
    background: var(--ctc-white);
    padding: 32px 48px;
  }
  .ctc-panel__inner {
    max-width: 428px;
    background: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }

  .ctc-panel__header { margin-bottom: 40px; }
  .ctc-title { font-size: 34px; line-height: 34px; }

  .ctc-field { margin-bottom: 24px; }
  .ctc-submit { margin-top: 24px; }

  .ctc-social { margin-top: 48px; }
  .ctc-cookies { margin-top: 48px; font-size: 14px; line-height: 20px; }

  /* Modal centrado (en vez de sheet) */
  .ctc-modal-backdrop {
    align-items: center;
    padding: 24px;
    background: rgba(22, 30, 48, 0.45);
    backdrop-filter: blur(2px);
  }
  .ctc-modal {
    width: 500px;
    max-width: 100%;
    max-height: min(708px, calc(100vh - 48px));
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15), 0 1px 13px rgba(0, 0, 0, 0.05);
    transform: translateY(10px) scale(0.985);
    transition: transform 0.26s ease, opacity 0.26s ease;
    opacity: 0;
  }
  .ctc-modal-backdrop.is-open .ctc-modal { transform: none; opacity: 1; }

  .ctc-modal__handle { display: none; }
  .ctc-modal__close {
    position: absolute;
    top: 26px; right: 26px;
    z-index: 2;
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    padding: 0; border: 0;
    background: none; cursor: pointer;
    color: var(--ctc-gray-80);
  }
  .ctc-modal__close:hover { color: var(--ctc-gray-60); }

  .ctc-modal__body { padding: 44px 40px 8px; }
  .ctc-modal__title { margin: 0 0 24px; }
  .ctc-modal__footer { padding: 16px 40px 32px; }
}
