/* ============================================================
   Savannah Software Solutions — Marketing Hub Admin CSS
   assets/css/admin.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,400&display=swap');

:root {
  --bg-base: #0a0c0f;
  --bg-card: #111318;
  --bg-card-hover: #171b22;
  --bg-sidebar: #0d1017;
  --border: #1e2530;
  --border-light: #252d3a;

  --text-primary: #e8edf5;
  --text-secondary: #8a94a6;
  --text-muted: #4a5568;

  --green: #16a34a;
  --green-light: #22c55e;
  --green-dim: rgba(22,163,74,0.12);
  --amber: #d97706;
  --amber-light: #f59e0b;
  --amber-dim: rgba(217,119,6,0.12);
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --blue-dim: rgba(37,99,235,0.12);
  --purple: #7c3aed;
  --purple-light: #a78bfa;
  --purple-dim: rgba(124,58,237,0.12);
  --teal: #0d9488;
  --teal-light: #2dd4bf;
  --teal-dim: rgba(13,148,136,0.12);
  --red: #dc2626;
  --red-dim: rgba(220,38,38,0.12);

  --accent: #16a34a;
  --accent-glow: 0 0 20px rgba(22,163,74,0.3);

  --sidebar-width: 260px;
  --header-height: 70px;

  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

html { font-size: 15px; }

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

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--green), #0d6b35);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--accent-glow);
  flex-shrink: 0;
}

.logo-icon svg { width: 20px; height: 20px; color: white; }

.logo-text {
  display: flex; flex-direction: column;
}

.logo-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.2;
}

.logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 400;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--border);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--green-dim);
  color: var(--green-light);
  font-weight: 500;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--green);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-card);
}

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--green), #0d6b35);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.8rem; font-weight: 500; color: var(--text-primary); }
.user-role { font-size: 0.7rem; color: var(--text-muted); }

.user-logout { color: var(--text-muted); text-decoration: none; }
.user-logout:hover { color: var(--red); }

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  min-height: 100vh;
  max-width: calc(100vw - var(--sidebar-width));
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

.header-actions { display: flex; gap: 10px; align-items: center; }

/* ══════════════════════════════════════
   STATS GRID
══════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.stat-primary::before { background: linear-gradient(90deg, var(--green), transparent); }
.stat-green::before   { background: linear-gradient(90deg, var(--green-light), transparent); }
.stat-amber::before   { background: linear-gradient(90deg, var(--amber), transparent); }
.stat-blue::before    { background: linear-gradient(90deg, var(--blue-light), transparent); }
.stat-purple::before  { background: linear-gradient(90deg, var(--purple-light), transparent); }
.stat-teal::before    { background: linear-gradient(90deg, var(--teal-light), transparent); }

.stat-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

.stat-primary .stat-icon { background: var(--green-dim); color: var(--green-light); }
.stat-green .stat-icon   { background: var(--green-dim); color: var(--green-light); }
.stat-amber .stat-icon   { background: var(--amber-dim); color: var(--amber-light); }
.stat-blue .stat-icon    { background: var(--blue-dim);  color: var(--blue-light); }
.stat-purple .stat-icon  { background: var(--purple-dim); color: var(--purple-light); }
.stat-teal .stat-icon    { background: var(--teal-dim);  color: var(--teal-light); }

.stat-info { display: flex; flex-direction: column; gap: 2px; }

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.stat-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-base);
  padding: 3px 8px;
  border-radius: 20px;
  align-self: flex-start;
}

.stat-badge.new { color: var(--green-light); background: var(--green-dim); }

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 22px; }
.card-body.p-0 { padding: 0; }

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.mt-6 { margin-top: 24px; }

/* ══════════════════════════════════════
   QUICK ACTIONS
══════════════════════════════════════ */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.15s ease;
}

.quick-action:hover {
  border-color: var(--green);
  background: var(--green-dim);
}

.quick-action:hover strong { color: var(--green-light); }

.quick-action div:last-child { display: flex; flex-direction: column; gap: 1px; }
.quick-action strong { font-size: 0.85rem; color: var(--text-primary); font-weight: 500; }
.quick-action span { font-size: 0.75rem; color: var(--text-muted); }

.qa-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.qa-green  { background: var(--green-dim);  color: var(--green-light); }
.qa-blue   { background: var(--blue-dim);   color: var(--blue-light); }
.qa-amber  { background: var(--amber-dim);  color: var(--amber-light); }
.qa-purple { background: var(--purple-dim); color: var(--purple-light); }
.qa-teal   { background: var(--teal-dim);   color: var(--teal-light); }
.qa-gray   { background: var(--border);     color: var(--text-secondary); }

