/* Global styles extracted from templates into a single stylesheet */

/* Dark mode base */
html.dark body {
  background-image: linear-gradient(to bottom right, #1e293b, #0f172a);
  color: #e2e8f0;
}

/* Ensure all "fields" (cards/sections like .chart-box) use the same dark background */
html.dark .chart-box {
  background-color: #1e293b !important; /* slate-800 to match other cards */
  color: #e2e8f0;
}

/* Common dark replacements for Tailwind utility classes used across pages */
html.dark .bg-white,
html.dark .bg-white\/70 {
  background-color: #1e293b;
  color: #e2e8f0;
}

html.dark .text-gray-900,
html.dark .text-gray-800 { color: #e2e8f0; }
html.dark .text-gray-700 { color: #cbd5e1; }
html.dark .text-gray-600,
html.dark .text-gray-500 { color: #94a3b8; }

html.dark .text-indigo-800,
html.dark .text-indigo-700,
html.dark .text-indigo-600 { color: #a5b4fc; }

html.dark .bg-indigo-100 { background-color: #312e81; color: #e0e7ff; }
html.dark .text-indigo-600 { color: #818cf8; }

html.dark .bg-gray-50,
html.dark .bg-gray-100,
html.dark .bg-gray-200 { background-color: #334155; }

html.dark .bg-gray-100:hover,
html.dark .bg-gray-200:hover { background-color: #475569; }

html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-b { border-color: #334155; }

html.dark .shadow,
html.dark .shadow-md {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* Ensure form fields have consistent colors in dialogs and dark mode */
/* Scope: any modal/dialog container (id ending with 'Modal') and general dark mode */
[id$="Modal"] input,
[id$="Modal"] select,
[id$="Modal"] textarea {
  background-color: #ffffff;
  color: #111827; /* gray-900 */
  border: 1px solid #d1d5db; /* gray-300 */
}
html.dark [id$="Modal"] input,
html.dark [id$="Modal"] select,
html.dark [id$="Modal"] textarea {
  background-color: #1f2937; /* gray-800 */
  color: #e5e7eb; /* gray-200 */
  border-color: #374151; /* gray-700 */
}

/* Also normalize generic form fields in dark containers */
html.dark input,
html.dark select,
html.dark textarea {
  background-color: #1f2937; /* gray-800 */
  color: #e5e7eb;
  border-color: #374151;
}

/* Dark mode toggle button (used on all pages) */
.dark-mode-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  background-color: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}
.dark-mode-toggle:hover { transform: scale(1.1); }
html.dark .dark-mode-toggle { background-color: #6366f1; }

/* Page-specific: post-per-party custom controls */
.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid #ccc;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  position: relative;
  background-color: white;
}
.custom-checkbox:checked {
  background-color: #4f46e5;
  border-color: #4f46e5;
}
.custom-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
/* Ensure consistent checkbox color in dark mode (inside dialogs and elsewhere) */
html.dark .custom-checkbox { background-color: #334155; border-color: #475569; }
html.dark .custom-checkbox:checked { background-color: #6366f1; border-color: #6366f1; }

.party-dropdown-button { transition: all 0.2s; }
.party-dropdown-button:hover { background-color: #f3f4f6; }
.party-dropdown-content {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: 0.375rem;
  max-height: 300px;
}
.party-checkbox-container:hover { background-color: #f3f4f6; }

/* Form field focus and placeholder consistency */
/* Light mode focus */
[id$="Modal"] input:focus,
[id$="Modal"] select:focus,
[id$="Modal"] textarea:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #4f46e5; /* indigo-600 */
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Dark mode focus */
html.dark [id$="Modal"] input:focus,
html.dark [id$="Modal"] select:focus,
html.dark [id$="Modal"] textarea:focus,
html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  outline: none;
  border-color: #818cf8; /* indigo-400 */
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
}

/* Placeholder colors */
html.dark input::placeholder,
html.dark textarea::placeholder,
html.dark select::placeholder { color: #94a3b8; }

/* Disabled state alignment */
html.dark input:disabled,
html.dark select:disabled,
html.dark textarea:disabled {
  background-color: #1f2937;
  color: #64748b;
  border-color: #374151;
  opacity: 0.7;
}
