/* ============================================================
   LOGIN — style.css
   Mobile-first, grid-based. No absolute-position hacks.
   ============================================================ */

/* ── CSS Variables ───────────────────────────────────────── */
:root {
  --brand-from:   #4099ff;
  --brand-to:     #2ed8b6;
  --brand-grad:   linear-gradient(135deg, var(--brand-from) 0%, var(--brand-to) 100%);

  --bg:           #f4f6fb;
  --surface:      #ffffff;
  --border:       #e4e8f0;
  --text-primary: #1a1f36;
  --text-muted:   #6b7280;
  --text-light:   #9ca3af;

  --danger-bg:    #fff1f2;
  --danger-border:#fecdd3;
  --danger-text:  #be123c;

  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    24px;
  --radius-xl:    32px;

  --shadow-card:  0 4px 24px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --shadow-btn:   0 4px 14px rgba(64,153,255,.35);

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --transition:   0.2s ease;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────── */
.login-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

@media (min-width: 900px) {
  .login-layout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1200px) {
  .login-layout {
    grid-template-columns: 5fr 4fr;
  }
}

/* ── Brand / Left Panel ──────────────────────────────────── */
.login-brand {
  display: none; /* hidden on mobile */
  position: relative;
  overflow: hidden;
  background: var(--brand-grad);
}

@media (min-width: 900px) {
  .login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Noise texture overlay */
.brand-noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

/* Decorative blobs */
.login-brand::before,
.login-brand::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
}
.login-brand::before {
  width: 420px; height: 420px;
  top: -100px; left: -80px;
}
.login-brand::after {
  width: 300px; height: 300px;
  bottom: -60px; right: -60px;
}

.brand-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 2.5rem;
  gap: 1.5rem;
  color: #fff;
}

.brand-logo-wrap {
  width: 88px; height: 88px;
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(255,255,255,.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.brand-name {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 400;
  color: #fff;
  line-height: 1.1;
}

.brand-desc {
  font-size: .95rem;
  color: rgba(255,255,255,.8);
  max-width: 320px;
  line-height: 1.6;
}

.brand-illustration {
  width: 100%;
  max-width: 340px;
  margin-top: .5rem;
}

.brand-illustration img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,.15));
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

.brand-dots {
  display: flex;
  gap: .5rem;
  margin-top: .5rem;
}
.brand-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
}
.brand-dots span:first-child { background: rgba(255,255,255,.9); }

/* ── Form Side / Right Panel ─────────────────────────────── */
.login-form-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  gap: 1.5rem;
  background: var(--bg);
  min-height: 100vh;
}

@media (min-width: 600px) {
  .login-form-side {
    padding: 3rem 2rem;
  }
}

/* ── Card ────────────────────────────────────────────────── */
.form-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 480px) {
  .form-card { padding: 2.75rem 2.5rem; }
}

/* ── Form Header ─────────────────────────────────────────── */
.form-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
}

.form-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, rgba(64,153,255,.15), rgba(46,216,182,.15));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-from);
  font-size: 1.2rem;
  margin-bottom: .25rem;
}

.form-header h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.15;
}

.form-header p {
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Alert ───────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .875rem 1rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
  line-height: 1.5;
}

.alert i {
  flex-shrink: 0;
  margin-top: .1rem;
  font-size: 1rem;
}

.alert > div {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

/* ── Form ────────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

/* ── Field ───────────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: .02em;
  text-transform: uppercase;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.forgot-link {
  font-size: .82rem;
  font-weight: 500;
  color: var(--brand-from);
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  transition: opacity var(--transition);
}
.forgot-link:hover { opacity: .75; }

/* ── Input ───────────────────────────────────────────────── */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-light);
  font-size: .95rem;
  pointer-events: none;
  transition: color var(--transition);
  z-index: 1;
}

.input-wrap input {
  width: 100%;
  height: 52px;
  padding: 0 3rem 0 2.75rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.input-wrap input::placeholder { color: var(--text-light); font-weight: 400; }

.input-wrap input:focus {
  background: var(--surface);
  border-color: var(--brand-from);
  box-shadow: 0 0 0 3px rgba(64,153,255,.12);
}

.input-wrap input:focus + .input-icon,
.input-wrap:focus-within .input-icon {
  color: var(--brand-from);
}

/* Fix icon order (icon is before input in DOM, CSS trick to make focus work) */
.input-icon { order: -1; }
.input-wrap { flex-direction: row; }
/* Actually icon is first child, input second — keep DOM order, use absolute */

/* ── Password Toggle ─────────────────────────────────────── */
.toggle-password {
  position: absolute;
  right: .75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  font-size: .95rem;
}

.toggle-password:hover {
  color: var(--brand-from);
  background: rgba(64,153,255,.08);
}

/* ── Primary Button ──────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  height: 52px;
  margin-top: .25rem;
  background: var(--brand-grad);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-btn);
  outline: none;
}

.btn-primary:hover  { opacity: .9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(64,153,255,.4); }
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-btn); }
.btn-primary:focus-visible {
  box-shadow: 0 0 0 3px rgba(64,153,255,.4);
}

.btn-primary i { font-size: .85rem; transition: transform var(--transition); }
.btn-primary:hover i { transform: translateX(3px); }

/* ── Footnote links ──────────────────────────────────────── */
.form-footnote {
  text-align: center;
  font-size: .875rem;
  color: var(--text-muted);
}

.form-footnote a {
  color: var(--brand-from);
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--transition);
}

.form-footnote a:hover { opacity: .75; }

/* ── Layout footnote ─────────────────────────────────────── */
.layout-footnote {
  font-size: .8rem;
  color: var(--text-light);
  text-align: center;
}

/* ── Mobile-only: mini brand header ─────────────────────── */
@media (max-width: 899px) {
  .login-form-side {
    padding-top: 1.5rem;
  }

  /* Show a compact top-bar on mobile */
  .login-form-side::before {
    content: '';
    display: block;
    width: 100%;
    max-width: 420px;
    height: 4px;
    background: var(--brand-grad);
    border-radius: 4px;
    margin-bottom: .5rem;
  }
}

/* ── Focus-visible only (accessibility) ──────────────────── */
:focus:not(:focus-visible) { outline: none; box-shadow: none; }