/* ================================================================
   PRETTIS.ai UNIVERSAL DARK MODE SYSTEM
   Centralized dark mode styling for the entire platform
   ================================================================ */

/* ================================================================
   ROOT VARIABLES - DESIGN TOKENS
   ================================================================ */

:root {
  /* Light Mode Colors */
  --bg-primary-light: #ffffff;
  --bg-secondary-light: #f9fafb;
  --bg-tertiary-light: #f3f4f6;
  
  --text-primary-light: #111827;
  --text-secondary-light: #4b5563;
  --text-tertiary-light: #6b7280;
  
  --border-light: #e5e7eb;
  --border-secondary-light: #d1d5db;
  
  --accent-light: #000000;
  --accent-hover-light: #1f2937;
  
  /* Dark Mode Colors */
  --bg-primary-dark: #1a1a1a;
  --bg-secondary-dark: #2a2a2a;
  --bg-tertiary-dark: #333333;
  
  --text-primary-dark: #ffffff;
  --text-secondary-dark: #d1d5db;
  --text-tertiary-dark: #9ca3af;
  
  --border-dark: #3a3a3a;
  --border-secondary-dark: #4a4a4a;
  
  --accent-dark: #D4FF00;
  --accent-hover-dark: #C4EF00;
  
  /* Universal Colors (Both Modes) */
  --accent-primary: #D4FF00;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
}

/* ================================================================
   DARK MODE - BODY & HTML
   ================================================================ */

html.dark {
  background-color: var(--bg-primary-dark);
  color: var(--text-primary-dark);
}

html.dark body {
  background-color: var(--bg-primary-dark);
  color: var(--text-primary-dark);
}

/* ================================================================
   DARK MODE - DASHBOARD PAGES
   ================================================================ */

html.dark .dashboard-page {
  background-color: var(--bg-primary-dark) !important;
  color: var(--text-primary-dark) !important;
}

/* Headers */
html.dark .dashboard-page header,
html.dark .dashboard-page nav {
  background-color: var(--bg-secondary-dark) !important;
  border-color: var(--border-dark) !important;
}

/* Cards & Containers */
html.dark .dashboard-page [class*="bg-white"],
html.dark .dashboard-page [class*="bg-gray-50"] {
  background-color: var(--bg-secondary-dark) !important;
  border-color: var(--border-dark) !important;
}

html.dark .dashboard-page [class*="bg-gray-100"] {
  background-color: var(--bg-tertiary-dark) !important;
}

/* Text Colors */
html.dark .dashboard-page h1,
html.dark .dashboard-page h2,
html.dark .dashboard-page h3,
html.dark .dashboard-page h4,
html.dark .dashboard-page h5,
html.dark .dashboard-page h6 {
  color: var(--text-primary-dark) !important;
}

html.dark .dashboard-page p,
html.dark .dashboard-page span,
html.dark .dashboard-page div {
  color: var(--text-secondary-dark);
}

html.dark .dashboard-page [class*="text-gray-600"],
html.dark .dashboard-page [class*="text-gray-700"] {
  color: var(--text-tertiary-dark) !important;
}

html.dark .dashboard-page [class*="text-gray-400"],
html.dark .dashboard-page [class*="text-gray-500"] {
  color: var(--text-tertiary-dark) !important;
}

/* Borders */
html.dark .dashboard-page [class*="border-gray"] {
  border-color: var(--border-dark) !important;
}

/* Inputs & Forms */
html.dark .dashboard-page input,
html.dark .dashboard-page textarea,
html.dark .dashboard-page select {
  background-color: var(--bg-tertiary-dark) !important;
  border-color: var(--border-dark) !important;
  color: var(--text-primary-dark) !important;
}

html.dark .dashboard-page input:focus,
html.dark .dashboard-page textarea:focus,
html.dark .dashboard-page select:focus {
  border-color: var(--accent-dark) !important;
}

