/* =============================================
   RUTGON – dashboard.css
   Dashboard page styles — dark navy + purple/blue accent
   Matches landing & login design system
   ============================================= */

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

/* ---------- VARIABLES ---------- */
:root {
  --bg-base:       #080d17;
  --bg-surface:    #0d1526;
  --bg-card:       #111a2e;
  --bg-card-hover: #162035;
  --bg-sidebar:    #0d1526;
  --bg-input:      #192233;
  --border:        rgba(99, 120, 255, 0.15);
  --border-hover:  rgba(99, 120, 255, 0.40);

  --accent-1:      #6366f1;
  --accent-2:      #8b5cf6;
  --accent-3:      #06b6d4;
  --accent-green:  #10b981;
  --accent-orange: #f59e0b;

  --text-primary:  #f1f5ff;
  --text-secondary:#94a3b8;
  --text-muted:    #4a5568;

  --gradient-main:   linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-button: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --gradient-pro:    linear-gradient(135deg, #135bec 0%, #1d4ed8 60%, #6366f1 100%);

  --icon-logo:     linear-gradient(135deg, #fbbf24, #f59e0b);

  --font:        'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur:         0.25s;

  --sidebar-w:   256px;
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  --bg-base:       #f5f7ff;
  --bg-surface:    #eef1fb;
  --bg-card:       #ffffff;
  --bg-card-hover: #f0f4ff;
  --bg-sidebar:    #ffffff;
  --bg-input:      #f0f4ff;
  --border:        rgba(99, 102, 241, 0.15);
  --border-hover:  rgba(99, 102, 241, 0.40);

  --accent-1:      #5253cc;
  --accent-2:      #7c3aed;
  --accent-3:      #0891b2;
  --accent-green:  #059669;
  --accent-orange: #d97706;

  --text-primary:  #0f172a;
  --text-secondary:#475569;
  --text-muted:    #94a3b8;

  --gradient-main:   linear-gradient(135deg, #5253cc, #7c3aed);
  --gradient-button: linear-gradient(135deg, #5253cc 0%, #7c3aed 50%, #0891b2 100%);
  --gradient-pro:    linear-gradient(135deg, #135bec 0%, #1d4ed8 60%, #5253cc 100%);
}

/* ---------- GLOBAL TRANSITIONS ---------- */
*, *::before, *::after {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 0.25s;
  transition-timing-function: var(--ease);
}
.no-transition, .no-transition * { transition: none !important; }

/* ---------- BASE ---------- */
html { scroll-behavior: smooth; height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overflow: hidden;
}

/* ==========================================
   LAYOUT
   ========================================== */
.db-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.db-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  transition: transform var(--dur) var(--ease);
}

/* Sidebar – Brand */
.db-sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.db-logo-icon {
  font-size: 20px;
  background: var(--icon-logo);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.4));
  display: inline-flex;
}

.db-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.db-logo-text span { color: var(--accent-1); }

/* Sidebar – Nav */
.db-sidebar-nav {
  padding: 20px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.db-nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 12px 6px;
}

.db-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--dur) var(--ease);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.db-nav-link i {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.db-nav-link:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
}

.db-nav-link.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-1);
  font-weight: 600;
}

.db-nav-link.active i { color: var(--accent-1); }

/* Sidebar – New Link btn */
.db-sidebar-cta {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.db-btn-new-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--gradient-button);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  transition: all var(--dur) var(--ease);
}

.db-btn-new-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(99,102,241,0.55);
}

/* Sidebar – User profile */
.db-sidebar-user {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-main);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.db-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.db-user-info { flex: 1; min-width: 0; }

.db-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 15px;
  transition: all var(--dur);
  flex-shrink: 0;
}

.db-logout-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }

/* ==========================================
   MAIN CONTENT
   ========================================== */
.db-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ---------- TOP BAR (Mobile) ---------- */
.db-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.db-topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.db-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.db-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--dur);
}

.db-icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

/* ---------- SCROLL AREA ---------- */
.db-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px;
}

.db-scroll::-webkit-scrollbar { width: 6px; }
.db-scroll::-webkit-scrollbar-track { background: transparent; }
.db-scroll::-webkit-scrollbar-thumb {
  background: rgba(99,102,241,0.2);
  border-radius: 99px;
}
.db-scroll::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.4); }

/* ---------- PAGE HEADER ---------- */
.db-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.db-page-title {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.db-page-subtitle { font-size: 14px; color: var(--text-secondary); }

.db-date-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
}

/* ==========================================
   STAT CARDS
   ========================================== */
.db-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.db-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: border-color var(--dur), transform var(--dur), box-shadow var(--dur);
  position: relative;
  overflow: hidden;
}

.db-stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(99,102,241,0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--dur);
}

.db-stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.12);
}

.db-stat-card:hover::before { opacity: 1; }

.db-stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

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

