/* ══════════════════════════════════════════════════
   RYMDIX ADMIN DASHBOARD — STYLES
   ══════════════════════════════════════════════════ */

:root {
  --bg:          #0f1117;
  --bg-card:     #161b22;
  --bg-sidebar:  #0d1117;
  --bg-hover:    #1f2937;
  --border:      rgba(255,255,255,.07);
  --text:        #e5e7eb;
  --text-muted:  #6b7280;
  --text-dim:    #9ca3af;
  --lime:        #a3e635;
  --lime-dark:   #84cc16;
  --lime-muted:  rgba(163,230,53,.12);
  --red:         #ef4444;
  --yellow:      #f59e0b;
  --blue:        #3b82f6;
  --font:        'Inter', -apple-system, sans-serif;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --transition:  .25s cubic-bezier(.4,0,.2,1);
}

body.light {
  --bg:          #f0f2f5;
  --bg-card:     #ffffff;
  --bg-sidebar:  #1a1f2e;
  --bg-hover:    #f5f5f5;
  --border:      rgba(0,0,0,.08);
  --text:        #111827;
  --text-muted:  #6b7280;
  --text-dim:    #9ca3af;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); color: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ── LOGIN SCREEN ── */
.login-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 9999;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.logo-mark {
  width: 36px; height: 36px;
  background: var(--lime);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; font-weight: 900; color: #000;
  flex-shrink: 0;
}
.login-brand { font-size: 1.1rem; font-weight: 700; }
.login-sub { font-size: .75rem; color: var(--text-muted); }
.login-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 24px; letter-spacing: -.02em; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; letter-spacing: .04em; text-transform: uppercase; }
.form-group input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .9rem;
  color: var(--text);
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus {
  outline: none;
  border-color: var(--lime-dark);
  box-shadow: 0 0 0 3px rgba(163,230,53,.15);
}
.btn-login {
  width: 100%;
  background: var(--lime);
  color: #000;
  border-radius: var(--radius);
  padding: 11px;
  font-size: .9rem;
  font-weight: 700;
  margin-top: 8px;
  transition: background var(--transition), transform var(--transition);
}
.btn-login:hover { background: var(--lime-dark); transform: translateY(-1px); }
.btn-login:active { transform: none; }
.login-footer { margin-top: 24px; text-align: center; font-size: .75rem; color: var(--text-muted); }
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: .85rem; margin-bottom: 16px; }
.alert-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.25); color: #fca5a5; }
.alert-success { background: rgba(163,230,53,.12); border: 1px solid rgba(163,230,53,.25); color: var(--lime); }

/* ── DASHBOARD LAYOUT ── */
.dashboard {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1rem; font-weight: 700; color: #fff;
}
.sidebar-close { display: none; color: var(--text-muted); font-size: 1rem; }
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: .875rem; font-weight: 500;
  color: var(--text-muted);
  width: 100%; text-align: left;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--lime-muted); color: var(--lime); }
