/* ═══════════════════════════════════════════════════════
   ZealMailer — Brand CSS
   Brand colors: Navy #0d1b2a · Orange #f47d20 · White #ffffff
   ═══════════════════════════════════════════════════════ */

:root {
  --color-navy:       #0d1b2a;
  --color-navy-light: #162436;
  --color-navy-mid:   #1e3048;
  --color-orange:     #f47d20;
  --color-orange-h:   #e06a10;
  --color-white:      #ffffff;
  --color-gray-50:    #f8f9fb;
  --color-gray-100:   #f1f3f6;
  --color-gray-200:   #e2e6ed;
  --color-gray-400:   #9aa3b0;
  --color-gray-600:   #5a6474;
  --color-gray-800:   #2d3748;
  --color-success:    #22c55e;
  --color-warning:    #f59e0b;
  --color-danger:     #ef4444;
  --color-info:       #3b82f6;
  --sidebar-w:        240px;
  --topbar-h:         60px;
  --radius:           8px;
  --radius-lg:        12px;
  --shadow:           0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.12);
  --transition:       0.18s ease;
}

/* ── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--color-gray-50);
  color: var(--color-gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* RTL support */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .sidebar { left: auto; right: 0; }
[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-w); }
[dir="rtl"] .ms-auto { margin-left: 0 !important; margin-right: auto !important; }
[dir="rtl"] .me-2 { margin-right: 0 !important; margin-left: 0.5rem !important; }

/* ── Typography ────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--color-navy); }
h2 { font-size: 1.4rem;  font-weight: 700; color: var(--color-navy); }
h3 { font-size: 1.15rem; font-weight: 600; color: var(--color-gray-800); }
h4 { font-size: 1rem;    font-weight: 600; }
a  { color: var(--color-orange); text-decoration: none; }
a:hover { color: var(--color-orange-h); }
p  { margin-bottom: 0.75rem; }

/* ── Layout ────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--color-navy);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo img { width: 36px; height: 36px; border-radius: 6px; }
.sidebar-logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: -0.3px;
}
.sidebar-logo-text span { color: var(--color-orange); }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  padding: 16px 20px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--color-white);
}
.nav-item.active {
  background: rgba(244,125,32,0.15);
  color: var(--color-orange);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px; bottom: 4px;
  width: 3px;
  background: var(--color-orange);
  border-radius: 0 3px 3px 0;
}
.nav-item svg, .nav-item .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 100px;
  padding: 1px 6px;
  min-width: 20px;
  text-align: center;
}
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
}
.sidebar-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--color-orange);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 0.9rem;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Main content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--color-navy); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* Page content */
.page-content { padding: 24px; flex: 1; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { margin: 0; font-size: 1.5rem; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-gray-200);
}
.card-title { font-size: 0.95rem; font-weight: 700; color: var(--color-navy); margin: 0; }
.card-body { padding: 20px; }

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 0.8rem; font-weight: 600; color: var(--color-gray-400); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--color-navy); line-height: 1; }
.stat-delta { font-size: 0.8rem; color: var(--color-success); margin-top: 4px; }
.stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(244,125,32,0.12);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-card .stat-icon svg { color: var(--color-orange); }

/* ── Tables ────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  background: var(--color-gray-50);
  color: var(--color-gray-600);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-gray-200);
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-gray-100);
  color: var(--color-gray-800);
  vertical-align: middle;
}
tbody tr:hover { background: var(--color-gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.4;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary   { background: var(--color-orange); color: #fff; }
.btn-primary:hover { background: var(--color-orange-h); color: #fff; }
.btn-secondary { background: var(--color-gray-100); color: var(--color-gray-800); }
.btn-secondary:hover { background: var(--color-gray-200); color: var(--color-gray-800); }
.btn-navy      { background: var(--color-navy); color: #fff; }
.btn-navy:hover { background: var(--color-navy-light); color: #fff; }
.btn-danger    { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-outline   { background: transparent; border: 1.5px solid var(--color-gray-200); color: var(--color-gray-800); }
.btn-outline:hover { border-color: var(--color-orange); color: var(--color-orange); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; }

/* ── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-gray-600);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--color-gray-200);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-gray-800);
  background: var(--color-white);
  transition: border-color var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--color-orange); box-shadow: 0 0 0 3px rgba(244,125,32,0.12); }
.form-control::placeholder { color: var(--color-gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.78rem; color: var(--color-gray-400); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--color-orange);
  cursor: pointer;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}
.badge-success  { background: rgba(34,197,94,0.12);  color: #15803d; }
.badge-warning  { background: rgba(245,158,11,0.12); color: #b45309; }
.badge-danger   { background: rgba(239,68,68,0.12);  color: #b91c1c; }
.badge-info     { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.badge-navy     { background: rgba(13,27,42,0.1);    color: var(--color-navy); }
.badge-orange   { background: rgba(244,125,32,0.12); color: var(--color-orange-h); }
.badge-dot::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Alerts ────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
}
.alert-success { background: rgba(34,197,94,0.1);  border-left: 3px solid var(--color-success);  color: #15803d; }
.alert-error   { background: rgba(239,68,68,0.1);  border-left: 3px solid var(--color-danger);   color: #b91c1c; }
.alert-info    { background: rgba(59,130,246,0.1); border-left: 3px solid var(--color-info);     color: #1d4ed8; }
.alert-warning { background: rgba(245,158,11,0.1); border-left: 3px solid var(--color-warning);  color: #b45309; }

/* ── Pagination ────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; }
.pagination a, .pagination span {
  padding: 5px 11px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--color-gray-200);
  color: var(--color-gray-600);
}
.pagination a:hover { border-color: var(--color-orange); color: var(--color-orange); }
.pagination .current { background: var(--color-orange); color: #fff; border-color: var(--color-orange); }

/* ── Modal ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(13,27,42,0.5);
  backdrop-filter: blur(2px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 0.2s ease;
}
@keyframes modal-in { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-gray-200);
}
.modal-title { font-weight: 700; font-size: 1rem; color: var(--color-navy); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--color-gray-400); font-size: 1.4rem; line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--color-gray-200); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Warmup Score Gauge ────────────────────────────────── */
.warmup-score-ring {
  position: relative;
  width: 100px; height: 100px;
  display: flex; align-items: center; justify-content: center;
}
.warmup-score-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.warmup-score-value { font-size: 1.6rem; font-weight: 800; color: var(--color-navy); z-index: 1; }