html.dark .dashboard-page input::placeholder,
html.dark .dashboard-page textarea::placeholder {
  color: var(--text-tertiary-dark) !important;
}

html.dark .dashboard-page input:disabled,
html.dark .dashboard-page textarea:disabled,
html.dark .dashboard-page select:disabled {
  background-color: var(--bg-primary-dark) !important;
  color: var(--text-tertiary-dark) !important;
  cursor: not-allowed;
}

/* Buttons */
html.dark .dashboard-page button:not([class*="bg-black"]):not([class*="bg-red"]):not([class*="bg-green"]) {
  background-color: var(--bg-tertiary-dark) !important;
  color: var(--text-primary-dark) !important;
  border-color: var(--border-dark) !important;
}

html.dark .dashboard-page button:hover:not([class*="bg-black"]):not([class*="bg-red"]):not([class*="bg-green"]) {
  background-color: var(--bg-secondary-dark) !important;
}

/* Accent Buttons (Primary Actions) */
html.dark .dashboard-page button[class*="bg-black"],
html.dark .dashboard-page a[class*="bg-black"] {
  background-color: var(--accent-dark) !important;
  color: #000000 !important;
}

html.dark .dashboard-page button[class*="bg-black"]:hover,
html.dark .dashboard-page a[class*="bg-black"]:hover {
  background-color: var(--accent-hover-dark) !important;
}

/* Dropdowns & Menus */
html.dark .dashboard-page [class*="absolute"][class*="shadow"] {
  background-color: var(--bg-secondary-dark) !important;
  border-color: var(--border-dark) !important;
}

/* Modals & Overlays */
html.dark .dashboard-page [class*="fixed"][class*="z-50"] {
  background-color: rgba(0, 0, 0, 0.8) !important;
}

html.dark .dashboard-page [class*="modal"],
html.dark .dashboard-page [role="dialog"] {
  background-color: var(--bg-secondary-dark) !important;
  border-color: var(--border-dark) !important;
}

/* Tables */
html.dark .dashboard-page table {
  border-color: var(--border-dark) !important;
}

html.dark .dashboard-page thead {
  background-color: var(--bg-tertiary-dark) !important;
  border-color: var(--border-dark) !important;
}

html.dark .dashboard-page tbody tr {
  border-color: var(--border-dark) !important;
}

html.dark .dashboard-page tbody tr:hover {
  background-color: var(--bg-tertiary-dark) !important;
}

/* ================================================================
   DARK MODE - PUBLIC PAGES (Landing, About, Contact, etc.)
   ================================================================ */

html.dark .public-page {
  background-color: var(--bg-primary-dark) !important;
  color: var(--text-primary-dark) !important;
}

html.dark .public-page header,
html.dark .public-page nav {
  background-color: var(--bg-secondary-dark) !important;
  border-color: var(--border-dark) !important;
}

html.dark .public-page footer {
  background-color: var(--bg-secondary-dark) !important;
  border-color: var(--border-dark) !important;
}

/* ================================================================
   DARK MODE - ADMIN PAGES
   ================================================================ */

html.dark .admin-page {
  background-color: var(--bg-primary-dark) !important;
  color: var(--text-primary-dark) !important;
}

html.dark .admin-page [class*="bg-white"] {
  background-color: var(--bg-secondary-dark) !important;
}

html.dark .admin-page [class*="bg-gray-50"],
html.dark .admin-page [class*="bg-gray-100"] {
  background-color: var(--bg-tertiary-dark) !important;
}

/* ================================================================
   DARK MODE - SPECIFIC COMPONENTS
   ================================================================ */

/* Notifications */
html.dark .notification-success {
  background-color: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #6ee7b7 !important;
}

html.dark .notification-error {
  background-color: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #fca5a5 !important;
}

html.dark .notification-warning {
  background-color: rgba(245, 158, 11, 0.1) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: #fcd34d !important;
}

