/* ============================================================
   style-login.css — Stilmall för login.php
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600&family=Outfit:wght@300;400;500;600&display=swap');

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

/* ── Variabler ─────────────────────────────────────────────────────────── */
:root {
  --bg:        #0e1621;
  --bg2:       #162032;
  --bg3:       #1d2d44;
  --gold:      #c9a84c;
  --gold-dim:  #8a6e2f;
  --cream:     #f0ead8;
  --white:     #ffffff;
  --muted:     rgba(240,234,216,0.45);
  --border:    rgba(201,168,76,0.18);
  --danger:    #e07070;
  --danger-bg: rgba(224,112,112,0.12);
  --success:   #4caf82;
  --success-bg: rgba(76,175,130,0.12);
}

/* ── Bas ───────────────────────────────────────────────────────────────── */
body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--cream);
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* Subtilt rutnätstextur */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(201,168,76,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,168,76,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ── Formulär ──────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 1.4rem; }
label  { font-size: 0.85rem; font-weight: 600; color: var(--gold); text-transform: uppercase; letter-spacing: 0.1em; }
input, textarea, select {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg3);
  color: var(--cream);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  -webkit-appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

/* ── Knappar ───────────────────────────────────────────────────────────── */
.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
  font-size: 1.1rem;
  padding: 15px;
  width: 100%;
  margin-top: 0.5rem;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: var(--bg);
}
.btn-primary:hover    { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(201,168,76,0.3); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-link {
  background: none;
  color: var(--muted);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.95rem;
  margin-top: 0.8rem;
}
.btn-link:hover { color: var(--cream); }

/* ── Meddelanden ───────────────────────────────────────────────────────── */
.msg { padding: 13px 16px; border-radius: 10px; font-size: 1rem; margin-bottom: 1.4rem; border: 1px solid transparent; }
.msg.error { background: var(--danger-bg); color: var(--danger); border-color: rgba(224,112,112,0.25); }
.msg.info  { background: var(--success-bg); color: var(--success); border-color: rgba(76,175,130,0.25); }
.msg.warn  { background: rgba(201,168,76,0.1); color: var(--gold); border-color: var(--border); }

/* ── Inloggningsruta ───────────────────────────────────────────────────── */
.box {
  position: relative;
  z-index: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3.5rem 3rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 400;
  color: var(--cream);
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 2rem;
  font-weight: 300;
}

.hint {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 1.2rem;
  text-align: center;
  font-weight: 300;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

input[name="otp"],
input[name="totp_code"] {
  font-size: 2.2rem;
  letter-spacing: 0.35em;
  text-align: center;
  font-weight: 500;
}

/* ── OTP-timer ─────────────────────────────────────────────────────────── */
.otp-timer {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: .92rem; color: var(--muted); margin-top: 1rem;
  font-variant-numeric: tabular-nums;
}
.otp-timer.urgent { color: var(--danger); }

.secure-badge {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 1.2rem;
  font-size: .9rem; color: var(--gold-dim); opacity: .8;
  letter-spacing: .04em;
  width: 100%; max-width: 500px;
}

/* ── Shake-animation ───────────────────────────────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}
.box.shake { animation: shake 0.4s ease; }

/* ── Spinner ───────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(14,22,33,0.3);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
