/* ==========================================================
   Admin Dashboard & CMS Stylesheet
   Dhruv Termite Pest Control Services
   ========================================================== */

:root {
  --admin-sidebar-w: 260px;
  --admin-topbar-h: 70px;
  --admin-bg: #0f172a;
  --admin-surface: #1e293b;
  --admin-body-bg: #f1f5f9;
  --admin-card-bg: #ffffff;
  --admin-primary: #0f4c81;
  --admin-primary-dark: #0a3359;
  --admin-accent: #10b981;
  --admin-danger: #ef4444;
  --admin-warning: #f59e0b;
  --admin-text: #0f172a;
  --admin-muted: #64748b;
  --admin-border: #e2e8f0;
}

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

body.admin-body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--admin-body-bg);
  color: var(--admin-text);
  min-height: 100vh;
  display: flex;
}

/* Admin Layout */
.admin-sidebar {
  width: var(--admin-sidebar-w);
  background: var(--admin-bg);
  color: #94a3b8;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.admin-brand {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  text-decoration: none;
}

.admin-brand h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
}

.admin-brand span {
  font-size: 11px;
  color: var(--admin-accent);
  display: block;
}

.admin-nav {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-category {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #475569;
  padding: 12px 12px 4px 12px;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
}

.admin-nav a i {
  width: 20px;
  text-align: center;
  font-size: 15px;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.admin-nav a.active {
  background: var(--admin-primary);
  color: #ffffff;
}

.admin-main {
  margin-left: var(--admin-sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  height: var(--admin-topbar-h);
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.admin-content {
  padding: 32px;
  flex: 1;
}

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--admin-muted);
}

.breadcrumb a {
  color: var(--admin-muted);
  text-decoration: none;
}

.breadcrumb span.active {
  color: var(--admin-primary);
  font-weight: 600;
}

/* Metrics Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-info h6 {
  font-size: 13px;
  color: var(--admin-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-info h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--admin-text);
}

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

.stat-blue { background: #e0f2fe; color: #0284c7; }
.stat-green { background: #dcfce7; color: #16a34a; }
.stat-amber { background: #fef3c7; color: #d97706; }
.stat-purple { background: #f3e8ff; color: #9333ea; }

/* Admin Tables */
.admin-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 28px;
  overflow: hidden;
}

.admin-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-card-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  background: #f8fafc;
  padding: 12px 20px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--admin-muted);
  text-align: left;
  border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
  padding: 14px 20px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: #f8fafc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-new { background: #dbeafe; color: #1e40af; }
.badge-contacted { background: #fef3c7; color: #92400e; }
.badge-converted { background: #dcfce7; color: #166534; }
.badge-closed { background: #f1f5f9; color: #475569; }
.badge-spam { background: #fee2e2; color: #991b1b; }
.badge-published { background: #dcfce7; color: #166534; }
.badge-draft { background: #f1f5f9; color: #475569; }

/* Action Buttons */
.action-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--admin-border);
  background: #ffffff;
  color: var(--admin-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--admin-primary);
}

.btn-icon-danger:hover {
  background: #fee2e2;
  color: var(--admin-danger);
  border-color: #fca5a5;
}

/* Media Library Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 24px;
}

.media-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.media-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.media-thumb-box {
  aspect-ratio: 4 / 3;
  background: #e2e8f0;
  overflow: hidden;
}

.media-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-info {
  padding: 10px;
}

.media-info p {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Toast Alerts */
.toast-alert {
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.toast-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.toast-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Modal Picker */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Responsive Admin */
@media (max-width: 900px) {
  .admin-sidebar {
    left: -100%;
    transition: left 0.3s ease;
  }
  .admin-sidebar.is-open {
    left: 0;
  }
  .admin-main {
    margin-left: 0;
  }
  .admin-content {
    padding: 20px;
  }
}
