/* ================================================
   SmartLink - Custom Styles
   Bootstrap 5.3 base + custom layer
================================================ */

:root {
  --sl-primary:    #4f46e5;
  --sl-primary-light: #818cf8;
  --sl-success:    #10b981;
  --sl-danger:     #ef4444;
  --sl-warning:    #f59e0b;
  --sl-dark:       #1e293b;
  --sl-bg:         #f8fafc;
  --sl-card-bg:    #ffffff;
  --sl-border:     #e2e8f0;
  --sl-text:       #334155;
  --sl-muted:      #64748b;
  --sl-sidebar-w:  220px;
}

/* Base */
body {
  background-color: var(--sl-bg);
  color: var(--sl-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* Typography */
.fw-700 { font-weight: 700 !important; }
.text-primary { color: var(--sl-primary) !important; }

/* Navbar */
.navbar {
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95) !important;
}
.navbar-brand {
  font-size: 1.4rem;
  letter-spacing: -.5px;
}

/* Cards */
.card {
  border: 1px solid var(--sl-border);
  border-radius: 12px;
  background: var(--sl-card-bg);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.card-body { padding: 1.5rem; }

/* Stat Cards */
.stat-card {
  border-radius: 16px;
  padding: 1.5rem;
  background: white;
  border: 1px solid var(--sl-border);
}
.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--sl-dark);
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: .8rem;
  color: var(--sl-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
}

/* Buttons */
.btn-primary {
  background: var(--sl-primary);
  border-color: var(--sl-primary);
  border-radius: 8px;
}
.btn-primary:hover {
  background: #4338ca;
  border-color: #4338ca;
}
.btn { border-radius: 8px; font-weight: 500; }

/* Forms */
.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--sl-border);
  font-size: .9rem;
  padding: .5rem .85rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--sl-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.input-group-text {
  border-color: var(--sl-border);
  background: #f8fafc;
  border-radius: 8px 0 0 8px;
}

/* Table */
.table {
  font-size: .875rem;
}
.table > :not(caption) > * > * {
  padding: .85rem 1rem;
}
.table-hover tbody tr:hover {
  background: rgba(79, 70, 229, .04);
}

/* Badges */
.badge {
  font-weight: 600;
  border-radius: 6px;
  padding: .35em .6em;
  font-size: .75rem;
}

/* Short URL display */
.short-url-badge {
  background: rgba(79,70,229,.08);
  color: var(--sl-primary);
  padding: .3rem .6rem;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  font-family: monospace;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  transition: background .15s;
}
.short-url-badge:hover { background: rgba(79,70,229,.15); }

/* Hero section */
.hero-section {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  padding: 5rem 0;
  margin: 0;
}
.hero-section h1 { color: white; }
.hero-section .lead { color: rgba(255,255,255,.85); }
.hero-section .btn-light {
  background: white;
  color: var(--sl-primary);
  border: none;
  font-weight: 600;
}

/* Auth pages */
.auth-page .card {
  box-shadow: 0 20px 60px rgba(0,0,0,.1);
  border: none;
}

/* Admin sidebar */
.admin-sidebar {
  background: var(--sl-dark) !important;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}
.admin-sidebar a {
  color: rgba(255,255,255,.7);
  padding: .55rem 1.2rem;
  border-radius: 8px;
  margin: .1rem .5rem;
  font-size: .875rem;
  transition: background .15s, color .15s;
}
.admin-sidebar a:hover,
.admin-sidebar a.active {
  background: var(--sl-primary);
  color: white;
}

/* Dashboard page layout */
.dashboard-sidebar {
  width: 220px;
  min-height: calc(100vh - 56px);
  background: white;
  border-right: 1px solid var(--sl-border);
  padding: 1rem 0;
  position: sticky;
  top: 56px;
}
.dashboard-sidebar a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1.25rem;
  border-radius: 8px;
  margin: .1rem .5rem;
  font-size: .875rem;
  color: var(--sl-text);
  text-decoration: none;
  transition: background .15s;
}
.dashboard-sidebar a:hover,
.dashboard-sidebar a.active {
  background: rgba(79,70,229,.08);
  color: var(--sl-primary);
}

/* Charts */
.chart-container {
  position: relative;
  height: 280px;
}

/* Pagination */
.pagination .page-link {
  border-radius: 8px !important;
  margin: 0 2px;
  color: var(--sl-primary);
  border-color: var(--sl-border);
}
.pagination .page-item.active .page-link {
  background: var(--sl-primary);
  border-color: var(--sl-primary);
}

/* Tabs */
.nav-tabs .nav-link {
  color: var(--sl-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: .75rem 1.25rem;
  font-weight: 500;
}
.nav-tabs .nav-link.active {
  color: var(--sl-primary);
  border-bottom-color: var(--sl-primary);
  background: none;
}
.nav-tabs { border-bottom: 1px solid var(--sl-border); }

/* Status indicators */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: .4rem;
}
.status-dot.active  { background: var(--sl-success); }
.status-dot.inactive { background: var(--sl-muted); }

/* Copy button animation */
.copy-btn.copied {
  background: var(--sl-success) !important;
  border-color: var(--sl-success) !important;
  color: white !important;
}

/* QR code container */
.qr-container {
  background: white;
  padding: 1.5rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
  display: inline-block;
  text-align: center;
}
.qr-container img { max-width: 200px; }

/* Responsive */
@media (max-width: 767px) {
  .admin-sidebar,
  .dashboard-sidebar {
    display: none;
  }
  .stat-card .stat-value { font-size: 1.5rem; }
  .hero-section { padding: 3rem 0; }
}

/* Alerts */
.alert {
  border-radius: 10px;
  border: none;
  font-size: .9rem;
}
.alert-success { background: rgba(16,185,129,.1); color: #065f46; }
.alert-danger  { background: rgba(239, 68, 68,.1); color: #991b1b; }
.alert-warning { background: rgba(245,158,11,.1);  color: #92400e; }
.alert-info    { background: rgba(14,165,233,.1);  color: #0c4a6e; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Utilities */
.rounded-xl { border-radius: 16px !important; }
.rounded-2xl { border-radius: 20px !important; }
.shadow-soft { box-shadow: 0 2px 12px rgba(0,0,0,.06) !important; }
.bg-primary-soft { background: rgba(79,70,229,.08) !important; }
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Loading spinner overlay */
.page-loader {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* Dark mode support */
[data-bs-theme="dark"] {
  --sl-bg: #0f172a;
  --sl-card-bg: #1e293b;
  --sl-border: #334155;
  --sl-text: #e2e8f0;
  --sl-muted: #94a3b8;
}
[data-bs-theme="dark"] .navbar {
  background: rgba(15,23,42,.95) !important;
  border-bottom-color: #334155;
}
[data-bs-theme="dark"] .card {
  background: #1e293b;
  border-color: #334155;
}
[data-bs-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: rgba(255,255,255,.03);
}

/* Responsive & Table Enhancements */
.table-responsive::-webkit-scrollbar {
  height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

@media (max-width: 768px) {
  .stat-card {
    padding: 1rem;
  }
  .stat-card .stat-value {
    font-size: 1.5rem;
  }
  .stat-card .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
  }
}
