/* ============================================================
   Gmail Security Shield — Premium Cybersecurity Dark Theme
   Glassmorphism · Neon Accents · Smooth Animations
   ============================================================ */

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

/* ── Design Tokens ─────────────────────────────────────── */
:root {
  /* Background */
  --bg-base:       #050b14;
  --bg-deep:       #020811;
  --bg-mid:        #08112a;
  --bg-mesh:       radial-gradient(ellipse 80% 60% at 20% 10%, rgba(6,182,212,.08) 0%, transparent 60%),
                   radial-gradient(ellipse 60% 50% at 80% 90%, rgba(99,102,241,.07) 0%, transparent 60%),
                   radial-gradient(ellipse 50% 40% at 55% 50%, rgba(16,185,129,.04) 0%, transparent 60%),
                   #050b14;

  /* Glass */
  --glass:         rgba(14, 28, 55, 0.65);
  --glass-border:  rgba(6, 182, 212, 0.12);
  --glass-hover:   rgba(6, 182, 212, 0.08);
  --glass-sidebar: rgba(4, 12, 30, 0.88);

  /* Brand / Cyan */
  --brand:         #06b6d4;
  --brand-dim:     rgba(6, 182, 212, 0.15);
  --brand-glow:    0 0 24px rgba(6, 182, 212, 0.35);
  --brand-hover:   #22d3ee;

  /* Status */
  --safe:          #10b981;
  --safe-dim:      rgba(16, 185, 129, 0.15);
  --safe-glow:     0 0 20px rgba(16, 185, 129, 0.30);
  --safe-border:   rgba(16, 185, 129, 0.30);

  --warn:          #f59e0b;
  --warn-dim:      rgba(245, 158, 11, 0.15);
  --warn-glow:     0 0 20px rgba(245, 158, 11, 0.30);
  --warn-border:   rgba(245, 158, 11, 0.30);

  --danger:        #ef4444;
  --danger-dim:    rgba(239, 68, 68, 0.15);
  --danger-glow:   0 0 20px rgba(239, 68, 68, 0.30);
  --danger-border: rgba(239, 68, 68, 0.30);

  /* Ink */
  --ink:           #e2e8f0;
  --ink-muted:     #64748b;
  --ink-dim:       #94a3b8;

  /* Geometry */
  --radius:        16px;
  --radius-sm:     10px;
  --radius-xs:     6px;

  /* Shadows */
  --shadow-sm:     0 2px 8px rgba(0,0,0,.35);
  --shadow-md:     0 8px 32px rgba(0,0,0,.50);
  --shadow-lg:     0 24px 64px rgba(0,0,0,.65);

  /* Transitions */
  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
  --dur:           0.25s;
  --dur-fast:      0.15s;

  /* Typography */
  --font-display:  'Outfit', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-body:     'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', ui-monospace, monospace;
}

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

html { color-scheme: dark; }

body {
  background: var(--bg-base);
  background-image: var(--bg-mesh);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

h1, h2, h3, h4, h5 { font-family: var(--font-display); }

h2 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
h4 { font-size: 13px; font-weight: 700; letter-spacing: .02em; }

p { margin: 0; }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(6,182,212,.25);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(6,182,212,.45); }

/* ── Utility Classes ───────────────────────────────────── */
.hidden { display: none !important; }
.admin-only { display: none !important; }
body.is-admin .admin-only { display: revert !important; }
body.is-admin .admin-only.modal-feedback-actions { display: flex !important; }
body.is-admin .sidebar-card.admin-only { display: block !important; }

/* ── Auth State ────────────────────────────────────────── */
.is-logged-in .auth-panel .google-slot,
.is-logged-in .status-banner { display: none !important; }
.is-logged-in .auth-panel {
  border-color: var(--safe-border);
  background: var(--safe-dim);
}

/* ============================================================
   LAYOUT — App Shell
   ============================================================ */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 310px 1fr;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background: var(--glass-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Brand */
.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  padding-bottom: 6px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  box-shadow: 0 4px 20px rgba(6,182,212,.45), var(--brand-glow);
  flex-shrink: 0;
  animation: pulse-brand 4s ease-in-out infinite;
}

