:root {
  --bg-primary: #1a2332;
  --bg-secondary: #273447;
  --bg-tertiary: #2d3e52;
  --bg-dark: #0f1729;
  --sidebar-bg: #1BA0A6;
  --sidebar-hover: #169499;
  --accent-primary: #a855f7;
  --accent-hover: #9333ea;
  --text-primary: #ffffff;
  --text-secondary: #b4b9c9;
  --border-color: #374151;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar-width: 250px;
  
  --gradient-purple: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --gradient-pink: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
  --gradient-cyan: linear-gradient(135deg, #67e8f9 0%, #22d3ee 100%);
  --gradient-green: linear-gradient(135deg, #6ee7b7 0%, #10b981 100%);
  --gradient-orange: linear-gradient(135deg, #fdba74 0%, #f97316 100%);
  --gradient-blue: linear-gradient(135deg, #93c5fd 0%, #3b82f6 100%);
  --gradient-indigo: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
  --gradient-rose: linear-gradient(135deg, #fda4af 0%, #f43f5e 100%);
}

.light-mode {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-dark: #e8edf2;
  --text-primary: #1a2332;
  --text-secondary: #4b5e73;
  --border-color: #d1dae4;
  --accent-primary: #7c3aed;
  --accent-hover: #6d28d9;
}

.light-mode .topbar {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.light-mode tbody tr:hover {
  background: rgba(124, 58, 237, 0.04);
}

.light-mode .modal {
  background: rgba(0, 0, 0, 0.4);
}

.light-mode .modal-content {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.light-mode .chart-card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #1e1b4b 100%);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-primary);
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(168, 85, 247, 0.2);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.plant-icon {
  font-size: 3em;
  display: block;
  margin-bottom: 10px;
}

.login-header h1 {
  font-size: 1.8em;
  margin-bottom: 8px;
  color: var(--accent-primary);
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.9em;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9em;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1em;
  transition: all 0.3s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(168, 85, 247, 0.3);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.btn-block {
  width: 100%;
  display: block;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9em;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: #fca5a5;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success);
  color: #6ee7b7;
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9em;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.login-footer small {
  color: var(--text-secondary);
}

.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  padding: 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
  padding: 25px 20px;
  background: rgba(0, 0, 0, 0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2em;
  font-weight: 700;
  color: white;
}

.sidebar-nav {
  padding: 10px 0;
}

.nav-section-title {
  padding: 20px 20px 10px;
  font-size: 0.75em;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
  font-weight: 500;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  border-left-color: white;
  color: white;
}

.nav-item-icon {
  font-size: 1.3em;
  width: 24px;
  text-align: center;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  background: var(--bg-dark);
  min-height: 100vh;
}

.topbar {
  background: var(--bg-secondary);
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.topbar-title {
  font-size: 1.8em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-icon {
  font-size: 0.9em;
}

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

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
}

.user-menu:hover {
  background: var(--accent-primary);
}

.content-area {
  padding: 30px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--gradient-purple);
  border-radius: 20px;
  padding: 30px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
}

.stat-card.purple { background: var(--gradient-purple); }
.stat-card.pink { background: var(--gradient-pink); }
.stat-card.cyan { background: var(--gradient-cyan); }
.stat-card.green { background: var(--gradient-green); }
.stat-card.orange { background: var(--gradient-orange); }
.stat-card.blue { background: var(--gradient-blue); }
.stat-card.indigo { background: var(--gradient-indigo); }
.stat-card.rose { background: var(--gradient-rose); }

.stat-info {
  position: relative;
  z-index: 2;
}

.stat-info h3 {
  font-size: 0.75em;
  font-weight: 600;
  opacity: 0.85;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.95);
}

.stat-value {
  font-size: 3.2em;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}

.stat-icon {
  position: absolute;
  bottom: 20px;
  right: 20px;
  font-size: 5.5em;
  opacity: 0.18;
  line-height: 1;
  z-index: 1;
}

.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  min-height: 400px;
  margin-bottom: 30px;
}

.chart-card canvas {
  max-height: 350px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.chart-title {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-filters {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--accent-primary);
  color: white;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: rgba(168, 85, 247, 0.2);
  color: var(--accent-primary);
}

.badge-secondary {
  background: rgba(99, 102, 241, 0.2);
  color: #6366f1;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
}

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

.table-container {
  overflow-x: auto;
  border-radius: 12px;
}

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

thead th {
  background: var(--bg-tertiary);
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid var(--accent-primary);
  color: var(--text-primary);
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

tbody tr:hover {
  background: rgba(168, 85, 247, 0.05);
}

tbody tr:last-child td {
  border-bottom: none;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85em;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: #ea580c;
  transform: translateY(-2px);
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.5em;
  font-weight: 700;
}

.close-modal {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8em;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: var(--text-primary);
}

.geo-list {
  list-style: none;
  padding: 0;
}

.geo-item {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 10px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  border-left: 4px solid var(--accent-primary);
  transition: all 0.3s ease;
}

.geo-item:hover {
  background: rgba(168, 85, 247, 0.1);
  transform: translateX(5px);
}

.geo-flag {
  font-size: 1.8em;
  margin-right: 15px;
}

.geo-country {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
}

.geo-count {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--accent-primary);
  margin-right: 15px;
}

.geo-percentage {
  color: var(--text-secondary);
  font-size: 0.9em;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .charts-row {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════
   TOAST NOTIFICATION SYSTEM (global admin)
══════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: calc(100% - 40px);
}
.toast {
  background: #1e2a3a;
  border: 1px solid rgba(255,255,255,.13);
  color: #fff;
  border-radius: 13px;
  padding: 14px 16px 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 36px rgba(0,0,0,.5);
  pointer-events: auto;
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1) both;
  position: relative;
  overflow: hidden;
  border-left: 4px solid rgba(255,255,255,.2);
}
.toast.toast-exit {
  animation: toastOut .28s ease both;
}
.toast-success { border-left-color: #10b981; }
.toast-error   { border-left-color: #ef4444; }
.toast-info    { border-left-color: #3b82f6; }
.toast-warning { border-left-color: #f59e0b; }
.toast-icon { font-size: 20px; flex-shrink: 0; line-height: 1; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 700; color: #fff; margin: 0; line-height: 1.3; }
.toast-sub   { font-size: 12px; color: rgba(255,255,255,.55); margin: 2px 0 0; }
.toast-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.35);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: color .2s;
}
.toast-close:hover { color: rgba(255,255,255,.8); }
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255,255,255,.15);
  border-radius: 0 0 0 13px;
  animation: toastProg var(--toast-dur, 4s) linear forwards;
}
.toast-success .toast-progress { background: #10b981; }
.toast-error   .toast-progress { background: #ef4444; }
.toast-info    .toast-progress { background: #3b82f6; }
.toast-warning .toast-progress { background: #f59e0b; }
@keyframes toastIn  { from{opacity:0;transform:translateX(110%)} to{opacity:1;transform:translateX(0)} }
@keyframes toastOut { from{opacity:1;transform:translateX(0)} to{opacity:0;transform:translateX(110%)} }
@keyframes toastProg { from{width:100%} to{width:0%} }