.badge {
  margin-left: auto;
  background: var(--lime);
  color: #000;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

/* ── STATUS PILLS ── */
.status-pill {
  display: inline-block;
  font-size: .68rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  text-transform: capitalize;
}
.status-pill.status-new       { background: rgba(59,130,246,.12); color: #60a5fa; }
.status-pill.status-contacted { background: rgba(245,158,11,.12); color: #fbbf24; }
.status-pill.status-closed    { background: rgba(163,230,53,.12); color: var(--lime); }

/* ── STATUS BREAKDOWN ── */
.status-breakdown {
  display: flex; gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.sb-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px;
  flex: 1; min-width: 100px;
}
.sb-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sb-dot.new       { background: #60a5fa; }
.sb-dot.contacted { background: #fbbf24; }
.sb-dot.closed    { background: var(--lime); }
.sb-count { font-size: 1.1rem; font-weight: 800; }
.sb-label { font-size: .72rem; color: var(--text-muted); font-weight: 500; margin-left: 2px; }
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.btn-logout {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: .8rem; font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover { background: rgba(239,68,68,.12); color: #fca5a5; }
.theme-toggle button {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  transition: transform var(--transition);
}
.theme-toggle button:hover { transform: scale(1.1); }

/* ── MAIN CONTENT ── */
.main-content {
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── TOPBAR ── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.menu-toggle {
  display: none;
  color: var(--text-muted);
}
.menu-toggle svg { width: 20px; height: 20px; }
.topbar-title {
  font-size: 1rem; font-weight: 600;
  flex: 1;
}
.topbar-right {
  display: flex; align-items: center; gap: 12px;
}
.live-indicator {
  display: flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 600;
  color: var(--lime);
  background: var(--lime-muted);
  padding: 4px 10px;
  border-radius: 999px;
}
.live-dot {
  width: 7px; height: 7px;
  background: var(--lime);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(.85)} }
.btn-refresh {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--transition);
}
.btn-refresh svg { width: 16px; height: 16px; color: var(--text-muted); }
.btn-refresh:hover { transform: rotate(180deg); }
.btn-refresh.spinning { animation: spin .5s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
.admin-avatar {
  width: 32px; height: 32px;
  background: var(--lime);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: #000;
}

/* ── TAB PANES ── */
.tab-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 40px;
}
.tab-pane.active { display: block; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h2 {
  font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em;
}
.last-updated {
  font-size: .75rem; color: var(--text-muted);
}
.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted);
}
.search-wrap input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px 8px 34px;
  font-size: .85rem; font-family: var(--font);
  color: var(--text); width: 240px;
}
.search-wrap input:focus { outline: none; border-color: var(--lime-dark); }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 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; align-items: flex-start; gap: 14px;
  transition: border-color var(--transition), transform var(--transition);
}
.stat-card:hover { border-color: rgba(163,230,53,.2); transform: translateY(-2px); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.visits  { background: rgba(59,130,246,.15); color: #60a5fa; }
.stat-icon.leads   { background: var(--lime-muted); color: var(--lime); }
.stat-icon.conversion { background: rgba(245,158,11,.12); color: #fbbf24; }
.stat-icon.clicks  { background: rgba(168,85,247,.12); color: #c084fc; }
.stat-val { font-size: 1.6rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; margin-bottom: 4px; }
.stat-lbl { font-size: .75rem; color: var(--text-muted); font-weight: 500; }
.stat-sub { font-size: .7rem; color: var(--lime); margin-top: 4px; font-weight: 600; }

/* ── CHARTS ── */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1.1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.chart-header { margin-bottom: 16px; }
.chart-header h3 { font-size: .9rem; font-weight: 600; }
.chart-wrap { height: 200px; position: relative; }

/* ── GENERIC CARD ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: .9rem; font-weight: 600; }
.mt-24 { margin-top: 24px; }

/* ── DATA TABLE ── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; }
.data-table th {
  padding: 11px 16px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 16px;
  font-size: .83rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.empty-row { text-align: center; color: var(--text-muted); padding: 32px !important; }
.btn-view {
  font-size: .75rem; font-weight: 600;
  color: var(--lime);
  padding: 4px 10px;
  border: 1px solid rgba(163,230,53,.25);
  border-radius: 999px;
  transition: all var(--transition);
}
.btn-view:hover { background: var(--lime-muted); }

/* ── PAGINATION ── */
.pagination {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 6px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.page-btn {
  min-width: 32px; height: 32px;
  border-radius: var(--radius);
  font-size: .8rem; font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0 8px;
  transition: all var(--transition);
}
.page-btn:hover { background: var(--bg-hover); color: var(--text); }
.page-btn.active { background: var(--lime); border-color: var(--lime); color: #000; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
  backdrop-filter: blur(4px);
}
.modal {
  width: 100%; max-width: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  color: var(--text-muted); font-size: 1rem;
  width: 28px; height: 28px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-field { display: grid; grid-template-columns: 120px 1fr; gap: 8px; align-items: start; }
.mf-label { font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; padding-top: 1px; }
.mf-val { font-size: .875rem; color: var(--text); }
.modal-message .mf-val { white-space: pre-wrap; line-height: 1.65; max-height: 200px; overflow-y: auto; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.btn-reply {
  display: inline-flex; align-items: center;
  background: var(--lime); color: #000;
  padding: 9px 20px; border-radius: var(--radius);
  font-size: .85rem; font-weight: 700;
  transition: background var(--transition), transform var(--transition);
}
.btn-reply:hover { background: var(--lime-dark); transform: translateY(-1px); }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0;
    width: 240px; z-index: 1000;
    transition: left var(--transition);
  }
  .sidebar.open { left: 0; }
  .sidebar-close { display: block; }
  .menu-toggle { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .tab-pane { padding: 20px 16px 32px; }
  .topbar { padding: 0 16px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .search-wrap input { width: 180px; }
  .modal { margin: 16px; }
}