html.dark .notification-info {
  background-color: rgba(59, 130, 246, 0.1) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
  color: #93c5fd !important;
}

/* Loading Spinners */
html.dark .spinner,
html.dark [class*="animate-spin"] {
  border-color: var(--border-dark) !important;
  border-top-color: var(--accent-dark) !important;
}

/* Tooltips */
html.dark [class*="tooltip"] {
  background-color: var(--bg-tertiary-dark) !important;
  color: var(--text-primary-dark) !important;
  border-color: var(--border-dark) !important;
}

/* Badges */
html.dark .badge {
  background-color: var(--bg-tertiary-dark) !important;
  color: var(--text-primary-dark) !important;
  border-color: var(--border-dark) !important;
}

/* Progress Bars */
html.dark .progress-bar {
  background-color: var(--bg-tertiary-dark) !important;
}

html.dark .progress-bar-fill {
  background-color: var(--accent-dark) !important;
}

/* Skeleton Loaders */
html.dark .skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary-dark) 25%,
    var(--bg-secondary-dark) 50%,
    var(--bg-tertiary-dark) 75%
  ) !important;
}

/* ================================================================
   DARK MODE - SCROLLBARS
   ================================================================ */

html.dark ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

html.dark ::-webkit-scrollbar-track {
  background: var(--bg-primary-dark);
}

html.dark ::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary-dark);
  border-radius: 4px;
}

html.dark ::-webkit-scrollbar-thumb:hover {
  background: var(--border-dark);
}

/* ================================================================
   DARK MODE - IMAGES & MEDIA
   ================================================================ */

html.dark img:not([class*="logo"]) {
  opacity: 0.9;
}

html.dark img:hover:not([class*="logo"]) {
  opacity: 1;
}

/* ================================================================
   DARK MODE - SHADOWS
   ================================================================ */

html.dark [class*="shadow-sm"] {
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3) !important;
}

html.dark [class*="shadow-md"],
html.dark [class*="shadow"] {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3) !important;
}

html.dark [class*="shadow-lg"] {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.4) !important;
}

html.dark [class*="shadow-xl"] {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 10px 10px -5px rgba(0, 0, 0, 0.5) !important;
}

/* ================================================================
   DARK MODE - TRANSITIONS
   ================================================================ */

html,
html.dark,
html.dark *,
* {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
}

/* ================================================================
   DARK MODE - UTILITY CLASSES
   ================================================================ */

.dark-only {
  display: none;
}

html.dark .dark-only {
  display: block;
}

html.dark .light-only {
  display: none;
}

.light-only {
  display: block;
}

/* ================================================================
   DARK MODE - OVERRIDES FOR SPECIFIC ELEMENTS
   ================================================================ */

/* Logo - Never apply dark mode filters */
html.dark img[alt*="logo"],
html.dark img[src*="logo"],
html.dark img[class*="logo"] {
  opacity: 1 !important;
  filter: none !important;
}

/* Icons - Maintain clarity */
html.dark svg {
  filter: none !important;
}

/* Code blocks */
html.dark pre,
html.dark code {
  background-color: var(--bg-tertiary-dark) !important;
  color: var(--text-primary-dark) !important;
  border-color: var(--border-dark) !important;
}

/* Links */
html.dark a {
  color: var(--accent-dark) !important;
}

html.dark a:hover {
  color: var(--accent-hover-dark) !important;
}

/* ================================================================
   DARK MODE - FORCE OVERRIDES (Last Resort)
   ================================================================ */

html.dark [style*="background-color: white"],
html.dark [style*="background-color: #fff"],
html.dark [style*="background-color: #ffffff"] {
  background-color: var(--bg-secondary-dark) !important;
}

html.dark [style*="color: black"],
html.dark [style*="color: #000"],
html.dark [style*="color: #000000"] {
  color: var(--text-primary-dark) !important;
}

/* ================================================================
   END OF UNIVERSAL DARK MODE SYSTEM
   ================================================================ */