/* ══════════════════════════════════════
   TABLE
══════════════════════════════════════ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table tbody tr:hover td {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.table td strong { color: var(--text-primary); font-weight: 500; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
}
.empty-state a { color: var(--green-light); text-decoration: none; }

/* ══════════════════════════════════════
   BADGES
══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

.badge-sent, .badge-converted { background: var(--green-dim);  color: var(--green-light); }
.badge-sending { background: var(--blue-dim);   color: var(--blue-light); animation: pulse 2s infinite; }
.badge-scheduled { background: var(--amber-dim); color: var(--amber-light); }
.badge-draft { background: var(--border); color: var(--text-secondary); }
.badge-paused, .badge-cancelled { background: var(--red-dim); color: #f87171; }
.badge-new { background: var(--blue-dim); color: var(--blue-light); }
.badge-contacted { background: var(--teal-dim); color: var(--teal-light); }
.badge-interested { background: var(--green-dim); color: var(--green-light); }
.badge-unsubscribed, .badge-bounced { background: var(--red-dim); color: #f87171; }
.badge-cold { background: var(--border); color: var(--text-muted); }
.badge-warm { background: var(--amber-dim); color: var(--amber-light); }
.badge-hot  { background: var(--red-dim); color: #f87171; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

/* ══════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════ */
.progress-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.progress-fill-bg {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 4px;
  background: linear-gradient(90deg, var(--green), var(--green-light));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-bar span {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--green);
  color: white;
  box-shadow: 0 0 0 0 rgba(22,163,74,0.4);
}

.btn-primary:hover {
  background: var(--green-light);
  box-shadow: var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.btn-outline:hover {
  border-color: var(--green);
  color: var(--green-light);
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-sm  { padding: 6px 14px; font-size: 0.8rem; }
.btn-xs  { padding: 4px 10px; font-size: 0.75rem; }

/* ══════════════════════════════════════
   FORMS
══════════════════════════════════════ */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.1);
}

textarea { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; }

/* ══════════════════════════════════════
   ALERTS
══════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
  border: 1px solid;
}

.alert-success { background: var(--green-dim); border-color: var(--green); color: var(--green-light); }
.alert-error   { background: var(--red-dim);   border-color: var(--red);   color: #f87171; }
.alert-warning { background: var(--amber-dim); border-color: var(--amber); color: var(--amber-light); }
.alert-info    { background: var(--blue-dim);  border-color: var(--blue);  color: var(--blue-light); }

/* ══════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
}

.login-logo p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ══════════════════════════════════════
   TEMPLATE EDITOR
══════════════════════════════════════ */
.editor-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

.editor-btn {
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.1s;
}

.editor-btn:hover { background: var(--green-dim); color: var(--green-light); border-color: var(--green); }

.editor-area {
  border-radius: 0 0 var(--radius) var(--radius) !important;
  font-family: 'Courier New', monospace !important;
  font-size: 0.85rem !important;
  min-height: 300px !important;
}

/* ══════════════════════════════════════
   UPLOAD ZONE
══════════════════════════════════════ */
.upload-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--green);
  background: var(--green-dim);
}

.upload-icon { width: 48px; height: 48px; color: var(--text-muted); margin: 0 auto 14px; }
.upload-zone h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.upload-zone p { color: var(--text-muted); font-size: 0.85rem; }

/* ══════════════════════════════════════
   ANALYTICS CHART WRAPPERS
══════════════════════════════════════ */
.chart-wrapper { position: relative; }

/* ══════════════════════════════════════
   PAGINATION
══════════════════════════════════════ */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.page-link {
  padding: 6px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.83rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.page-link:hover, .page-link.active {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green-light);
}

/* ══════════════════════════════════════
   SEARCH BAR
══════════════════════════════════════ */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-bar input {
  padding-left: 38px !important;
  width: 280px;
}

/* ══════════════════════════════════════
   FILTER ROW
══════════════════════════════════════ */
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

/* ══════════════════════════════════════
   TOAST / NOTIFICATION
══════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  min-width: 200px;
  max-width: 360px;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.toast-success { background: var(--green);  color: white; }
.toast-error   { background: var(--red);    color: white; }
.toast-info    { background: var(--blue);   color: white; }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 1100px) {
  .grid-2col { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