/* ── Progress bar ──────────────────────────────────────── */
.progress { height: 8px; background: var(--color-gray-100); border-radius: 100px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--color-orange); border-radius: 100px; transition: width 0.5s ease; }
.progress-bar.success { background: var(--color-success); }
.progress-bar.danger  { background: var(--color-danger); }

/* ── Tabs ──────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--color-gray-200); margin-bottom: 20px; gap: 0; }
.tab-item {
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-gray-400);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.tab-item:hover { color: var(--color-navy); }
.tab-item.active { color: var(--color-orange); border-bottom-color: var(--color-orange); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Auth pages ────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-mid) 100%);
  padding: 24px;
}
.auth-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 420px;
  padding: 40px;
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-logo img { width: 44px; height: 44px; }
.auth-logo-text { font-size: 1.4rem; font-weight: 800; color: var(--color-navy); }
.auth-logo-text span { color: var(--color-orange); }
.auth-title { font-size: 1.3rem; font-weight: 700; color: var(--color-navy); margin-bottom: 4px; }
.auth-subtitle { font-size: 0.875rem; color: var(--color-gray-400); margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--color-gray-400); }

/* ── Code / pre ────────────────────────────────────────── */
code, pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
}
.code-block {
  background: var(--color-navy);
  color: rgba(255,255,255,0.85);
  border-radius: var(--radius);
  padding: 12px 16px;
  overflow-x: auto;
}

/* ── Dropdown ──────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 300;
  display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 0.875rem;
  color: var(--color-gray-800);
  cursor: pointer;
  transition: var(--transition);
}
.dropdown-item:hover { background: var(--color-gray-50); color: var(--color-navy); }
.dropdown-item.danger { color: var(--color-danger); }
.dropdown-divider { height: 1px; background: var(--color-gray-100); margin: 4px 0; }

/* ── Toast notifications ───────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  pointer-events: all;
  animation: toast-in 0.3s ease;
  border-left: 3px solid var(--color-orange);
  min-width: 260px;
  max-width: 380px;
}
@keyframes toast-in { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.success { border-left-color: var(--color-success); }
.toast.error   { border-left-color: var(--color-danger); }

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state svg { width: 64px; height: 64px; color: var(--color-gray-200); margin-bottom: 16px; }
.empty-state h3 { color: var(--color-gray-600); font-weight: 600; margin-bottom: 6px; }
.empty-state p  { color: var(--color-gray-400); font-size: 0.875rem; }

/* ── Utilities ─────────────────────────────────────────── */
.flex        { display: flex; }
.items-center{ align-items: center; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.gap-4       { gap: 16px; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-2  { margin-bottom: 8px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.ms-auto { margin-left: auto; }
.me-2  { margin-right: 8px; }
.text-sm    { font-size: 0.85rem; }
.text-xs    { font-size: 0.75rem; }
.text-muted { color: var(--color-gray-400); }
.text-navy  { color: var(--color-navy); }
.text-orange{ color: var(--color-orange); }
.text-right { text-align: right; }
.text-center{ text-align: center; }
.font-bold  { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full     { width: 100%; }
.rounded    { border-radius: var(--radius); }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
}
.divider { height: 1px; background: var(--color-gray-200); margin: 16px 0; }
.inline-flex { display: inline-flex; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.overflow-hidden { overflow: hidden; }
.opacity-60 { opacity: 0.6; }
