/* ==========================================================================
   IPS Login – login.css
   1. Tokens  2. Base  3. Layout  4. Brand panel  5. Form panel  6. States
   7. Responsive
   ========================================================================== */

/* 1. TOKENS */
:root {
  --navy-900: #0B1F4D;
  --navy-700: #12366F;
  --blue-600: #174A8B;
  --gold: #F5B21B;
  --gold-hover: #E3A00A;
  --white: #FFFFFF;
  --bg: #F4F7FC;

  --text: #0B1F4D;
  --text-muted: #5A6785;
  --border: #D6DDEB;
  --danger: #C62839;
  --danger-bg: #FDEEF0;
  --success: #17794A;
  --success-bg: #E8F6EE;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(11, 31, 77, .06);
  --shadow-focus: 0 0 0 4px rgba(23, 74, 139, .16);
  --font: "Inter", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* 2. BASE */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a { color: inherit; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--gold); color: var(--navy-900);
  padding: .5rem 1rem; border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* 3. LAYOUT */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* 4. BRAND PANEL */
.brand {
  position: relative;
  overflow: hidden;
  color: var(--white);
  background:
    radial-gradient(900px 500px at 110% -10%, rgba(23, 74, 139, .75), transparent 60%),
    linear-gradient(155deg, var(--navy-900) 0%, var(--navy-700) 100%);
}
/* Decorative elements: a soft ring and a gold arc */
.brand::before, .brand::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
}
.brand::before {
  width: 520px; height: 520px; right: -200px; bottom: -180px;
  border: 1px solid rgba(255, 255, 255, .10);
  box-shadow: 0 0 0 70px rgba(255, 255, 255, .025), 0 0 0 140px rgba(255, 255, 255, .02);
}
.brand::after {
  width: 220px; height: 220px; left: -110px; top: 38%;
  border: 2px solid rgba(245, 178, 27, .35);
  border-right-color: transparent; border-bottom-color: transparent;
}
.brand__inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 2.5rem;
  min-height: 100%;
  padding: clamp(2rem, 4vw, 3.5rem);
  max-width: 640px; margin-inline: auto;
}

.logo { display: flex; align-items: center; gap: .85rem; }
.logo__mark { width: 64px; height: 64px; flex: none; object-fit: contain; }
.logo__name { display: block; font-size: 1.35rem; font-weight: 800; letter-spacing: .04em; line-height: 1.1; }
.logo__full { display: block; font-size: .72rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .72); }

.brand__headline {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1.08; font-weight: 800; letter-spacing: -.02em;
  color: var(--white);
  margin-bottom: 1.25rem;
}
.brand__text { max-width: 46ch; font-size: 1.05rem; color: rgba(255, 255, 255, .8); }

.features { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; margin-top: 2.25rem; }
.feature {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem .9rem;
  font-size: .92rem; font-weight: 500;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius);
}
.feature__icon {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(245, 178, 27, .16); color: var(--gold);
}
.feature__icon svg { width: 20px; height: 20px; }

.slogan { color: var(--gold); font-weight: 600; margin-bottom: .6rem; }
.copyright { font-size: .78rem; color: rgba(255, 255, 255, .5); }

/* 5. FORM PANEL */
.panel { display: grid; place-items: center; padding: clamp(1.5rem, 4vw, 3rem); background: var(--white); }
.panel__inner { width: 100%; max-width: 420px; }

.logo--mobile { display: none; margin-bottom: 2rem; color: var(--navy-900); }
.logo--mobile .logo__mark { width: 52px; height: 52px; }
.logo--mobile .logo__name { font-size: 1.25rem; }

.panel__title { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: .5rem; }
.panel__sub { color: var(--text-muted); margin-bottom: 1.75rem; }

.field { margin-bottom: 1.15rem; }
.field label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .45rem; }

