/* ==============================================================================
   SPIRITUAL COMMERCE ADMIN - DESIGN SYSTEM
   Theme: Ivory Linen, Saffron & Gold Accents, Clean Modern Typography
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;1,600&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Primary Spiritual Colors */
  --saffron-50: #fff8f1;
  --saffron-100: #feecd9;
  --saffron-200: #fcd5b0;
  --saffron-300: #fab87d;
  --saffron-400: #f69145;
  --saffron-500: #e66a1f; /* Primary Saffron Accent */
  --saffron-600: #d95314;
  --saffron-700: #b43d12;
  
  /* Gold Accents */
  --gold-50: #fefbf2;
  --gold-100: #fcf5dd;
  --gold-400: #f4c442;
  --gold-500: #d97706;
  --gold-600: #b45309;

  /* Backgrounds */
  --bg-app: #fbf9f5; /* Warm Ivory Canvas */
  --bg-card: #ffffff;
  --bg-card-subtle: #faf8f4;
  --bg-sidebar: #ffffff;
  --border-color: #eee7de;
  --border-light: #f4eee6;

  /* Typography */
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #8c8277;
  --text-subtle: #a1968b;
  
  /* Status Colors */
  --status-green-bg: #e6f8ef;
  --status-green-text: #059669;
  --status-blue-bg: #eff6ff;
  --status-blue-text: #2563eb;
  --status-amber-bg: #fef7e6;
  --status-amber-text: #d97706;
  --status-red-bg: #fef2f2;
  --status-red-text: #dc2626;
  --status-purple-bg: #f5f3ff;
  --status-purple-text: #7c3aed;

  /* Elevation */
  --shadow-sm: 0 1px 2px 0 rgba(40, 30, 20, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(40, 30, 20, 0.04), 0 1px 2px -1px rgba(40, 30, 20, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(40, 30, 20, 0.06), 0 2px 4px -2px rgba(40, 30, 20, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(40, 30, 20, 0.08), 0 4px 6px -4px rgba(40, 30, 20, 0.04);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --sidebar-width: 250px;
  --header-height: 64px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==============================================================================
   LAYOUT
   ============================================================================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform 0.25s ease-in-out;
  overflow-y: auto;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.75rem;
  flex-shrink: 0;
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  flex: 1;
}

.sidebar-close-btn {
  display: none;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-close-btn:hover {
  background-color: var(--saffron-50);
  color: var(--saffron-600);
  border-color: var(--saffron-300);
}

.brand-icon {
  width: 32px;
  height: 32px;
  color: var(--saffron-500);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  font-size: 0.68rem;
  color: var(--saffron-600);
  font-weight: 500;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
  margin-top: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  color: var(--text-subtle);
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.nav-link:hover {
  background-color: var(--bg-card-subtle);
  color: var(--saffron-600);
}

.nav-link:hover svg {
  color: var(--saffron-500);
}

.nav-link.active {
  background-color: var(--saffron-100);
  color: var(--saffron-600);
  font-weight: 600;
}

.nav-link.active svg {
  color: var(--saffron-500);
}

/* Main Wrapper */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.25s ease-in-out;
}

/* Header */
.admin-header {
  height: var(--header-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  max-width: 540px;
  min-width: 0;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.45rem;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.mobile-menu-toggle:hover {
  background-color: var(--bg-card-subtle);
  color: var(--saffron-600);
}

/* Mobile Brand Logo in Header */
.mobile-brand-logo {
  display: none;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.mobile-logo-icon {
  width: 28px;
  height: 28px;
  color: var(--saffron-500);
  flex-shrink: 0;
}

.mobile-brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.global-search-box {
  position: relative;
  width: 100%;
  min-width: 0;
}

.search-results-dropdown {
  display: none;
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow-y: auto;
  max-height: 360px;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-subtle);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 1rem 0 2.4rem;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  border-color: var(--saffron-400);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(230, 106, 31, 0.12);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.notification-bell-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: var(--radius-full);
  transition: background 0.15s;
}

.notification-bell-btn:hover {
  background-color: var(--bg-card-subtle);
  color: var(--saffron-500);
}

.bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

.notification-dropdown {
  position: absolute;
  top: 46px;
  right: -50px;
  width: 320px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 24px -4px rgba(28, 25, 23, 0.14), 0 4px 6px -2px rgba(28, 25, 23, 0.05);
  z-index: 1000;
  overflow: hidden;
}

@media (max-width: 576px) {
  .notification-dropdown {
    right: -100px;
    width: 280px;
  }
}

.notification-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #faf8f4;
  border-bottom: 1px solid var(--border-subtle);
}

.notification-items-list {
  max-height: 320px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid #f9f6f1;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.notification-item:hover {
  background-color: #faf7f2;
}

.notif-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.3;
}

.notif-subtitle {
  font-size: 0.72rem;
  color: #8c8277;
  margin-top: 2px;
  line-height: 1.3;
}

.notif-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #d97706;
  background: #fef3c7;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.user-dropdown-card {
  position: absolute;
  right: 0;
  top: 48px;
  width: 190px;
  background: #ffffff;
  border: 1px solid #eee7de;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 20px -3px rgba(28, 25, 23, 0.12);
  z-index: 1000;
  overflow: hidden;
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  position: relative;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-md);
  transition: background 0.15s;
}

.user-profile-menu:hover {
  background-color: var(--bg-card-subtle);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--saffron-200);
}

