﻿/* =====================================================
   CropPulse – Dark Mode CSS
   Additional overrides for dark theme (default active)
   Light mode overrides handled via body.light-mode in main.css
   ===================================================== */

/* ── Dark mode specific enhancements ───────────────── */
body:not(.light-mode) .ag-navbar {
  box-shadow: 0 1px 30px rgba(0,0,0,0.5);
}

body:not(.light-mode) .ag-card {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Neon accent for dark mode stats */
body:not(.light-mode) .stat-card:hover .stat-value {
  text-shadow: 0 0 20px rgba(22,163,74,0.4);
}

/* Dark mode form inputs – subtle glow on focus */
body:not(.light-mode) .ag-input:focus {
  background: rgba(22,163,74,0.05);
}

/* Dark hero gradient overlay */
.hero-section {
  background: radial-gradient(ellipse at 20% 50%, rgba(22,163,74,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(37,99,235,0.06) 0%, transparent 60%),
              var(--bg-base);
  position: relative;
  overflow: hidden;
}

/* Animated grid lines in dark mode */
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* Dark mode leaf upload zone */
body:not(.light-mode) .upload-zone {
  background: linear-gradient(145deg, rgba(20,30,46,0.8), rgba(15,23,36,0.9));
}

/* Dark mode chart canvas */
body:not(.light-mode) canvas { filter: brightness(0.95); }

/* Dark mode table alternating rows */
body:not(.light-mode) .ag-table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.015);
}

/* Dark glassmorphism modals */
body:not(.light-mode) .modal-content {
  background: rgba(15, 23, 36, 0.95) !important;
  backdrop-filter: blur(25px) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow: 0 25px 80px rgba(0,0,0,0.7) !important;
}

/* Bootstrap overrides for dark mode */
body:not(.light-mode) .modal-header {
  border-bottom-color: rgba(255,255,255,0.08);
}
body:not(.light-mode) .modal-footer {
  border-top-color: rgba(255,255,255,0.08);
}
body:not(.light-mode) .modal-title { color: var(--text-primary); }

body:not(.light-mode) .dropdown-menu {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
}
body:not(.light-mode) .dropdown-item {
  color: var(--text-secondary) !important;
  transition: all 0.15s ease;
}
body:not(.light-mode) .dropdown-item:hover {
  background: var(--bg-card-hover) !important;
  color: var(--primary-light) !important;
}
body:not(.light-mode) .dropdown-divider {
  border-color: var(--border) !important;
}

/* ── Light mode enhancements ────────────────────────── */
body.light-mode .hero-section {
  background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 50%, #fefce8 100%);
}
body.light-mode .hero-grid {
  background-image:
    linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
}
body.light-mode .ag-card {
  box-shadow: 0 1px 8px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
}
body.light-mode .ag-card:hover {
  box-shadow: 0 4px 24px rgba(22,163,74,0.15);
}
body.light-mode .stat-card {
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
body.light-mode .ag-navbar {
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
}
body.light-mode .ag-table thead th {
  background: #f8fafc;
  color: #64748b;
}
body.light-mode .ag-sidebar {
  background: #ffffff;
  box-shadow: 2px 0 20px rgba(0,0,0,0.06);
}
body.light-mode .btn-ag-secondary {
  color: #374151;
}
body.light-mode .ag-input {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(0,0,0,0.12);
}
body.light-mode .ag-input:focus {
  border-color: var(--primary);
  background: #ffffff;
}
body.light-mode .upload-zone {
  background: #f8fafc;
}

/* ── Dark/Light Mode Toggle Button ──────────────────── */
#theme-toggle {
  width: 52px; height: 28px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  position: relative; cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}
#theme-toggle::before {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), background 0.3s ease;
}
body.light-mode #theme-toggle::before {
  transform: translateX(24px);
  background: var(--primary);
}
#theme-toggle .toggle-icon {
  position: absolute; font-size: 0.7rem;
  top: 50%; transform: translateY(-50%);
}
#theme-toggle .sun-icon  { right: 6px;  }
#theme-toggle .moon-icon { left: 6px; }

/* ── Accessibility Focus Styles ─────────────────────── */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Print Styles ────────────────────────────────────── */
@media print {
  .ag-navbar, .ag-sidebar, .ag-toast-container,
  #theme-toggle, .btn-ag-primary, .btn-ag-secondary { display: none !important; }
  body { background: white; color: black; }
  .ag-card { border: 1px solid #ddd; box-shadow: none; }
}