@keyframes pulse-brand {
  0%, 100% { box-shadow: 0 4px 20px rgba(6,182,212,.45); }
  50%       { box-shadow: 0 4px 28px rgba(6,182,212,.70); }
}

.brand-mark svg { width: 22px; height: 22px; color: #fff; }
.brand h1 { font-family: var(--font-display); font-size: 17px; font-weight: 800; color: #f1f5f9; }
.brand p  { font-size: 11px; color: var(--brand); margin-top: 2px; letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }

/* Sidebar Card */
.sidebar-card {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: grid;
  gap: 10px;
  transition: border-color var(--dur) var(--ease);
}
.sidebar-card:hover { border-color: rgba(6,182,212,.22); }

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.sidebar-note {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-dim);
}

/* Admin panel */
.admin-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 13px;
  border-radius: var(--radius-xs);
  background: rgba(6,182,212,.08);
  border: 1px solid rgba(6,182,212,.18);
}
.admin-stat strong {
  font-size: 22px;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--brand);
  text-shadow: var(--brand-glow);
}

/* Scan Controls */
.scan-controls { display: grid; gap: 10px; }

.input-group { display: grid; gap: 5px; }
.input-group label {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.input-group input {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  color: var(--ink);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input-group input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(6,182,212,.15);
}

/* Google slot */
.google-slot { min-height: 44px; }

/* Status banner */
.status-banner {
  margin-top: auto;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-dim);
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.06);
}

/* ============================================================
   BUTTONS
   ============================================================ */
button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-sm);
  transition: all var(--dur) var(--ease);
  outline: none;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button:not(:disabled):active { transform: scale(.97); }
button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn {
  min-height: 40px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: .01em;
}

.btn-icon { font-size: 15px; }

/* Primary — Cyan gradient */
.btn-primary {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  color: #000;
  box-shadow: 0 4px 18px rgba(6,182,212,.40);
  border: 1px solid rgba(6,182,212,.20);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #06b6d4, #22d3ee);
  box-shadow: 0 6px 24px rgba(6,182,212,.55);
}

/* Sidebar button */
.btn-sidebar {
  width: 100%;
  background: rgba(255,255,255,.06);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.10);
}
.btn-sidebar:hover:not(:disabled) {
  background: rgba(6,182,212,.10);
  border-color: rgba(6,182,212,.25);
  color: var(--brand);
}

/* Outline */
.btn-outline {
  background: rgba(255,255,255,.04);
  color: var(--brand);
  border: 1px solid rgba(6,182,212,.25);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(6,182,212,.10);
  border-color: var(--brand);
}

/* Danger */
.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,.25);
  box-shadow: var(--danger-glow);
}

/* Logout */
#logoutButton {
  width: 100%;
  margin-top: 8px;
  background: rgba(239,68,68,.08);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
#logoutButton:hover:not(:disabled) {
  background: rgba(239,68,68,.18);
  box-shadow: var(--danger-glow);
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content {
  padding: 28px 32px 48px;
  display: grid;
  gap: 22px;
  align-content: start;
  min-width: 0;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand);
}

.topbar h2 { color: #f8fafc; margin-top: 3px; }

/* User card */
.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-width: 220px;
  transition: border-color var(--dur) var(--ease);
}
.user-card:hover { border-color: rgba(6,182,212,.25); }

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-dim);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(6,182,212,.25);
  box-shadow: 0 0 12px rgba(6,182,212,.20);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-meta { display: grid; gap: 1px; min-width: 0; }
.user-meta strong { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f1f5f9; }
.user-meta span   { font-size: 11px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.role-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--brand-dim);
  color: var(--brand);
  border: 1px solid rgba(6,182,212,.25);
  flex-shrink: 0;
  text-shadow: var(--brand-glow);
}