.user-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--saffron-400), var(--gold-500));
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role-badge {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Content Container */
.admin-content {
  padding: 1.75rem;
  flex: 1;
  max-width: 1440px;
  width: 100%;
}

/* Top Page Bar */
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.date-range-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

/* ==============================================================================
   METRIC CARDS (4-Column)
   ============================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.15rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
  box-sizing: border-box;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon-box svg {
  width: 26px;
  height: 26px;
}

.icon-box-peach {
  background-color: #fdf0e6;
  color: #e66a1f;
}

.icon-box-gold {
  background-color: #fef7e3;
  color: #d97706;
  font-size: 1.5rem;
  font-weight: 700;
}

.icon-box-coral {
  background-color: #fdeceb;
  color: #ea580c;
}

.icon-box-purple {
  background-color: #f3e8ff;
  color: #9333ea;
}

.metric-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin: 0.15rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.74rem;
  font-weight: 600;
  flex-wrap: wrap;
}

.trend-up {
  color: #16a34a;
}

.trend-subtext {
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.2rem;
  white-space: nowrap;
}

/* ==============================================================================
   CHARTS ROW (2-Column)
   ============================================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.dashboard-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-sizing: border-box;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-icon {
  width: 18px;
  height: 18px;
  color: var(--saffron-500);
}

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-action-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--saffron-500);
  text-decoration: none;
  transition: color 0.15s;
}

.card-action-link:hover {
  color: var(--saffron-700);
  text-decoration: underline;
}

.card-filter-select {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 250px;
}

.chart-wrapper canvas {
  max-width: 100% !important;
}

.donut-chart-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 250px;
  gap: 1.25rem;
  min-width: 0;
}

.donut-canvas-box {
  position: relative;
  width: 170px;
  height: 170px;
  flex-shrink: 0;
  max-width: 100%;
}

.donut-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.donut-center-number {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.donut-center-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.legend-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.legend-indicator span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-count {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
}

.legend-count {
  font-weight: 600;
  color: var(--text-primary);
}

/* ==============================================================================
   TABLES & WIDGETS
   ============================================================================== */
.widgets-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.spiritual-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.83rem;
}