.input { position: relative; }
.input input {
  width: 100%; height: 50px;
  padding: 0 1rem 0 2.9rem;
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
#password { padding-right: 3.2rem; }
.input input::placeholder { color: #98A2BC; }
.input input:hover { border-color: #B9C4DC; }
.input input:focus { outline: none; background: var(--white); border-color: var(--blue-600); box-shadow: var(--shadow-focus); }
.input__icon {
  position: absolute; left: 1rem; top: 50%; translate: 0 -50%;
  width: 20px; height: 20px; color: var(--text-muted); pointer-events: none;
  transition: color .15s;
}
.input:focus-within .input__icon { color: var(--blue-600); }

.input__toggle {
  position: absolute; right: .4rem; top: 50%; translate: 0 -50%;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  background: none; border: 0; border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer;
  transition: color .15s, background-color .15s;
}
.input__toggle:hover { color: var(--navy-900); background: rgba(11, 31, 77, .06); }
.input__toggle svg { width: 20px; height: 20px; }
.input__toggle .icon-eye-off { display: none; }
.input__toggle[aria-pressed="true"] .icon-eye { display: none; }
.input__toggle[aria-pressed="true"] .icon-eye-off { display: block; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.25rem 0 1.5rem; }

.check { display: inline-flex; align-items: center; gap: .6rem; font-size: .9rem; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box {
  display: grid; place-items: center;
  width: 20px; height: 20px; flex: none;
  border: 1.5px solid var(--border); border-radius: 6px; background: var(--white);
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.check__box::after {
  content: ""; width: 5px; height: 10px; margin-top: -2px;
  border: solid var(--navy-900); border-width: 0 2px 2px 0;
  rotate: 45deg; opacity: 0; transition: opacity .1s;
}
.check input:checked + .check__box { background: var(--gold); border-color: var(--gold); }
.check input:checked + .check__box::after { opacity: 1; }
.check input:focus-visible + .check__box { outline: 3px solid var(--gold); outline-offset: 2px; }

.link { font-size: .9rem; font-weight: 600; color: var(--blue-600); text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.btn {
  position: relative; width: 100%; height: 52px;
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  font: inherit; font-size: 1rem; font-weight: 700; color: var(--navy-900);
  background: var(--gold);
  border: 0; border-radius: var(--radius); cursor: pointer;
  box-shadow: 0 6px 16px rgba(245, 178, 27, .35);
  transition: background-color .15s, transform .15s, box-shadow .15s;
}
.btn:hover { background: var(--gold-hover); box-shadow: 0 8px 20px rgba(245, 178, 27, .42); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn__spinner {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(11, 31, 77, .25); border-top-color: var(--navy-900);
  animation: spin .7s linear infinite;
}

.help { margin-top: 1.5rem; font-size: .875rem; color: var(--text-muted); text-align: center; }
.secure {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: .8rem; color: var(--text-muted);
}
.secure svg { width: 16px; height: 16px; color: var(--success); }

/* 6. STATES */
.field__error { display: none; margin-top: .4rem; font-size: .82rem; font-weight: 500; color: var(--danger); }
.field.has-error .field__error { display: block; }
.field.has-error .input input { border-color: var(--danger); background: var(--danger-bg); }
.field.has-error .input input:focus { box-shadow: 0 0 0 4px rgba(198, 40, 57, .15); }

.alert {
  margin-bottom: 1.25rem; padding: .8rem 1rem;
  font-size: .9rem; font-weight: 500;
  border-radius: var(--radius); border: 1px solid transparent;
}
.alert[hidden] { display: none; }
.alert--error { color: var(--danger); background: var(--danger-bg); border-color: rgba(198, 40, 57, .25); }
.alert--success { color: var(--success); background: var(--success-bg); border-color: rgba(23, 121, 74, .25); }

.btn.is-loading { cursor: progress; pointer-events: none; }
.btn.is-loading .btn__spinner { display: block; }

@keyframes spin { to { rotate: 360deg; } }

/* 7. RESPONSIVE */
@media (max-width: 1024px) {
  .features { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .brand { display: none; }
  .panel { min-height: 100vh; min-height: 100dvh; align-items: start; padding-top: clamp(2rem, 8vw, 4rem); background: var(--bg); }
  .panel__inner { background: var(--white); padding: 1.75rem 1.5rem; border-radius: 16px; box-shadow: 0 10px 30px rgba(11, 31, 77, .08); }
  .logo--mobile { display: flex; }
}
@media (max-width: 400px) {
  .row { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .panel__title { font-size: 1.7rem; }
}
/* Inputs stay at 16px+ to prevent iOS zoom on focus */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 1.5s !important; }
}
