/* =============================================================
   Centralized 2FA System — Shared Stylesheet
   Dark glassmorphism design, responsive
   ============================================================= */

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

/* ── CSS Variables ── */
:root {
  --bg-primary:    #0d1117;
  --bg-secondary:  #161b22;
  --bg-card:       rgba(22, 27, 34, 0.85);
  --border:        rgba(48, 54, 61, 0.8);
  --border-glow:   rgba(88, 166, 255, 0.35);
  --accent:        #58a6ff;
  --accent-dark:   #1f6feb;
  --accent-glow:   rgba(88, 166, 255, 0.15);
  --success:       #3fb950;
  --success-bg:    rgba(63, 185, 80, 0.12);
  --danger:        #f85149;
  --danger-bg:     rgba(248, 81, 73, 0.12);
  --warning:       #d29922;
  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #484f58;
  --radius:        12px;
  --radius-lg:     20px;
  --shadow:        0 8px 32px rgba(0,0,0,0.45);
  --transition:    0.2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Background gradient ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(31,111,235,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(88,166,255,0.10) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ── Card / Glass ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  padding: 2rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow), 0 0 0 1px var(--border-glow);
}

/* ── Logo / Title ── */
.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -.02em;
}
.logo .icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.1rem;
}

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.2rem; }

label { font-size: .8rem; font-weight: 500; color: var(--text-secondary); letter-spacing: .04em; text-transform: uppercase; }

input[type="text"],
input[type="password"],
input[type="search"] {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: .95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder { color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: none;
  border-radius: var(--radius);
  padding: .75rem 1.5rem;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  box-shadow: 0 4px 15px rgba(88,166,255,0.25);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(88,166,255,0.4);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-ghost {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border-color: var(--border-glow);
}

.btn-full { width: 100%; }

/* ── Alert Boxes ── */
.alert {
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .875rem;
  font-weight: 500;
  display: none;
  animation: slideIn .2s ease;
}
.alert.show { display: flex; align-items: center; gap: .5rem; }
.alert-error   { background: var(--danger-bg);  border: 1px solid var(--danger);  color: var(--danger); }
.alert-success { background: var(--success-bg); border: 1px solid var(--success); color: var(--success); }

/* ── OTP Display ── */
.otp-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: .3em;
  color: var(--accent);
  text-align: center;
  padding: 1.5rem;
  background: var(--accent-glow);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  animation: glow 2s ease-in-out infinite alternate;
  user-select: all;
}
@keyframes glow {
  from { box-shadow: 0 0 10px rgba(88,166,255,0.2); }
  to   { box-shadow: 0 0 25px rgba(88,166,255,0.45); }
}

/* ── Countdown timer ── */
.timer-bar-wrap {
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin-top: .75rem;
}
.timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  border-radius: 999px;
  transition: width 1s linear, background-color .5s;
}
.timer-bar.urgent { background: linear-gradient(90deg, var(--danger), #ff6b6b); }
.timer-label {
  font-size: .75rem;
  color: var(--text-secondary);
  text-align: right;
  margin-top: .3rem;
}

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
thead th {
  background: rgba(255,255,255,0.04);
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid rgba(48,54,61,0.5);
  color: var(--text-primary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.025); }

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-web { background: rgba(88,166,255,.15); color: var(--accent); }
.badge-wa  { background: rgba(63,185,80,.15);  color: var(--success); }

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.navbar-right { display: flex; align-items: center; gap: .75rem; }
.user-chip {
  display: flex; align-items: center; gap: .4rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .8rem;
  font-size: .8rem;
  color: var(--text-secondary);
}
.user-chip .role-badge {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  border-radius: 999px;
  padding: .1rem .5rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* ── Section titles ── */
.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .25rem;
}
.section-sub {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

/* ── Spinner ── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: none;
}
.spinner.show { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .card { padding: 1.5rem 1rem; }
  .otp-display { font-size: 2.2rem; letter-spacing: .2em; }
  .navbar { padding: .75rem 0; }
}