/* ============================================================
   METRIC CARDS
   ============================================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: all var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(6,182,212,.03) 0%, transparent 60%);
  pointer-events: none;
}

.metric-card:hover {
  border-color: rgba(6,182,212,.28);
  box-shadow: var(--shadow-md), 0 0 30px rgba(6,182,212,.08);
  transform: translateY(-2px);
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: var(--brand-dim);
  border: 1px solid rgba(6,182,212,.20);
  flex-shrink: 0;
}

.metric-card span   { font-size: 12px; color: var(--ink-dim); display: block; letter-spacing: .02em; }
.metric-card strong { font-size: 36px; font-family: var(--font-display); font-weight: 800; line-height: 1.05; display: block; margin-top: 2px; color: #f1f5f9; }

.metric-threat .metric-card,
.metric-card.metric-threat { border-color: var(--danger-border); }
.metric-card.metric-threat .metric-icon { background: var(--danger-dim); border-color: var(--danger-border); }
.metric-card.metric-threat strong { color: var(--danger); text-shadow: var(--danger-glow); }
.metric-card.metric-threat:hover { box-shadow: var(--shadow-md), var(--danger-glow); }

.metric-card.metric-safe { border-color: var(--safe-border); }
.metric-card.metric-safe .metric-icon { background: var(--safe-dim); border-color: var(--safe-border); }
.metric-card.metric-safe strong { color: var(--safe); text-shadow: var(--safe-glow); }
.metric-card.metric-safe:hover { box-shadow: var(--shadow-md), var(--safe-glow); }

/* ============================================================
   PANELS & MAIN GRID
   ============================================================ */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .85fr);
  gap: 18px;
  align-items: start;
}

.side-panels { display: grid; gap: 18px; }

.panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease);
}
.panel:hover { border-color: rgba(6,182,212,.22); }

/* Cleanup panel */
.cleanup-panel {
  display: grid;
  gap: 12px;
}

.cleanup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cleanup-actions .btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.cleanup-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 2px;
}

.cleanup-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,.025);
}

.cleanup-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.cleanup-group-head label,
.cleanup-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cleanup-group-head input,
.cleanup-item input {
  accent-color: var(--brand);
  flex-shrink: 0;
}

.cleanup-group-head > span {
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 11px;
}

.cleanup-group > p {
  color: var(--ink-dim);
  font-size: 11px;
  line-height: 1.4;
}

.cleanup-items {
  display: grid;
  gap: 6px;
}

.cleanup-item {
  min-width: 0;
  cursor: pointer;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius-xs);
  background: rgba(0,0,0,.18);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.cleanup-item:hover {
  border-color: rgba(6,182,212,.22);
  background: rgba(6,182,212,.06);
}

.cleanup-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.cleanup-copy strong,
.cleanup-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cleanup-copy strong {
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
}

.cleanup-copy span,
.cleanup-date {
  color: var(--ink-dim);
  font-size: 10px;
}

.cleanup-date {
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.panel-heading h3 { color: #f1f5f9; }
.panel-meta { font-size: 11px; color: var(--ink-dim); display: block; margin-top: 3px; }

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,.30);
  padding: 3px;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,.07);
}

.filter-tab {
  min-height: 28px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 99px;
  background: transparent;
  color: var(--ink-dim);
  transition: all var(--dur-fast) var(--ease);
}
.filter-tab:hover { color: var(--ink); }
.filter-tab.active {
  background: rgba(6,182,212,.15);
  color: var(--brand);
  border: 1px solid rgba(6,182,212,.25);
  box-shadow: 0 0 12px rgba(6,182,212,.15);
}

/* ============================================================
   EMAIL LIST
   ============================================================ */
.email-list { display: grid; gap: 8px; }

.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--ink-dim);
}
.empty-state strong { display: block; color: var(--ink); margin-bottom: 6px; font-size: 15px; }

.email-row {
  border: 1px solid rgba(255,255,255,.07);
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: rgba(255,255,255,.03);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}

.email-row:hover {
  background: rgba(255,255,255,.05);
  border-color: rgba(6,182,212,.25);
  border-left-color: inherit; /* preserve threat strip */
  box-shadow: 0 4px 20px rgba(0,0,0,.30), var(--brand-glow);
  transform: translateX(2px);
}

