/* ========================================
   PDS WhatsApp Leads Admin Panel Styles
   Green Primary Theme | Light/Dark Mode
   ======================================== */

/* === Bootstrap overrides === */
:root,
[data-bs-theme] {
  --bs-primary: #16a34a;
  --bs-primary-rgb: 22,163,74;
  --bs-success: #16a34a;
  --bs-success-rgb: 22,163,74;
  --bs-info: #0891b2;
  --bs-info-rgb: 8,145,178;
  --bs-warning: #f59e0b;
  --bs-warning-rgb: 245,158,11;
  --bs-danger: #dc2626;
  --bs-danger-rgb: 220,38,38;
  --bs-link-color: #16a34a;
  --bs-link-color-rgb: 22,163,74;
  --bs-link-hover-color: #15803d;
  --bs-link-hover-color-rgb: 21,128,61;
}
/* ── Buttons: only primary/success get green; info/warning/danger keep Bootstrap defaults ── */
.btn-primary {
  --bs-btn-bg: #16a34a; --bs-btn-border-color: #16a34a;
  --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d;
  --bs-btn-active-bg: #166534; --bs-btn-active-border-color: #166534;
  color: #fff;
}
.btn-outline-primary {
  --bs-btn-color: #16a34a; --bs-btn-border-color: #16a34a;
  --bs-btn-hover-bg: #16a34a; --bs-btn-hover-border-color: #16a34a;
  --bs-btn-hover-color: #fff;
}
.btn-success {
  --bs-btn-bg: #16a34a; --bs-btn-border-color: #16a34a;
  --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d;
  color: #fff;
}
.btn-outline-success {
  --bs-btn-color: #16a34a; --bs-btn-border-color: #16a34a;
  --bs-btn-hover-bg: #16a34a; --bs-btn-border-color: #16a34a;
  --bs-btn-hover-color: #fff;
}

