@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------------------------------------------------------
   RESET
--------------------------------------------------------- */

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

html, body { width: 100%; min-height: 100%; }

body {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------
   TOKENS (mismos colores)
--------------------------------------------------------- */

:root {
  --bg-deep: #03070d;
  --bg-panel: #060f1c;
  --card: #0a1a2c;
  --card-soft: rgba(255, 255, 255, .025);

  --blue: #2f8fff;
  --blue-soft: #6ab2ff;
  --blue-deep: #0a4a94;

  --signal: #43e8c6;
  --alert: #ff4d6a;

  --text: #eaf3fc;
  --text-soft: #86a0b8;
  --text-mute: #48607a;

  --border: rgba(94, 154, 209, .16);
  --border-strong: rgba(110, 170, 224, .32);

  --f-display: 'Space Grotesk', 'Inter', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
}

/* ---------------------------------------------------------
   PAGE
--------------------------------------------------------- */

.page {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 30%, rgba(47, 143, 255, .10), transparent 42%),
    radial-gradient(circle at 85% 75%, rgba(67, 232, 198, .05), transparent 40%),
    linear-gradient(160deg, #020509 0%, #05101c 55%, #03070d 100%);
}

.background { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.grid {
  position: absolute;
  inset: -20%;
  opacity: .06;
  background-image:
    linear-gradient(rgba(72, 150, 214, .5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 150, 214, .5) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(700px) rotateX(62deg) translateY(35%);
  mask-image: linear-gradient(to bottom, transparent, black 30%, black 75%, transparent);
  animation: gridMove 24s linear infinite;
}

@keyframes gridMove {
  from { transform: perspective(700px) rotateX(62deg) translateY(35%); }
  to   { transform: perspective(700px) rotateX(62deg) translateY(28%); }
}

/* ---------------------------------------------------------
   PUNTOS FLOTANTES
--------------------------------------------------------- */

.floating-dots { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

.dot {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--blue-soft);
  box-shadow: 0 0 10px rgba(90, 175, 255, .8);
  opacity: .35;
  animation: dotFloat 7s ease-in-out infinite;
}

.dot.signal { background: var(--signal); box-shadow: 0 0 10px rgba(67, 232, 198, .8); }
.dot.sm { width: 3px; height: 3px; }
.dot.lg { width: 5px; height: 5px; }

@keyframes dotFloat {
  0%, 100% { transform: translateY(0); opacity: .2; }
  50% { transform: translateY(-22px); opacity: .8; }
}

/* ---------------------------------------------------------
   LOGIN SHELL
--------------------------------------------------------- */

.login-shell {
  position: relative;
  width: min(1400px, 96vw);
  height: min(720px, 92vh);
  display: grid;
  grid-template-columns: 54% 46%;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(7, 21, 38, .96), rgba(3, 9, 17, .98));
  box-shadow: 0 40px 120px rgba(0, 0, 0, .65), 0 0 0 1px rgba(0, 0, 0, .2);
  z-index: 5;
}

/* ---------------------------------------------------------
   PANEL IZQUIERDO — imagen y frase
--------------------------------------------------------- */

.visual-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8% 9%;
  border-right: 1px solid var(--border);
  background-color: #091B36;
}

.brand-logo {
  width: 400px;
  max-width: 60%;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 3;
  -webkit-mask-image: radial-gradient(ellipse 65% 65% at center, #000 58%, transparent 100%);
  mask-image: radial-gradient(ellipse 65% 65% at center, #000 58%, transparent 100%);
}

.brand-logo img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.blue-line {
  width: 52px;
  height: 4px;
  margin: 34px 0 26px;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--blue), var(--signal));
  box-shadow: 0 0 14px rgba(47, 143, 255, .55);
  position: relative;
  z-index: 3;
}

.hero-text { position: relative; z-index: 3; }

.hero-text h1 {
  font-family: var(--f-display);
  font-size: clamp(32px, 3vw, 48px);
  line-height: 1.1;
  letter-spacing: -1.2px;
  font-weight: 700;
  color: #f2f8fd;
  text-transform: uppercase;
}

.hero-text h1 span { color: var(--blue-soft); }

.hero-text p {
  max-width: 420px;
  margin-top: 24px;
  color: var(--text-soft);
  font-size: 19.5px;
  line-height: 1.7;
}

/* estado de plataforma */

.platform-status {
  position: relative;
  z-index: 3;
  margin-top: 52px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(6, 24, 42, .85), rgba(2, 10, 19, .9));
  backdrop-filter: blur(10px);
}