.db-stat-icon--blue   { background: rgba(99,102,241,0.15); color: var(--accent-1); }
.db-stat-icon--violet { background: rgba(139,92,246,0.15); color: var(--accent-2); }
.db-stat-icon--cyan   { background: rgba(6,182,212,0.15);  color: var(--accent-3); }
.db-stat-icon--green  { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.db-stat-icon--orange { background: rgba(245,158,11,0.15); color: var(--accent-orange); }

.db-stat-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.db-stat-badge--up   { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.db-stat-badge--down { background: rgba(239,68,68,0.12);  color: #ef4444; }

.db-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
}

.db-stat-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1;
}

/* Sparkline SVG */
.db-sparkline {
  display: block;
  overflow: visible;
  margin-top: 14px;
}

/* ==========================================
   MAIN GRID: 2-col layout
   ========================================== */
.db-content-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

/* ==========================================
   CARD (generic)
   ========================================== */
.db-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color var(--dur), box-shadow var(--dur);
}

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

.db-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.db-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================
   URL TABLE
   ========================================== */
.db-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--dur);
}

.db-select:focus { border-color: var(--accent-1); color: var(--text-primary); }

.db-table-wrapper { overflow-x: auto; }

.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.db-table thead tr {
  background: rgba(99,102,241,0.05);
}

.db-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.db-table th.center, .db-table td.center { text-align: center; }
.db-table th.right,  .db-table td.right  { text-align: right; }

.db-table tbody tr {
  border-top: 1px solid var(--border);
  transition: background var(--dur);
}

.db-table tbody tr:hover { background: rgba(99,102,241,0.04); }

.db-table td {
  padding: 12px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.db-link-rank {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

.db-link-rank--top { background: rgba(99,102,241,0.15); color: var(--accent-1); }
.db-link-rank--normal { background: var(--bg-surface); color: var(--text-muted); }

.db-link-info { display: flex; align-items: center; gap: 10px; }

.db-link-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-link-orig {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-short-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99,102,241,0.08);
  color: var(--accent-1);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--dur);
  white-space: nowrap;
}

.db-short-link:hover {
  background: rgba(99,102,241,0.18);
  border-color: rgba(99,102,241,0.4);
}

.db-clicks-val {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 14px;
}

.db-table-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--dur);
}

.db-table-action-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Table Pagination */
.db-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.db-page-btns { display: flex; align-items: center; gap: 4px; }

.db-page-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur);
}

.db-page-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.db-page-btn.active { background: var(--gradient-button); color: #fff; cursor: default; }
.db-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ==========================================
   RIGHT COLUMN
   ========================================== */
.db-right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Performance chart */
.db-chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 140px;
  gap: 6px;
  padding: 0 4px;
  margin-top: 6px;
}

.db-chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.db-chart-bar-wrap:hover .db-bar-tooltip { opacity: 1; transform: translateY(-4px); }

.db-bar-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.15s var(--ease);
  margin-bottom: 4px;
}

.db-chart-bar {
  width: 100%;
  border-radius: 5px 5px 0 0;
  transition: all var(--dur) var(--ease);
  background: var(--gradient-main);
  opacity: 0.75;
}

.db-chart-bar:hover { opacity: 1; }
.db-chart-bar.peak  { opacity: 1; box-shadow: 0 0 16px rgba(99,102,241,0.4); }

.db-chart-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 8px;
}

.db-chart-labels {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px 0;
}

/* Pro upgrade card */
.db-pro-card {
  background: var(--gradient-pro);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.db-pro-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  pointer-events: none;
}

.db-pro-card::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}

.db-pro-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.db-pro-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.db-pro-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.db-pro-btn {
  width: 100%;
  padding: 11px;
  background: rgba(255,255,255,0.95);
  color: #135bec;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--dur);
  position: relative;
  z-index: 1;
}

.db-pro-btn:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* ==========================================
   MOBILE SIDEBAR OVERLAY (drawer)
   ========================================== */
.db-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(4px);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1200px) {
  .db-content-grid { grid-template-columns: 1fr 280px; }
}

@media (max-width: 1024px) {
  .db-sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 40px rgba(0,0,0,0.3);
  }

  .db-sidebar.open { transform: translateX(0); }
  .db-sidebar-overlay.show { display: block; }

  .db-topbar { display: flex; }

  .db-content-grid { grid-template-columns: 1fr; }
  .db-right-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}

@media (max-width: 768px) {
  .db-scroll { padding: 20px 16px; }
  .db-stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .db-right-col { grid-template-columns: 1fr; }
  .db-stat-value { font-size: 24px; }
}

@media (max-width: 480px) {
  .db-page-header { flex-direction: column; align-items: flex-start; }
  .db-date-badge { align-self: flex-start; }
}

/* ==========================================
   LIGHT THEME OVERRIDES
   ========================================== */
[data-theme="light"] .db-sidebar {
  box-shadow: 1px 0 0 var(--border);
}

[data-theme="light"] .db-stat-card::before {
  background: radial-gradient(ellipse at top left, rgba(82,83,204,0.05) 0%, transparent 60%);
}

[data-theme="light"] .db-chart-bar { box-shadow: none; }
[data-theme="light"] .db-chart-bar.peak { box-shadow: 0 0 12px rgba(82,83,204,0.25); }
