/* ================================================================
   TempMail — Shared Design System
   Theme: Dark, premium, purple accents
   ================================================================ */

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

/* ── CSS Variables (Dark — default) ─────────────────────────── */
:root {
  --bg-base:      #08080f;
  --bg-surface:   #0f0f1a;
  --bg-surface2:  #16162a;
  --bg-surface3:  #1e1e35;
  --border:       rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.15);

  --accent:       #7c3aed;
  --accent-light: #9f67ff;
  --accent-dim:   rgba(124, 58, 237, 0.15);
  --accent-glow:  rgba(124, 58, 237, 0.4);

  --text-primary:   #f1f0ff;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --success:      #22c55e;
  --success-dim:  rgba(34, 197, 94, 0.15);
  --error:        #ef4444;
  --error-dim:    rgba(239, 68, 68, 0.15);
  --warning:      #f59e0b;
  --warning-dim:  rgba(245, 158, 11, 0.15);

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);
  --shadow-accent: 0 0 20px rgba(124, 58, 237, 0.3);

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Light Theme ─────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-base:      #f4f3ff;
  --bg-surface:   #ffffff;
  --bg-surface2:  #eeecff;
  --bg-surface3:  #e5e2ff;
  --border:       rgba(0, 0, 0, 0.09);
  --border-hover: rgba(0, 0, 0, 0.18);

  --text-primary:   #14102b;
  --text-secondary: #4b4670;
  --text-muted:     #8b87aa;

  --accent-glow:  rgba(124, 58, 237, 0.25);
  --success-dim:  rgba(34, 197, 94, 0.12);
  --error-dim:    rgba(239, 68, 68, 0.12);
  --warning-dim:  rgba(245, 158, 11, 0.12);

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.15);
  --shadow-accent: 0 0 20px rgba(124, 58, 237, 0.15);
}
[data-theme="light"] .navbar {
  background: rgba(255,255,255,0.88);
  border-bottom-color: rgba(0,0,0,0.09);
}
[data-theme="light"] .spinner {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--accent);
}
[data-theme="light"] tbody tr:hover { background: rgba(0,0,0,0.02); }
[data-theme="light"] .hero-title {
  background: linear-gradient(135deg, #14102b 20%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ── Theme Toggle Button ─────────────────────────────────────── */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface2);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-surface3); color: var(--text-primary); border-color: var(--border-hover); }

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; font-weight: 600; }
p  { color: var(--text-secondary); }
a  { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────────────── */
.container  { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 620px;  margin: 0 auto; padding: 0 20px; }

/* ── Card ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-hover); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-surface2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-surface3); border-color: var(--border-hover); }

.btn-danger {
  background: var(--error-dim);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-success {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.btn-success:hover { background: rgba(34, 197, 94, 0.25); }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { padding: 8px; min-width: 36px; justify-content: center; }

/* ── Form Elements ─────────────────────────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input-mono { font-family: var(--font-mono); font-size: 13px; }

/* ── Badge ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-green  { background: var(--success-dim); color: var(--success); }
.badge-red    { background: var(--error-dim);   color: var(--error); }
.badge-purple { background: var(--accent-dim);  color: var(--accent-light); }
.badge-gray   { background: rgba(148,163,184,.1); color: var(--text-muted); }

/* ── Tables ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg-surface2); }
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255,255,255,0.03); }

/* ── Stat Card ─────────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--accent); box-shadow: var(--shadow-accent); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-info { min-width: 0; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Toast Notifications ───────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease, fadeOut 0.4s ease 2.6s forwards;
  pointer-events: auto;
  max-width: 320px;
}
.toast-success { background: linear-gradient(135deg, #166534, #15803d); }
.toast-error   { background: linear-gradient(135deg, #7f1d1d, #991b1b); }
.toast-info    { background: linear-gradient(135deg, #312e81, #4c1d95); }

@keyframes slideIn  { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut  { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 740px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(124,58,237,0.15);
  animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.modal-header-info { flex: 1; min-width: 0; }
.modal-title { font-size: 15px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-from  { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-body  { flex: 1; overflow-y: auto; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface2);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--error-dim); color: var(--error); border-color: transparent; }

/* iframe for email HTML content */
.email-iframe {
  width: 100%;
  border: none;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  min-height: 400px;
  background: #fff;
}

/* ── Navbar ────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 8, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-logo {
  font-size: 17px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}
.nav-link:hover { background: var(--bg-surface2); color: var(--text-primary); text-decoration: none; }
.nav-link.active { background: var(--accent-dim); color: var(--accent-light); }

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

/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-desc  { font-size: 14px; }

/* ── Animations ────────────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.93); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse   { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.animate-pulse { animation: pulse 2s ease infinite; }

/* ── Email list item ───────────────────────────────────────────── */
.email-item {
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-surface);
  position: relative;
}
.email-item:hover {
  border-color: var(--accent);
  background: var(--bg-surface2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.email-item-from    { font-size: 12px; color: var(--accent-light); font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-item-subject { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-item-preview { font-size: 12px; color: var(--text-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-item-time    { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.email-item-meta    { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }

/* ── Sidebar (admin/dashboard) ─────────────────────────────────── */
.layout-with-sidebar { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.sidebar-item:hover  { background: var(--bg-surface2); color: var(--text-primary); }
.sidebar-item.active { background: var(--accent-dim);  color: var(--accent-light); }
.sidebar-icon { font-size: 16px; width: 20px; text-align: center; }
.main-content { flex: 1; min-width: 0; padding: 28px; overflow-y: auto; }

/* ── Page sections ─────────────────────────────────────────────── */
.page-section { display: none; }
.page-section.active { display: block; }

/* ── Code block (API docs) ─────────────────────────────────────── */
.code-block {
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #c4b5fd;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.7;
}

/* ── Divider ───────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .layout-with-sidebar { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; padding: 12px; border-right: none; border-bottom: 1px solid var(--border); gap: 4px; }
  .sidebar-item { flex: 1; min-width: 80px; justify-content: center; flex-direction: column; gap: 4px; padding: 8px; font-size: 11px; }
  .sidebar-icon { font-size: 20px; }
  .main-content { padding: 16px; }
  .stat-card .stat-value { font-size: 22px; }
  .modal { max-height: 100vh; border-radius: 0; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .email-iframe { min-height: 300px; }
}
@media (max-width: 480px) {
  h1 { font-size: 1.6rem; }
  .container, .container-sm { padding: 0 14px; }
  th, td { padding: 10px 12px; }
  .btn-lg { padding: 12px 20px; font-size: 15px; }
}