.email-row:has(.label.phishing) {
  border-left-color: var(--danger);
}
.email-row:has(.label.phishing):hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.30), var(--danger-glow);
}

.email-row:has(.label.suspicious) {
  border-left-color: var(--warn);
}
.email-row:has(.label.suspicious):hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.30), var(--warn-glow);
}

.email-row:has(.label.safe) {
  border-left-color: var(--safe);
}
.email-row:has(.label.safe):hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.30), var(--safe-glow);
}

.email-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.email-meta strong {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
  color: #f1f5f9;
}

.email-row > p {
  font-size: 12px;
  color: var(--ink-dim);
  margin: 5px 0 0;
}

.email-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.email-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Labels ────────────────────────────────────────────── */
.label {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.label.safe       { background: var(--safe-dim);   color: var(--safe);   border: 1px solid var(--safe-border);   }
.label.suspicious { background: var(--warn-dim);   color: var(--warn);   border: 1px solid var(--warn-border);   }
.label.phishing   { background: var(--danger-dim); color: var(--danger); border: 1px solid var(--danger-border); box-shadow: var(--danger-glow); animation: pulse-danger 2s infinite; }

@keyframes pulse-danger {
  0%, 100% { opacity: 1; }
  50%       { opacity: .72; }
}

/* ── Chips ─────────────────────────────────────────────── */
.reason-chips { display: flex; flex-wrap: wrap; gap: 5px; }

.chip {
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  background: var(--warn-dim);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}
.chip.safe { background: var(--safe-dim); color: var(--safe); border-color: var(--safe-border); }

/* ── Scan Badges (VT / Gemini) ─────────────────────────── */
.scan-badges { display: flex; gap: 5px; flex-wrap: wrap; }

.scan-badge {
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.scan-badge.clean  { background: var(--safe-dim);   color: var(--safe);   border-color: var(--safe-border);   }
.scan-badge.threat { background: var(--danger-dim); color: var(--danger); border-color: var(--danger-border); animation: pulse-danger 2s infinite; }
.scan-badge.warn   { background: var(--warn-dim);   color: var(--warn);   border-color: var(--warn-border);   }

/* ============================================================
   SIDE PANELS
   ============================================================ */

/* Ranked senders */
.ranked-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}
.ranked-list li {
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  font-size: 13px;
  color: var(--ink-dim);
  overflow-wrap: anywhere;
  transition: border-color var(--dur-fast) var(--ease);
}
.ranked-list li:hover { border-color: rgba(245,158,11,.30); color: var(--ink); }

/* Security tips */
.security-tips { display: grid; gap: 10px; }

.tip-card {
  display: flex;
  gap: 11px;
  padding: 11px 13px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius-xs);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-dim);
  transition: border-color var(--dur-fast) var(--ease);
}
.tip-card:hover { border-color: rgba(6,182,212,.20); color: var(--ink); }

.tip-icon { font-size: 17px; flex-shrink: 0; margin-top: 1px; }

.tip-card code {
  background: rgba(6,182,212,.12);
  color: var(--brand);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2,8,20,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgba(8, 17, 42, 0.94);
  border: 1px solid rgba(6,182,212,.22);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg), var(--brand-glow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: modal-in .22s var(--ease);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(6,182,212,.15);
  background: rgba(6,182,212,.04);
}

.modal-header h3 { font-size: 18px; margin-top: 4px; overflow-wrap: anywhere; color: #f1f5f9; }

.icon-button {
  width: 34px;
  min-height: 34px;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: var(--ink-dim);
  font-size: 20px;
  line-height: 1;
  border: 1px solid rgba(255,255,255,.10);
  transition: all var(--dur-fast) var(--ease);
}
.icon-button:hover { background: var(--danger-dim); color: var(--danger); border-color: var(--danger-border); }

.modal-content {
  padding: 20px 22px;
  overflow-y: auto;
  display: grid;
  gap: 16px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,.07);
  background: rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.modal-main-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Detail Grid (inside modal) ─────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(6,182,212,.12);
  border-radius: var(--radius-sm);
  background: rgba(6,182,212,.04);
}