.status-light {
  width: 8px; height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 8px var(--signal), 0 0 16px rgba(67, 232, 198, .5);
}

.platform-status strong { display: block; font-family: var(--f-mono); color: #d8e8f8; font-size: 16px; letter-spacing: 1.1px; }
.platform-status small { display: block; margin-top: 3px; color: var(--text-mute); font-size: 16px; }

/* ---------------------------------------------------------
   PANEL DERECHO — formulario
--------------------------------------------------------- */

.auth-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background:
    radial-gradient(circle at 70% 25%, rgba(47, 143, 255, .14), transparent 45%),
    radial-gradient(circle at 15% 85%, rgba(67, 232, 198, .07), transparent 40%),
    linear-gradient(165deg, #0a1c33 0%, #030a15 100%);
}

.auth-card {
  position: relative;
  width: min(400px, 100%);
  z-index: 3;
}

/* seguridad */

.secure-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(47, 143, 255, .04);
}

.secure-line svg { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: var(--blue-soft); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.secure-line span { font-family: var(--f-mono); font-size: 13.5px; letter-spacing: .8px; color: var(--text-soft); }

/* encabezado */

.auth-heading { margin-top: 28px; }

.auth-heading h2 {
  font-family: var(--f-display);
  color: #f2f8fd;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -1.1px;
  font-weight: 700;
}

.auth-heading h2 span { color: var(--blue); }

.auth-heading p { margin-top: 12px; color: var(--text-soft); font-size: 13px; line-height: 1.5; }

/* formulario */

.login-tab { margin-top: 28px; }

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--f-mono);
  color: var(--text-soft);
  font-size: 16.5px;
  font-weight: 500;
  letter-spacing: 1.6px;
}

.input-wrapper { position: relative; width: 100%; }

.input-wrapper input {
  width: 100%;
  height: 52px;
  padding: 0 46px 0 44px;
  border-radius: 9px;
  border: 1px solid var(--border);
  outline: none;
  background: var(--card-soft);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15.5px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.input-wrapper input::placeholder { color: var(--text-mute); }

.input-wrapper input:focus {
  border-color: var(--blue);
  background: rgba(47, 143, 255, .05);
  box-shadow: 0 0 0 3px rgba(47, 143, 255, .12);
}

.input-icon {
  position: absolute;
  left: 15px; top: 50%;
  width: 16px; height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--text-soft);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  z-index: 2;
  pointer-events: none;
}

.eye-button {
  position: absolute;
  right: 13px; top: 50%;
  width: 25px; height: 25px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.eye-button svg { width: 18px; height: 18px; fill: none; stroke: var(--text-soft); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s ease; }
.eye-button:hover svg { stroke: var(--blue-soft); }

/* opciones */

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 0 20px;
  font-size: 16px;
}

.remember { position: relative; display: flex; align-items: center; gap: 9px; color: var(--text-soft); cursor: pointer; user-select: none; }
.remember input { position: absolute; opacity: 0; pointer-events: none; }

.custom-checkbox { width: 17px; height: 17px; border-radius: 5px; border: 1px solid rgba(94, 154, 209, .4); background: rgba(3, 12, 22, .7); transition: .2s ease; }
.remember input:checked + .custom-checkbox { background: var(--blue); border-color: var(--blue-soft); box-shadow: 0 0 10px rgba(47, 143, 255, .3); }
.remember input:checked + .custom-checkbox::after {
  content: '';
  display: block;
  width: 5px; height: 8px;
  margin: 2px auto 0;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}

.form-options a { color: var(--blue-soft); text-decoration: none; transition: color .2s ease; }
.form-options a:hover { color: var(--blue); }

/* mensaje */

#msg { display: none; padding: 11px 14px; margin-bottom: 14px; border-radius: 9px; font-size: 16px; line-height: 1.5; }
#msg.error { display: block; background: rgba(255, 77, 106, .1); color: #ff8a9c; border: 1px solid rgba(255, 77, 106, .28); }
#msg.success { display: block; background: rgba(67, 232, 198, .1); color: var(--signal); border: 1px solid rgba(67, 232, 198, .28); }