/* Keep primary/success text green; restore info/warning/danger to proper colors */
.text-primary   { color: #16a34a !important; }
.text-success   { color: #16a34a !important; }
.text-info      { color: #0891b2 !important; }
.text-warning   { color: #d97706 !important; }
.text-danger    { color: #dc2626 !important; }
.text-muted     { color: #6b7280 !important; }

.bg-primary     { background-color: #16a34a !important; color: #fff !important; }
.bg-success     { background-color: #16a34a !important; color: #fff !important; }
.bg-info        { background-color: #0891b2 !important; color: #fff !important; }
.bg-warning     { background-color: #f59e0b !important; color: #1f2937 !important; }
.bg-danger      { background-color: #dc2626 !important; color: #fff !important; }
.bg-secondary   { background-color: #6b7280 !important; color: #fff !important; }

/* Badges: proper semantic colors */
.badge.bg-info      { background-color: #0891b2 !important; }
.badge.bg-warning   { background-color: #f59e0b !important; color: #1f2937 !important; }
.badge.bg-danger    { background-color: #dc2626 !important; }
.badge.bg-secondary { background-color: #6b7280 !important; }

/* Dark mode adjustments */
[data-theme="dark"] .text-primary  { color: #4ade80 !important; }
[data-theme="dark"] .text-info     { color: #38bdf8 !important; }
[data-theme="dark"] .text-warning  { color: #fbbf24 !important; }
[data-theme="dark"] .text-danger   { color: #f87171 !important; }
[data-theme="dark"] .btn-primary {
  --bs-btn-bg: #22c55e; --bs-btn-border-color: #22c55e;
  --bs-btn-hover-bg: #4ade80; --bs-btn-hover-border-color: #4ade80;
  color: #000;
}
[data-theme="dark"] .bg-primary { background-color: #16a34a !important; }

/* ==========================================
   Admin CSS Variables
   ========================================== */
:root {
  --admin-primary:   #16a34a;
  --admin-primary-dark: #15803d;
  --admin-primary-deep: #166534;
  --admin-accent:    #22c55e;
  --admin-success:   #16a34a;
  --admin-warning:   #f0b429;
  --admin-danger:    #e53e3e;
  --admin-info:      #0ea5e9;
  --admin-surface:   #f0fdf4;
  --admin-border:    #d1fae5;
  --admin-text:      #111827;
  --admin-glow:      rgba(22,163,74,0.12);
  --admin-glow-strong: rgba(22,163,74,0.22);
}

/* ==========================================
   Admin Layout
   ========================================== */
.admin-page { background: var(--admin-surface); min-height: 100vh; }
.admin-main-wrapper { background: var(--admin-surface); }

.admin-sidebar {
  background: linear-gradient(180deg, var(--admin-primary-deep) 0%, var(--admin-primary-dark) 100%);
  min-height: 100vh; width: 260px; position: fixed;
  padding: 1.5rem; overflow-y: auto; z-index: 1040;
  box-shadow: 4px 0 16px rgba(22,163,74,0.12);
}

.admin-sidebar-brand {
  color: #fff; font-weight: 800; font-size: 1.25rem;
  display: block; margin-bottom: 2rem; text-decoration: none;
}
.admin-sidebar-brand span { color: rgba(255,255,255,0.6); font-weight: 400; }
.admin-sidebar-brand i { color: #86efac; }

.admin-sidebar-menu { list-style: none; padding: 0; }
.admin-sidebar-menu li { margin-bottom: 0.2rem; }
.admin-sidebar-menu a {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1rem;
  border-radius: 8px; color: rgba(209,250,229,0.7); font-weight: 500;
  font-size: 0.9rem; transition: all 0.2s ease; text-decoration: none;
}
.admin-sidebar-menu a:hover,
.admin-sidebar-menu a.active {
  background: rgba(255,255,255,0.12); color: #fff;
}
.admin-sidebar-menu a.active { background: rgba(255,255,255,0.18); font-weight: 600; }
.admin-sidebar-menu i { width: 20px; text-align: center; }
.admin-sidebar-menu .section-label {
  color: rgba(255,255,255,0.4); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 1px; padding: 0.75rem 1rem 0.25rem; font-weight: 700;
}

.admin-main { margin-left: 260px; padding: 1.5rem 2rem; }

/* ==========================================
   Admin Header
   ========================================== */
.admin-header {
  background: #fff; border-radius: 12px; padding: 1rem 1.5rem; margin-bottom: 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 1px 4px rgba(22,163,74,0.08); border: 1px solid var(--admin-border);
}

/* ==========================================
   Admin Stat Cards
   ========================================== */
.admin-stat-card {
  background: #fff; border-radius: 12px; padding: 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 1px 4px rgba(22,163,74,0.08);
  border: 1px solid var(--admin-border);
  transition: all 0.3s ease;
}
.admin-stat-card:hover { box-shadow: 0 4px 16px var(--admin-glow); border-color: var(--admin-primary); }

.admin-stat-icon {
  width: 52px; height: 52px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.375rem;
}
.admin-stat-icon.green  { background: var(--admin-glow); color: var(--admin-primary); }
.admin-stat-icon.teal   { background: rgba(20,184,166,0.1); color: #0d9488; }
.admin-stat-icon.blue   { background: rgba(59,130,246,0.1); color: #3b82f6; }
.admin-stat-icon.orange { background: rgba(245,158,11,0.1); color: #d97706; }
.admin-stat-icon.red    { background: rgba(239,68,68,0.1);  color: #dc2626; }

.admin-stat-value { font-size: 1.6rem; font-weight: 800; color: var(--admin-primary-dark); line-height: 1; }
.admin-stat-label { color: #6b7280; font-size: 0.8rem; }

/* ==========================================
   Admin Cards
   ========================================== */
.admin-card {
  background: #fff; border-radius: 12px;
  box-shadow: 0 1px 4px rgba(22,163,74,0.08); overflow: hidden;
  border: 1px solid var(--admin-border);
}
.admin-card-header {
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--admin-border);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--admin-surface);
}
.admin-card-title { font-weight: 700; color: var(--admin-primary-dark); margin: 0; font-size: 1rem; }

/* ==========================================
   Admin Tables
   ========================================== */
.admin-table { margin-bottom: 0; }
.admin-table th {
  background: var(--admin-surface); font-weight: 700; color: var(--admin-primary-dark);
  border-bottom: 2px solid var(--admin-glow-strong); padding: 0.875rem 1.25rem;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px;
}
.admin-table td { padding: 1rem 1.25rem; vertical-align: middle; font-size: 0.9rem; color: var(--admin-text); }
.admin-table tr:hover { background: var(--admin-surface); }
.admin-btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; border-radius: 6px; }

/* ==========================================
   Chart Placeholders
   ========================================== */
.chart-placeholder {
  background: linear-gradient(135deg, var(--admin-surface), #dcfce7);
  border-radius: 8px; height: 250px; display: flex;
  align-items: center; justify-content: center;
  color: #9ca3af; font-weight: 600; border: 1px solid var(--admin-border);
}

/* ==========================================
   Theme Toggle (sidebar context)
   ========================================== */
.admin-sidebar .theme-toggle-btn,
.sidebar .theme-toggle-btn {
  background: none; border: 1px solid rgba(255,255,255,0.25); color: rgba(255,255,255,0.7);
  border-radius: 8px; padding: 0.5rem 0.75rem; cursor: pointer;
  font-size: 0.8rem; transition: all 0.2s ease; display: flex; align-items: center; gap: 6px;
}
.admin-sidebar .theme-toggle-btn:hover,
.sidebar .theme-toggle-btn:hover { border-color: #fff; color: #fff; }

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 991px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .admin-sidebar.show { transform: translateX(0); }
  .admin-main { margin-left: 0; padding: 1rem; }
}

/* ==========================================
   ADMIN DARK MODE
   ========================================== */
[data-theme="dark"] .admin-page,
[data-theme="dark"] .admin-main-wrapper { background: #000000 !important; }
[data-theme="dark"] .admin-main { background: #000000 !important; }

[data-theme="dark"] .admin-sidebar {
  background: linear-gradient(180deg, #000000 0%, #0a1a0a 100%) !important;
  box-shadow: 4px 0 16px rgba(0,0,0,0.5);
}
[data-theme="dark"] .admin-sidebar-menu a { color: rgba(209,250,229,0.55); }
[data-theme="dark"] .admin-sidebar-menu a:hover,
[data-theme="dark"] .admin-sidebar-menu a.active { background: rgba(74,222,128,0.12); color: #4ade80; }
[data-theme="dark"] .admin-sidebar-brand { color: #4ade80; }

[data-theme="dark"] .admin-header {
  background: #0d1a10 !important; border-color: #1a3020 !important; color: #e5e7eb;
}
[data-theme="dark"] .admin-card { background: #0d1a10 !important; border-color: #1a3020 !important; color: #e5e7eb; }
[data-theme="dark"] .admin-card-header { background: #000000 !important; border-color: #1a3020 !important; color: #d1fae5; }
[data-theme="dark"] .admin-card-title { color: #86efac; }

[data-theme="dark"] .admin-stat-card { background: #0d1a10 !important; border-color: #1a3020 !important; }
[data-theme="dark"] .admin-stat-card:hover { border-color: #22c55e !important; }
[data-theme="dark"] .admin-stat-value { color: #4ade80; }
[data-theme="dark"] .admin-stat-label { color: #9ca3af; }
[data-theme="dark"] .admin-stat-icon.green { background: rgba(74,222,128,0.1); color: #4ade80; }

[data-theme="dark"] .admin-table th { background: #000000; color: #d1fae5; border-color: #1a3020; }
[data-theme="dark"] .admin-table td { border-color: #1a3020; color: #d1d5db; }
[data-theme="dark"] .admin-table tr:hover { background: #111f14; }

[data-theme="dark"] .chart-placeholder { background: linear-gradient(135deg, #0d1a10, #000000); color: #4b5563; border-color: #1a3020; }

[data-theme="dark"] .form-control, [data-theme="dark"] .form-select {
  background: #000000; border-color: #1a3020; color: #e5e7eb;
}
[data-theme="dark"] .form-control:focus, [data-theme="dark"] .form-select:focus {
  border-color: #22c55e; box-shadow: 0 0 0 0.2rem rgba(34,197,94,0.2);
}
[data-theme="dark"] .form-label { color: #86efac; }
[data-theme="dark"] .modal-content { background: #0d1a10; border-color: #1a3020; color: #e5e7eb; }
[data-theme="dark"] .modal-header, [data-theme="dark"] .modal-footer { border-color: #1a3020; }

[data-theme="dark"] .table { color: #e5e7eb; }
[data-theme="dark"] .table th { background: #000000; color: #d1fae5; border-color: #1a3020; }
[data-theme="dark"] .table td { border-color: #1a3020; color: #d1d5db; }
[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) { background: #111f14; }

[data-theme="dark"] .list-group-item { background: #0d1a10; border-color: #1a3020; color: #e5e7eb; }
[data-theme="dark"] .badge.bg-light { background: #1a3020 !important; color: #d1fae5; }
[data-theme="dark"] .bg-light { background: #0d1a10 !important; }
[data-theme="dark"] .bg-white { background: #0d1a10 !important; }
[data-theme="dark"] .text-dark { color: #e5e7eb !important; }
[data-theme="dark"] .text-muted { color: #9ca3af !important; }
[data-theme="dark"] .border { border-color: #1a3020 !important; }
[data-theme="dark"] footer, [data-theme="dark"] .footer { background: #000000 !important; }

[data-theme="dark"] .card { background: #0d1a10 !important; border-color: #1a3020 !important; }
[data-theme="dark"] .card-header { background: #000000 !important; border-color: #1a3020 !important; }

/* ==========================================
   Sidebar aliases — admin-sidebar.php uses
   class="sidebar" (not "admin-sidebar") so
   we alias the admin-sidebar rules here.
   ========================================== */
.sidebar {
  background: linear-gradient(180deg, #166534 0%, #15803d 100%);
  min-height: 100vh;
  width: 260px;
  position: fixed;
  padding: 1.5rem;
  overflow-y: auto;
  z-index: 1040;
  box-shadow: 4px 0 16px rgba(22,163,74,0.12);
}

/* Nav links inside admin sidebar */
.sidebar .nav-link {
  color: rgba(209,250,229,0.75);
  border-radius: 8px;
  font-size: 0.9rem;
  padding: 0.65rem 1rem;
  transition: all 0.2s;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255,255,255,0.18) !important;
  color: #fff !important;
  font-weight: 600;
}

/* Dark mode aliases */
[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #000000 0%, #0a1a0a 100%) !important;
  box-shadow: 4px 0 16px rgba(0,0,0,0.5);
}
[data-theme="dark"] .sidebar .nav-link { color: rgba(209,250,229,0.55); }
[data-theme="dark"] .sidebar .nav-link:hover,
[data-theme="dark"] .sidebar .nav-link.active {
  background: rgba(74,222,128,0.12) !important;
  color: #4ade80 !important;
}