.detail-item { display: grid; gap: 3px; }
.detail-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ── Detail Sections ────────────────────────────────────── */
.detail-section {
  padding: 14px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.02);
}
.detail-section h4 {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  color: var(--ink);
}

/* VirusTotal */
.detail-section-vt { border-left: 3px solid var(--safe); }
.detail-section-vt.has-threats { border-left-color: var(--danger); background: var(--danger-dim); }

.vt-results { display: grid; gap: 5px; }
.vt-threat { color: var(--danger); font-size: 13px; font-weight: 600; }
.vt-summary { font-size: 11px; color: var(--ink-dim); margin-top: 4px; }
.vt-clean   { color: var(--safe); font-size: 13px; font-weight: 600; }

/* Gemini */
.detail-section-gemini              { border-left: 3px solid var(--safe); }
.detail-section-gemini.gemini-malicious  { border-left-color: var(--danger); background: var(--danger-dim); }
.detail-section-gemini.gemini-suspicious { border-left-color: var(--warn);   background: var(--warn-dim);   }
.detail-section-gemini.gemini-safe       { border-left-color: var(--safe);   }

.gemini-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.gemini-badge { padding: 3px 10px; border-radius: var(--radius-xs); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.gemini-badge.gemini-malicious  { background: var(--danger); color: #fff; box-shadow: var(--danger-glow); }
.gemini-badge.gemini-suspicious { background: var(--warn);   color: #000; box-shadow: var(--warn-glow);   }
.gemini-badge.gemini-safe       { background: var(--safe);   color: #fff; box-shadow: var(--safe-glow);   }

.gemini-confidence { font-size: 12px; color: var(--ink-dim); font-weight: 600; }

.gemini-reasons {
  margin: 0; padding: 0; list-style: none;
  display: grid; gap: 6px;
}
.gemini-reasons li {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  font-size: 12px;
  color: var(--ink);
}

/* Gemini risk factor row */
.factor-gemini {
  border-left: 3px solid #8b5cf6 !important;
  background: rgba(139, 92, 246, 0.08) !important;
}

/* Factor list */
.factor-list {
  margin: 0; padding: 0; list-style: none;
  display: grid; gap: 7px;
}
.factor-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  font-size: 12px;
  color: var(--ink);
}
.factor-list li strong {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--warn-dim);
  color: var(--warn);
  border: 1px solid var(--warn-border);
  font-size: 11px;
}
.factor-list li.factor-safe strong {
  background: var(--safe-dim);
  color: var(--safe);
  border-color: var(--safe-border);
}

/* Email body */
.email-body {
  margin: 0;
  padding: 12px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(0,0,0,.35);
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  max-height: 220px;
  overflow: auto;
  color: var(--ink-dim);
  line-height: 1.65;
}

/* URL list */
.url-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.url-list li {
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  font-size: 12px;
  font-family: var(--font-mono);
}
.url-list a { color: var(--brand); overflow-wrap: anywhere; text-decoration: none; }
.url-list a:hover { color: var(--brand-hover); text-decoration: underline; }

.status-text { font-size: 12px; color: var(--ink-dim); }

/* ============================================================
   PROGRESS OVERLAY
   ============================================================ */
.progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(2,8,20,.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.progress-card {
  background: rgba(8,17,42,.92);
  border: 1px solid rgba(6,182,212,.25);
  width: min(480px, 100%);
  padding: 34px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg), var(--brand-glow);
  animation: modal-in .22s var(--ease);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-header h3 {
  font-size: 20px;
  color: #f1f5f9;
}

#timeLeft {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-dim);
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid rgba(6,182,212,.25);
}

.progress-subtext {
  font-size: 13px;
  color: var(--ink-dim);
  margin-bottom: 24px;
}

.progress-bar-container {
  height: 8px;
  background: rgba(0,0,0,.40);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,.06);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0891b2, #06b6d4, #22d3ee);
  border-radius: 99px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(6,182,212,.60);
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
#progressStatus { color: var(--ink-dim); }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 360px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: rgba(8,17,42,.95);
  border: 1px solid rgba(6,182,212,.25);
  color: var(--ink);
  font-size: 13px;
  box-shadow: var(--shadow-lg), var(--brand-glow);
  z-index: 1100;
  animation: toast-in .25s var(--ease);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.toast.hidden { display: none; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--glass-border);
    flex-direction: row;
    flex-wrap: wrap;
    padding: 16px;
  }
  .brand { flex: 1 1 100%; }
  .metrics-grid { grid-template-columns: 1fr; }
  .main-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .user-card { min-width: 0; }
}

