/* =========================================================================
   OIKOS BIENES RAÍCES · Sistema visual de las páginas públicas
   (inicio, acceso al sistema y portal de clientes)

   Reglas del sistema:
   - Un solo acento: rojo de marca. El resto son grafitos y neutros fríos.
   - Radios: contenedores 20px · tarjetas internas 14px · controles 12px · chips 8px.
   - Tipos: Urbanist (títulos, como el logo) · Manrope (texto) · JetBrains Mono (cifras).
   - Solo se anima transform / opacity / clip-path. Todo respeta reduced-motion.
   ========================================================================= */

:root {
  /* Marca */
  --rojo: #E40E16;
  --rojo-hv: #F2242C;
  --rojo-osc: #B80C12;
  --rojo-txt: #FF5A5F;          /* rojo legible como texto sobre fondo oscuro */
  --rojo-rgb: 228, 14, 22;

  /* Superficies (oscuro) */
  --s0: #09090B;                /* fondo de página */
  --s1: #0F0F12;                /* paneles */
  --s2: #16161A;                /* tarjetas */
  --s3: #1E1E23;                /* controles */
  --s4: #2A2A31;                /* hover de controles */

  /* Texto */
  --t1: #F4F4F5;
  --t2: rgba(244, 244, 245, .68);
  --t3: rgba(244, 244, 245, .46);

  /* Líneas */
  --l1: rgba(255, 255, 255, .07);
  --l2: rgba(255, 255, 255, .12);
  --l3: rgba(255, 255, 255, .2);

  /* Estados (no son acentos de marca: solo comunican estado) */
  --ok: #3FCF8E;
  --ok-bg: rgba(63, 207, 142, .12);
  --aviso: #F5B83D;
  --aviso-bg: rgba(245, 184, 61, .12);
  --error: #FF6B6B;
  --error-bg: rgba(255, 107, 107, .12);

  /* Forma */
  --r-xl: 20px;
  --r-lg: 14px;
  --r-md: 12px;
  --r-sm: 8px;

  /* Tipografía */
  --f-titulo: 'Urbanist', system-ui, sans-serif;
  --f-texto: 'Manrope', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Movimiento */
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-io: cubic-bezier(.77, 0, .175, 1);

  /* Sombras teñidas del fondo */
  --sombra-1: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 30px -18px rgba(0, 0, 0, .9);
  --sombra-2: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 30px 60px -30px rgba(0, 0, 0, .95);

  /* Capas */
  --z-nav: 20;
  --z-modal: 40;
  --z-toast: 50;
  --z-cortina: 60;
  --z-grano: 70;

  color-scheme: dark;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  min-height: 100vh; min-height: 100dvh;
  font-family: var(--f-texto);
  font-size: 16px; line-height: 1.55;
  color: var(--t1);
  background: var(--s0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: rgba(var(--rojo-rgb), .4); color: #fff; }

h1, h2, h3, h4 { font-family: var(--f-titulo); font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; text-wrap: balance; }
p { text-wrap: pretty; }
em.acento, h1 em, h2 em { font-style: normal; color: var(--rojo-txt); }

.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--rojo-txt); outline-offset: 3px; border-radius: 6px; }

.saltar {
  position: fixed; left: 16px; top: -60px; z-index: var(--z-cortina);
  padding: 10px 16px; border-radius: var(--r-md);
  background: var(--t1); color: var(--s0); font-weight: 600; text-decoration: none;
  transition: transform .2s var(--ease-out);
}
.saltar:focus { transform: translateY(76px); }