/* botón */

.login-button {
  position: relative;
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(110, 180, 255, .4);
  border-radius: 9px;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 15px 35px rgba(10, 74, 148, .3), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
}

.login-button:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 18px 40px rgba(10, 90, 175, .4); }
.login-button:active { transform: translateY(0); }
.login-button:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.button-arrow { font-size: 19px; font-weight: 400; transition: transform .2s ease; }
.login-button:hover .button-arrow { transform: translateX(4px); }

.attempt { display: block; margin-top: 12px; text-align: center; font-family: var(--f-mono); color: var(--text-mute); font-size: 14.5px; }

/* footer */

.auth-footer { margin-top: 26px; }
.footer-line { width: 100%; height: 1px; background: linear-gradient(90deg, transparent, var(--border), transparent); }

.footer-security { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 20px; font-family: var(--f-mono); color: var(--text-mute); font-size: 17px; }
.footer-security svg { width: 14px; height: 14px; fill: none; stroke: #4a6482; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.footer-security b { color: #33465c; font-size: 14px; }

/* ---------------------------------------------------------
   ENTRADA
--------------------------------------------------------- */

.visual-panel > * { animation: contentEnter .7s ease both; }
.auth-card { animation: authEnter .7s .08s ease both; }

@keyframes contentEnter { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: translateX(0); } }
@keyframes authEnter { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }

.input-wrapper input:focus-visible,
.login-button:focus-visible,
.eye-button:focus-visible,
.form-options a:focus-visible {
  outline: 2px solid var(--blue-soft);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------
   RESPONSIVE
--------------------------------------------------------- */

@media (max-width: 1150px) {
  .login-shell { width: 95vw; grid-template-columns: 50% 50%; }
  .hero-text h1 { font-size: 36px; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .page { min-height: 100vh; height: auto; padding: 20px; }
  .login-shell { height: auto; min-height: 0; grid-template-columns: 1fr; width: 100%; max-width: 560px; }
  .visual-panel { padding: 40px 32px; border-right: 0; border-bottom: 1px solid var(--border); }
  .platform-status { margin-top: 36px; }
  .auth-panel { padding: 34px 24px 30px; }
}

@media (max-width: 500px) {
  .page { padding: 12px; }
  .login-shell { border-radius: 16px; }
  .visual-panel { padding: 34px 24px; }
  .brand-logo { width: 170px; }
  .hero-text h1 { font-size: 27px; }
  .hero-text p { font-size: 13px; }
  .platform-status { margin-top: 28px; padding: 11px 15px; }
  .auth-heading h2 { font-size: 30px; }
  .input-wrapper input { height: 48px; }
  .login-button { height: 48px; }
}
/* ===== Imagen de fondo a pantalla completa en el panel izquierdo ===== */
.visual-panel{
  position: relative;
  background:
    linear-gradient(180deg, rgba(6,10,15,.55) 0%, rgba(6,10,15,.85) 100%),
    url('../assets/plataforma.jpeg') center / cover no-repeat;
}

/* Oculta el logo pequeño circular, ya no hace falta */
.visual-panel .crest{
  display: none;
}
/* CIAR 360 grande y centrado arriba del panel */
.visual-panel .brand-logo{
  display: flex;
  flex-direction: column;
  align-items: center;
  width: auto;
  max-width: 100%;
  padding-top: 28px;
  margin-bottom: 8px;
  -webkit-mask-image: none;
  mask-image: none;
}
.visual-panel .brand-logo .name{
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 54px;
  line-height: 1.15;
  letter-spacing: 3px;
  color: #fff;
  text-align: center;
  text-shadow: 0 6px 28px rgba(0,0,0,.65);
  margin: 0;
  white-space: nowrap;
}
/* ===========================================================
   RESPONSIVIDAD MÓVIL — Login CIAR 360
=========================================================== */
@media (max-width: 900px){
  .visual-panel .brand-logo{
    padding-top: 12px;
  }
  .visual-panel .brand-logo .name{
    font-size: 36px;
    letter-spacing: 2px;
    white-space: normal;
  }
}

@media (max-width: 500px){
  .visual-panel{
    padding: 28px 20px;
    min-height: 260px;
  }
  .visual-panel .brand-logo .name{
    font-size: 25px;
    letter-spacing: 1.5px;
    text-shadow: 0 4px 16px rgba(0,0,0,.7);
  }
  .hero-text h1{
    font-size: 24px;
    letter-spacing: -.6px;
  }
  .hero-text p{
    font-size: 14px;
    margin-top: 14px;
  }
  .platform-status{
    margin-top: 22px;
    padding: 10px 13px;
  }
  .platform-status strong{ font-size: 13px; }
  .platform-status small{ font-size: 12px; }

  .auth-heading h2{ font-size: 26px; }
  .auth-panel{ padding: 26px 18px 24px; }
  .form-group label{ font-size: 13px; }
}

/* ---------- Consentimiento legal obligatorio ---------- */
.legal-consent{
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.consent-check{
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.consent-check input{ position:absolute; opacity:0; pointer-events:none; }
.consent-check .custom-checkbox{
  width: 17px; height: 17px; flex: 0 0 17px; margin-top: 2px;
  border-radius: 5px; border: 1px solid rgba(94,154,209,.4);
  background: rgba(3,12,22,.7); transition: .2s ease;
}
.consent-check input:checked + .custom-checkbox{
  background: var(--blue); border-color: var(--blue-soft);
  box-shadow: 0 0 10px rgba(47,143,255,.3);
}
.consent-check input:checked + .custom-checkbox::after{
  content:'';
  display:block; width:5px; height:8px; margin:2px auto 0;
  border-right:2px solid #fff; border-bottom:2px solid #fff;
  transform:rotate(45deg);
}
.consent-text{
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.55;
}
.consent-text button.legal-link{
  background:none; border:none; padding:0; margin:0; font:inherit;
  color: var(--blue-soft); text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer;
}
.consent-text button.legal-link:hover{ color: var(--blue); }

.legal-error{
  display: none;
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  background: rgba(255,77,106,.1);
  color: #ff8a9c;
  border: 1px solid rgba(255,77,106,.28);
}
.legal-error.show{ display: block; }

/* ---------- Modal de documentos legales ---------- */
.legal-modal-backdrop{
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(3,7,13,.75);
  backdrop-filter: blur(4px);
}
.legal-modal-backdrop.open{ display: flex; }

.legal-modal-box{
  width: min(720px, 100%);
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: linear-gradient(160deg, rgba(10,26,44,.98), rgba(4,10,18,.99));
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 40px 100px rgba(0,0,0,.6);
  overflow: hidden;
}
.legal-modal-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.legal-modal-head h3{ font-family: var(--f-display); font-size: 18px; color: #f2f8fd; }
.legal-modal-close{
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(255,255,255,.03);
  display: grid; place-items: center; cursor: pointer; color: var(--text-soft);
}
.legal-modal-close:hover{ color: #fff; border-color: var(--border-strong); }
.legal-modal-close svg{ width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.legal-modal-body{ overflow-y: auto; padding: 20px 24px 26px; }
.legal-modal-body h1{ display:none; } /* el título ya está en el head del modal */
.legal-modal-body h2{
  font-family: var(--f-display); font-size: 16.5px; font-weight: 600;
  color: var(--blue-soft); margin: 22px 0 10px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.legal-modal-body h2:first-of-type{ border-top: none; padding-top: 0; margin-top: 0; }
.legal-modal-body p{ color: var(--text-soft); font-size: 14px; line-height: 1.7; margin-bottom: 12px; }
.legal-modal-body ul{ margin: 0 0 14px 20px; }
.legal-modal-body li{ color: var(--text-soft); font-size: 14px; line-height: 1.7; margin-bottom: 6px; }
.legal-modal-body li p{ margin-bottom: 0; }
.legal-modal-body strong{ color: var(--text); }

.legal-modal-foot{ padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.legal-modal-ok{
  padding: 9px 18px; border-radius: 8px; border: 1px solid rgba(110,180,255,.4);
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  color: #fff; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.legal-modal-ok:hover{ filter: brightness(1.08); }

@media (max-width: 500px){
  .consent-text{ font-size: 12.5px; }
  .legal-modal-body{ padding: 16px 18px 22px; }
}