@media (max-width: 640px) {
  .content { padding: 18px 14px; }
  .email-footer { flex-direction: column; align-items: stretch; }
  .email-actions { width: 100%; }
  .email-actions .btn { flex: 1; }
  .scan-badges { margin-top: 4px; }
  .metrics-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MISC HELPERS
   ============================================================ */
.auth-panel { margin-top: 2px; }
.google-slot { min-height: 44px; }

/* Cyber animated background scanline effect */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(6, 182, 212, 0.012) 2px,
    rgba(6, 182, 212, 0.012) 4px
  );
  pointer-events: none;
  z-index: 9999;
  animation: scanline 8s linear infinite;
}

@keyframes scanline {
  0%   { background-position: 0 0; }
  100% { background-position: 0 100vh; }
}

/* ============================================================
   SERVER WAKE-UP OVERLAY  (Render free-tier cold start)
   ============================================================ */
.server-wake-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg-deep);
  background-image: var(--bg-mesh);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.6s var(--ease);
}

.server-wake-overlay.wake-hiding {
  opacity: 0;
  pointer-events: none;
}

.wake-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

/* Animated shield logo */
.wake-shield {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  display: grid;
  place-items: center;
  color: #fff;
  animation: wake-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(6,182,212,.55), 0 0 80px rgba(6,182,212,.20);
}

.wake-shield svg {
  width: 36px;
  height: 36px;
}

@keyframes wake-pulse {
  0%, 100% { box-shadow: 0 0 30px rgba(6,182,212,.45); transform: scale(1); }
  50%       { box-shadow: 0 0 60px rgba(6,182,212,.75); transform: scale(1.06); }
}

.wake-title {
  font-size: 24px;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -.02em;
  margin: 0;
}

.wake-sub {
  font-size: 15px;
  color: var(--ink-dim);
  margin: 0;
}

/* Indeterminate progress bar */
.wake-bar-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid rgba(6,182,212,.15);
}

.wake-bar {
  height: 100%;
  width: 35%;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, #06b6d4, #22d3ee, transparent);
  animation: wake-slide 1.6s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(6,182,212,.70);
}

@keyframes wake-slide {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(400%); }
}

/* Status note */
.wake-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-dim);
  background: rgba(6,182,212,.06);
  border: 1px solid rgba(6,182,212,.15);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin: 0;
}

.wake-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  flex-shrink: 0;
  animation: wake-blink 1s ease-in-out infinite;
  box-shadow: 0 0 6px var(--warn);
}

@keyframes wake-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

/* When server is ready, dot turns green */
.wake-note.wake-ready .wake-dot {
  background: var(--safe);
  box-shadow: 0 0 6px var(--safe);
  animation: none;
}

.wake-timer {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0;
}

/* ============================================================
   SERVER STATUS WIDGET (Sidebar Connection Status)
   ============================================================ */
.server-status-widget {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(14, 28, 55, 0.45);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  margin-top: 4px;
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  width: fit-content;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 8px var(--warn);
  transition: background 0.3s, box-shadow 0.3s;
}

.status-indicator-dot.online {
  background: var(--safe);
  box-shadow: 0 0 8px var(--safe);
  animation: pulse-green 2s infinite;
}

.status-indicator-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.status-indicator-text {
  color: var(--ink-dim);
  letter-spacing: 0.02em;
  transition: color 0.3s;
}

/* --- Google Sign-in Slot Styling --- */
.google-slot {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden;
  border-radius: var(--radius-xs);
}