/* ── Ambiente: plano arquitectónico muy tenue + luz roja + grano ───────── */
.ambiente { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ambiente::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(70% 60% at 25% 30%, #000 10%, transparent 75%);
          mask-image: radial-gradient(70% 60% at 25% 30%, #000 10%, transparent 75%);
}
.ambiente::after {
  content: ''; position: absolute; width: 900px; height: 900px; left: -320px; top: -420px;
  background: radial-gradient(closest-side, rgba(var(--rojo-rgb), .16), transparent);
}
.grano {
  position: fixed; inset: 0; z-index: var(--z-grano); pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Marca ─────────────────────────────────────────────────────────────── */
.marca { display: inline-flex; align-items: center; text-decoration: none; border-radius: var(--r-sm); }
.marca img { height: 34px; width: auto; }
.marca:active { transform: scale(.98); }

/* ── Botones ───────────────────────────────────────────────────────────── */
.btn {
  --alto: 50px;
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--alto); padding: 0 22px;
  border: 0; border-radius: var(--r-md);
  font-family: var(--f-titulo); font-size: 15.5px; font-weight: 700; letter-spacing: .005em;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform .16s var(--ease-out), background-color .2s ease, color .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.is-cargando { pointer-events: none; opacity: .7; }
.btn i { font-size: 1.05em; transition: transform .25s var(--ease-out); }

.btn--rojo {
  background: var(--rojo); color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 14px 28px -14px rgba(var(--rojo-rgb), .85);
}
/* Brillo que cruza el botón al pasar el cursor */
.btn--rojo::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .28) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform .7s var(--ease-out);
}
.btn--linea { background: transparent; color: var(--t1); box-shadow: inset 0 0 0 1px var(--l2); }
.btn--suave { background: var(--s3); color: var(--t1); box-shadow: inset 0 0 0 1px var(--l1); }
.btn--bloque { width: 100%; }

@media (hover: hover) and (pointer: fine) {
  .btn--rojo:hover { background: var(--rojo-hv); }
  .btn--rojo:hover::after { transform: translateX(120%); }
  .btn--rojo:hover i.ir, .btn:hover i.ph-arrow-right, .btn:hover i.fa-arrow-right { transform: translateX(3px); }
  .btn--linea:hover { box-shadow: inset 0 0 0 1px var(--l3); background: rgba(255, 255, 255, .03); }
  .btn--suave:hover { background: var(--s4); }
}

.btn .giro { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: giro .7s linear infinite; }

/* ── Campos ────────────────────────────────────────────────────────────── */
.campo { display: grid; gap: 8px; }
.campo label, .campo__etq { font-size: 13.5px; font-weight: 600; color: var(--t2); }
.campo label .req { color: var(--rojo-txt); }
.campo__caja { position: relative; }
.campo__caja > i:first-child {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 18px; color: var(--t3); pointer-events: none; transition: color .2s ease;
}
.entrada {
  width: 100%; min-height: 52px;
  padding: 12px 16px 12px 46px;
  border: 0; border-radius: var(--r-md);
  background: var(--s2);
  box-shadow: inset 0 0 0 1px var(--l2);
  font-size: 16px; color: var(--t1);
  transition: box-shadow .2s ease, background-color .2s ease;
  -webkit-appearance: none; appearance: none;
}
.entrada--sin-ico { padding-left: 16px; }
select.entrada {
  padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23a1a1aa' stroke-width='1.6'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
select.entrada option { background: var(--s2); color: var(--t1); }
textarea.entrada { padding: 14px 16px; min-height: 84px; resize: vertical; line-height: 1.5; }
.entrada::placeholder { color: var(--t3); }
.entrada:hover { box-shadow: inset 0 0 0 1px var(--l3); }
.entrada:focus { outline: none; background: var(--s1); box-shadow: inset 0 0 0 1px var(--rojo), 0 0 0 4px rgba(var(--rojo-rgb), .16); }
.campo__caja:focus-within > i:first-child { color: var(--rojo-txt); }
.campo__ayuda { font-size: 12.5px; color: var(--t3); }
.campo__error { font-size: 13px; font-weight: 600; color: var(--error); min-height: 0; }
.campo.tiene-error .entrada { box-shadow: inset 0 0 0 1px var(--error); }

.ojo {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent;
  display: grid; place-items: center; cursor: pointer;
  color: var(--t3); font-size: 18px; transition: color .2s ease, background-color .2s ease;
}
.ojo:hover { color: var(--t1); background: rgba(255, 255, 255, .06); }
.ojo[aria-pressed="true"] { color: var(--rojo-txt); }

/* ── Avisos ────────────────────────────────────────────────────────────── */
.aviso {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  font-size: 14px; line-height: 1.5;
}
.aviso i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.aviso--error { background: var(--error-bg); color: #FFB4B4; box-shadow: inset 0 0 0 1px rgba(255, 107, 107, .25); animation: sacude .4s var(--ease-out); }
.aviso--ok    { background: var(--ok-bg); color: #9DEBC6; box-shadow: inset 0 0 0 1px rgba(63, 207, 142, .25); }
.aviso--info  { background: rgba(255, 255, 255, .04); color: var(--t2); box-shadow: inset 0 0 0 1px var(--l1); }
.aviso--aviso { background: var(--aviso-bg); color: #F8D58C; box-shadow: inset 0 0 0 1px rgba(245, 184, 61, .25); }

/* ── Superficie de vidrio con borde que se ilumina bajo el cursor ──────── */
.vidrio {
  --x: 50%; --y: 50%;
  position: relative; isolation: isolate;
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015)), var(--s1);
  border-radius: var(--r-xl);
  box-shadow: var(--sombra-2);
}
.vidrio::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(240px circle at var(--x) var(--y), rgba(var(--rojo-rgb), .7), transparent 65%),
    linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .05));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* En cajas con scroll el borde va como sombra interior (no se desplaza con el contenido) */
.modal__caja.vidrio::before, .modal-box.vidrio::before { display: none; }
.modal__caja.vidrio, .modal-box.vidrio { box-shadow: inset 0 0 0 1px var(--l2), var(--sombra-2); }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(5, 5, 7, .72);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  transition: opacity .22s ease, visibility 0s linear .22s;
}
.modal.open { opacity: 1; visibility: visible; transition: opacity .22s ease; }
.modal__caja {
  width: 100%; max-width: 480px; max-height: calc(100dvh - 32px); overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(12px) scale(.98); opacity: 0;
  transition: transform .3s var(--ease-out), opacity .22s ease;
}
.modal.open .modal__caja { transform: none; opacity: 1; }
.modal__cab { position: relative; padding: 24px 24px 18px; border-bottom: 1px solid var(--l1); }
.modal__cab h2 { font-size: 22px; display: flex; align-items: center; gap: 10px; }
.modal__cab h2 i { color: var(--rojo-txt); font-size: 22px; }
.modal__cab p { margin-top: 4px; font-size: 14px; color: var(--t2); }
.modal__cuerpo { padding: 20px 24px 24px; display: grid; gap: 16px; }
.cerrar {
  position: absolute; right: 16px; top: 16px;
  width: 36px; height: 36px; border: 0; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer;
  background: var(--s3); color: var(--t2); font-size: 16px;
  transition: background-color .2s ease, color .2s ease, transform .16s var(--ease-out);
}
.cerrar:hover { background: var(--s4); color: var(--t1); }
.cerrar:active { transform: scale(.94); }

/* ── Entradas escalonadas ─────────────────────────────────────────────── */
.entra { opacity: 0; transform: translateY(14px); animation: sube .7s var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 70ms + 80ms); }

@keyframes sube { to { opacity: 1; transform: none; } }
@keyframes giro { to { transform: rotate(360deg); } }
@keyframes sacude { 0%, 100% { transform: translateX(0); } 25%, 75% { transform: translateX(-5px); } 50% { transform: translateX(5px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .entra { opacity: 1; transform: none; }
}