.spiritual-table th {
  padding: 0.65rem 0.85rem;
  background-color: var(--bg-card-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.74rem;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.spiritual-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.spiritual-table tr:hover td {
  background-color: rgba(254, 243, 235, 0.25);
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.product-thumb {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  flex-shrink: 0;
}

.stock-alert-text {
  color: #dc2626;
  font-weight: 700;
}

.pending-count-badge {
  color: #dc2626;
  font-weight: 700;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-confirmed, .badge-delivered, .badge-captured, .badge-published {
  background-color: var(--status-green-bg);
  color: var(--status-green-text);
}

.badge-processing, .badge-pending {
  background-color: var(--status-amber-bg);
  color: var(--status-amber-text);
}

.badge-shipped {
  background-color: var(--status-blue-bg);
  color: var(--status-blue-text);
}

.badge-cancelled, .badge-refunded, .badge-failed {
  background-color: var(--status-red-bg);
  color: var(--status-red-text);
}

.badge-type-puja {
  background-color: #fef3eb;
  color: #d96514;
}

.badge-type-consultation {
  background-color: #f3e8ff;
  color: #7c3aed;
}

/* Buttons */
.btn-restock, .btn-action-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--saffron-400);
  background-color: transparent;
  color: var(--saffron-600);
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-restock:hover, .btn-action-outline:hover {
  background-color: var(--saffron-500);
  color: #ffffff;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background-color: var(--saffron-500);
  color: #ffffff;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(230, 106, 31, 0.2);
  transition: background-color 0.15s, transform 0.1s;
}

.btn-primary:hover {
  background-color: var(--saffron-600);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background-color: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s;
}

.btn-secondary:hover {
  background-color: var(--bg-card-subtle);
}

/* Alert Notification Bars */
.flash-messages {
  margin-bottom: 1.25rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.alert-success {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-warning {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-info {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  border-color: var(--saffron-500);
  box-shadow: 0 0 0 3px rgba(230, 106, 31, 0.15);
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: var(--bg-card-subtle);
}

/* ==============================================================================
   RESPONSIVE DESIGN SYSTEM (ALL DEVICES)
   ============================================================================== */

/* --- Custom Scrollbar for Smooth Touch & Desktop Navigation --- */
.admin-sidebar::-webkit-scrollbar {
  width: 5px;
}
.admin-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.admin-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

/* Ensure Table Scrollers on Mobile */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.5rem;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

.spiritual-table {
  min-width: 600px;
}

/* --- Breakpoint 1: Laptop & Small Desktop (max-width: 1200px) --- */
@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
  .charts-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }
  .widgets-grid-2col {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }
  .donut-chart-container {
    justify-content: center;
    gap: 2.5rem;
  }
  .donut-legend {
    max-width: 340px;
  }
}

/* --- Breakpoint 2: Tablet & Mobile Navigation Mode (max-width: 992px) --- */
@media (max-width: 992px) {
  /* Sidebar Drawer */
  .admin-sidebar {
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: none;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
  }

  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 24px rgba(40, 30, 20, 0.18);
  }

  .sidebar-close-btn {
    display: flex;
  }

  .admin-main {
    margin-left: 0;
    width: 100%;
  }

  /* Navbar Header */
  .mobile-menu-toggle {
    display: flex;
  }

  .mobile-brand-logo {
    display: flex;
  }

  .admin-header {
    padding: 0 1.25rem;
    gap: 0.75rem;
  }

  .header-left {
    max-width: 100%;
  }

  /* Backdrop Overlay */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 15, 10, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 95;
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.active {
    display: block;
    opacity: 1;
  }

  .admin-content {
    padding: 1.25rem;
    overflow-x: hidden;
  }
}

/* --- Breakpoint 3: Phablets & Small Tablets (max-width: 768px) --- */
@media (max-width: 768px) {
  .admin-header {
    height: 60px;
    padding: 0 1rem;
    gap: 0.65rem;
  }

  /* Hide user name and role text on navbar to keep it clean and prevent wrapping */
  .user-details {
    display: none;
  }

  .header-right {
    gap: 0.65rem;
  }

  .page-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .page-header-actions {
    width: 100%;
  }

  .date-range-badge {
    width: 100%;
    justify-content: space-between;
    box-sizing: border-box;
  }

  .page-title {
    font-size: 1.35rem;
  }

  .page-subtitle {
    font-size: 0.82rem;
  }

  .card-header-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .chart-wrapper {
    height: 230px;
  }

  .modal-container {
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* --- Breakpoint 4: Large Phones & Small Tablets (max-width: 640px) --- */
@media (max-width: 640px) {
  /* Stack Donut Chart & Legend Cleanly */
  .donut-chart-container {
    flex-direction: column;
    height: auto;
    min-height: unset;
    align-items: center;
    gap: 1.25rem;
    padding: 0.5rem 0;
  }

  .donut-canvas-box {
    width: 160px;
    height: 160px;
    margin: 0 auto;
  }

  .donut-legend {
    width: 100%;
    max-width: 100%;
    gap: 0.45rem;
  }
}

/* --- Breakpoint 5: Mobile Phones (max-width: 576px) --- */
@media (max-width: 576px) {
  .admin-header {
    padding: 0 0.85rem;
    height: 56px;
    gap: 0.5rem;
  }

  /* Keep lotus icon visible, hide the brand name text to leave ample room for search */
  .mobile-brand-name {
    display: none;
  }

  .mobile-logo-icon {
    width: 26px;
    height: 26px;
  }

  .search-input {
    height: 35px;
    font-size: 0.8rem;
    padding: 0 0.75rem 0 2.2rem;
  }

  .search-icon {
    left: 0.75rem;
    width: 14px;
    height: 14px;
  }

  .notification-bell-btn {
    padding: 0.4rem;
  }

  .notification-bell-btn svg {
    width: 18px;
    height: 18px;
  }

  .user-avatar,
  .user-avatar-placeholder {
    width: 32px;
    height: 32px;
    font-size: 0.82rem;
  }

  .admin-content {
    padding: 0.85rem;
  }

  /* Single Column Metrics Cards on Mobile Phones */
  .metrics-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .metric-card {
    padding: 0.95rem;
    gap: 0.85rem;
  }

  .metric-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 1.25rem;
  }

  .metric-icon-box svg {
    width: 22px;
    height: 22px;
  }

  .metric-value {
    font-size: 1.35rem;
  }

  .dashboard-card {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  .chart-wrapper {
    height: 210px;
  }

  .search-results-dropdown {
    max-width: calc(100vw - 1.7rem);
    top: 42px;
  }

  #userProfileDropdown {
    top: 46px !important;
    right: 0 !important;
    width: 200px !important;
  }
}

/* --- Breakpoint 6: Extra-Small Phones (max-width: 380px) --- */
@media (max-width: 380px) {
  .admin-header {
    padding: 0 0.55rem;
  }

  .admin-content {
    padding: 0.65rem;
  }

  .page-title {
    font-size: 1.2rem;
  }

  .header-left {
    gap: 0.35rem;
  }

  .search-input {
    font-size: 0.75rem;
    padding-left: 1.9rem;
  }

  .search-icon {
    left: 0.55rem;
  }

  .user-profile-menu {
    padding: 0.15rem;
  }

  .metric-card {
    padding: 0.8rem;
    gap: 0.75rem;
  }

  .donut-canvas-box {
    width: 140px;
    height: 140px;
  }

  .donut-center-number {
    font-size: 1.15rem;
  }
}


