/* Theme styles for Tax Client Tracker */

/* Base theme settings (for transitions) */
:root {
  --theme-transition: all 0.3s ease-in-out;
}

/* Default theme (Dark Blue) */
[data-theme="dark-blue"] {
  --theme-bg: #0f172a;
  --theme-card-bg: #1e293b;
  --theme-card-header: #334155;
  --theme-text: #f8fafc;
  --theme-text-muted: #94a3b8;
  --theme-border: #475569;
  --theme-accent: #3b82f6;
  --theme-accent-light: #60a5fa;
  --theme-hover: #1e40af;
  --bs-primary: #3b82f6;
  --theme-sidebar-bg: #1e293b;
  --theme-sidebar-hover: #334155;
  --theme-table-hover: rgba(59, 130, 246, 0.1);
  --theme-footer-bg: #1e293b;
  --theme-navbar-bg: #0f172a;
}

/* Dark Purple theme */
[data-theme="dark-purple"] {
  --theme-bg: #1e1b4b;
  --theme-card-bg: #312e81;
  --theme-card-header: #4338ca;
  --theme-text: #e0e7ff;
  --theme-text-muted: #a5b4fc;
  --theme-border: #6366f1;
  --theme-accent: #8b5cf6;
  --theme-accent-light: #a78bfa;
  --theme-hover: #7c3aed;
  --bs-primary: #8b5cf6;
  --theme-sidebar-bg: #312e81;
  --theme-sidebar-hover: #4338ca;
  --theme-table-hover: rgba(139, 92, 246, 0.1);
  --theme-footer-bg: #312e81;
  --theme-navbar-bg: #1e1b4b;
}

/* Dark Green theme */
[data-theme="dark-green"] {
  --theme-bg: #064e3b;
  --theme-card-bg: #065f46;
  --theme-card-header: #047857;
  --theme-text: #ecfdf5;
  --theme-text-muted: #a7f3d0;
  --theme-border: #10b981;
  --theme-accent: #10b981;
  --theme-accent-light: #34d399;
  --theme-hover: #059669;
  --bs-primary: #10b981;
  --theme-sidebar-bg: #065f46;
  --theme-sidebar-hover: #047857;
  --theme-table-hover: rgba(16, 185, 129, 0.1);
  --theme-footer-bg: #065f46;
  --theme-navbar-bg: #064e3b;
}

/* Light theme */
[data-theme="light"] {
  --theme-bg: #f8fafc;
  --theme-card-bg: #ffffff;
  --theme-card-header: #e2e8f0;
  --theme-text: #0f172a;
  --theme-text-muted: #64748b;
  --theme-border: #cbd5e1;
  --theme-accent: #0ea5e9;
  --theme-accent-light: #38bdf8;
  --theme-hover: #0284c7;
  --bs-primary: #0ea5e9;
  --theme-sidebar-bg: #f1f5f9;
  --theme-sidebar-hover: #e2e8f0;
  --theme-table-hover: rgba(14, 165, 233, 0.05);
  --theme-footer-bg: #f1f5f9;
  --theme-navbar-bg: #f8fafc;
  --bs-body-bg: #f8fafc;
  --bs-body-color: #0f172a;
  --bs-secondary-bg: #e2e8f0;
  --bs-tertiary-bg: #f1f5f9;
}

/* Force light backgrounds when light theme is active */
[data-theme="light"] body,
[data-bs-theme="light"] body {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

[data-theme="light"] .navbar,
[data-bs-theme="light"] .navbar {
  background-color: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .navbar .navbar-brand,
[data-theme="light"] .navbar .nav-link,
[data-theme="light"] .navbar .navbar-toggler-icon {
  color: #0f172a !important;
}

[data-theme="light"] .navbar .nav-link:hover {
  color: #0ea5e9 !important;
  background-color: rgba(14, 165, 233, 0.1) !important;
}

[data-theme="light"] .navbar .nav-link.active {
  color: #0ea5e9 !important;
  background-color: rgba(14, 165, 233, 0.15) !important;
}

[data-theme="light"] .card,
[data-bs-theme="light"] .card {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .card-header,
[data-bs-theme="light"] .card-header {
  background-color: #f1f5f9 !important;
  border-bottom-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] .footer,
[data-bs-theme="light"] .footer {
  background-color: #f1f5f9 !important;
  border-top-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] .dropdown-menu,
[data-bs-theme="light"] .dropdown-menu {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .dropdown-item,
[data-bs-theme="light"] .dropdown-item {
  color: #0f172a !important;
}

[data-theme="light"] .dropdown-item:hover,
[data-bs-theme="light"] .dropdown-item:hover {
  background-color: #f1f5f9 !important;
}

[data-theme="light"] .modal-content,
[data-bs-theme="light"] .modal-content {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

[data-theme="light"] .list-group-item,
[data-bs-theme="light"] .list-group-item {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] .table,
[data-bs-theme="light"] .table {
  color: #0f172a !important;
}

[data-theme="light"] .table td,
[data-theme="light"] .table th,
[data-theme="light"] .table tr,
[data-bs-theme="light"] .table td,
[data-bs-theme="light"] .table th,
[data-bs-theme="light"] .table tr {
  color: #0f172a !important;
  background-color: #ffffff !important;
}

[data-theme="light"] .table-striped > tbody > tr:nth-of-type(odd) > *,
[data-bs-theme="light"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

[data-theme="light"] .table-hover > tbody > tr:hover > *,
[data-bs-theme="light"] .table-hover > tbody > tr:hover > * {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] .table a,
[data-bs-theme="light"] .table a {
  color: #0ea5e9 !important;
}

[data-theme="light"] .table thead th,
[data-bs-theme="light"] .table thead th {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .form-control,
[data-theme="light"] .form-select,
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .bg-light,
[data-bs-theme="light"] .bg-light {
  background-color: #f1f5f9 !important;
}

/* Ensure all text is dark in light theme */
[data-theme="light"] h1, [data-theme="light"] h2, [data-theme="light"] h3,
[data-theme="light"] h4, [data-theme="light"] h5, [data-theme="light"] h6,
[data-bs-theme="light"] h1, [data-bs-theme="light"] h2, [data-bs-theme="light"] h3,
[data-bs-theme="light"] h4, [data-bs-theme="light"] h5, [data-bs-theme="light"] h6 {
  color: #0f172a !important;
}

[data-theme="light"] p, [data-theme="light"] span, [data-theme="light"] div,
[data-theme="light"] label, [data-theme="light"] a:not(.btn),
[data-bs-theme="light"] p, [data-bs-theme="light"] span, [data-bs-theme="light"] div,
[data-bs-theme="light"] label, [data-bs-theme="light"] a:not(.btn) {
  color: inherit;
}

[data-theme="light"] .card-body,
[data-bs-theme="light"] .card-body {
  color: #0f172a !important;
}

[data-theme="light"] .card-title,
[data-bs-theme="light"] .card-title {
  color: #0f172a !important;
}

[data-theme="light"] .card-text,
[data-bs-theme="light"] .card-text {
  color: #0f172a !important;
}

[data-theme="light"] .alert,
[data-bs-theme="light"] .alert {
  color: inherit;
}

[data-theme="light"] .text-white,
[data-bs-theme="light"] .text-white {
  color: #0f172a !important;
}

[data-theme="light"] .accordion-button,
[data-bs-theme="light"] .accordion-button {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

[data-theme="light"] .accordion-body,
[data-bs-theme="light"] .accordion-body {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

[data-theme="light"] .accordion-item,
[data-bs-theme="light"] .accordion-item {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .offcanvas,
[data-bs-theme="light"] .offcanvas {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

[data-theme="light"] .toast,
[data-bs-theme="light"] .toast {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

[data-theme="light"] .popover,
[data-bs-theme="light"] .popover {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

[data-theme="light"] .tooltip-inner,
[data-bs-theme="light"] .tooltip-inner {
  background-color: #0f172a !important;
  color: #ffffff !important;
}

[data-theme="light"] strong, [data-theme="light"] b,
[data-bs-theme="light"] strong, [data-bs-theme="light"] b {
  color: inherit;
}

[data-theme="light"] small,
[data-bs-theme="light"] small {
  color: #64748b !important;
}

[data-theme="light"] .badge.bg-dark,
[data-bs-theme="light"] .badge.bg-dark {
  background-color: #64748b !important;
}

[data-theme="light"] .btn-outline-secondary,
[data-bs-theme="light"] .btn-outline-secondary {
  color: #64748b !important;
  border-color: #64748b !important;
}

[data-theme="light"] .btn-outline-secondary:hover,
[data-bs-theme="light"] .btn-outline-secondary:hover {
  background-color: #64748b !important;
  color: #ffffff !important;
}

/* New Theme: Dark Red */
[data-theme="dark-red"] {
  --theme-bg: #450a0a;
  --theme-card-bg: #7f1d1d;
  --theme-card-header: #991b1b;
  --theme-text: #fef2f2;
  --theme-text-muted: #fecaca;
  --theme-border: #ef4444;
  --theme-accent: #dc2626;
  --theme-accent-light: #ef4444;
  --theme-hover: #b91c1c;
  --bs-primary: #dc2626;
  --theme-sidebar-bg: #7f1d1d;
  --theme-sidebar-hover: #991b1b;
  --theme-table-hover: rgba(220, 38, 38, 0.1);
  --theme-footer-bg: #7f1d1d;
  --theme-navbar-bg: #450a0a;
}

/* New Theme: Dark Gold */
[data-theme="dark-gold"] {
  --theme-bg: #422006;
  --theme-card-bg: #713f12;
  --theme-card-header: #854d0e;
  --theme-text: #fffbeb;
  --theme-text-muted: #fde68a;
  --theme-border: #eab308;
  --theme-accent: #f59e0b;
  --theme-accent-light: #fbbf24;
  --theme-hover: #d97706;
  --bs-primary: #f59e0b;
  --theme-sidebar-bg: #713f12;
  --theme-sidebar-hover: #854d0e;
  --theme-table-hover: rgba(245, 158, 11, 0.1);
  --theme-footer-bg: #713f12;
  --theme-navbar-bg: #422006;
}

/* New Theme: Dark Cyan */
[data-theme="dark-cyan"] {
  --theme-bg: #083344;
  --theme-card-bg: #155e75;
  --theme-card-header: #0e7490;
  --theme-text: #ecfeff;
  --theme-text-muted: #a5f3fc;
  --theme-border: #06b6d4;
  --theme-accent: #0891b2;
  --theme-accent-light: #22d3ee;
  --theme-hover: #0e7490;
  --bs-primary: #0891b2;
  --theme-sidebar-bg: #155e75;
  --theme-sidebar-hover: #0e7490;
  --theme-table-hover: rgba(8, 145, 178, 0.1);
  --theme-footer-bg: #155e75;
  --theme-navbar-bg: #083344;
}

/* New Theme: High Contrast */
[data-theme="high-contrast"] {
  --theme-bg: #000000;
  --theme-card-bg: #1a1a1a;
  --theme-card-header: #333333;
  --theme-text: #ffffff;
  --theme-text-muted: #cccccc;
  --theme-border: #666666;
  --theme-accent: #ffff00;
  --theme-accent-light: #ffff99;
  --theme-hover: #dddd00;
  --bs-primary: #ffff00;
  --theme-sidebar-bg: #1a1a1a;
  --theme-sidebar-hover: #333333;
  --theme-table-hover: rgba(255, 255, 0, 0.1);
  --theme-footer-bg: #1a1a1a;
  --theme-navbar-bg: #000000;
}

/* Apply theme variables to elements */
body {
  background-color: var(--theme-bg);
  color: var(--theme-text);
  transition: var(--theme-transition);
}

.card {
  background-color: var(--theme-card-bg);
  border-color: var(--theme-border);
  transition: var(--theme-transition);
}

.card-header {
  background-color: var(--theme-card-header);
  border-bottom-color: var(--theme-border);
  color: var(--theme-text);
  transition: var(--theme-transition);
}

.card-header .card-title,
.card-header h5,
.card-header h6 {
  color: var(--theme-text);
}

/* Ensure bg-light card headers have dark text for proper contrast */
.card-header.bg-light {
  background-color: #f8f9fa !important;
  color: #212529 !important;
}

.card-header.bg-light .card-title,
.card-header.bg-light h5,
.card-header.bg-light h6 {
  color: #212529 !important;
}

.table {
  color: var(--theme-text);
  transition: var(--theme-transition);
}

.table-hover tbody tr:hover {
  background-color: var(--theme-table-hover);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.05);
}

.form-control, .form-select {
  background-color: var(--theme-card-bg);
  border-color: var(--theme-border);
  color: var(--theme-text);
  transition: var(--theme-transition);
}

.form-control:focus, .form-select:focus {
  border-color: var(--theme-accent);
}

.nav-link, .navbar-brand {
  color: var(--theme-text) !important;
  transition: var(--theme-transition);
}

.nav-link:hover, .navbar-brand:hover {
  color: var(--theme-accent-light) !important;
}

.text-muted {
  color: var(--theme-text-muted) !important;
}

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

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

.navbar {
  background-color: var(--theme-navbar-bg) !important;
}

.footer {
  background-color: var(--theme-footer-bg) !important;
}

/* Theme selector styling */
.theme-selector {
  position: relative;
  display: inline-block;
}

.theme-options {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background-color: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 0.25rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  z-index: 1050;
  width: 220px;
  max-height: 400px;
  overflow-y: auto;
}

.theme-selector:hover .theme-options,
.theme-options:hover {
  display: block;
}

.theme-option {
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
  margin-bottom: 0.25rem;
}

.theme-option:hover {
  background-color: var(--theme-card-header);
}

.theme-color-preview {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  margin-right: 0.75rem;
  border: 2px solid var(--theme-border);
}

.theme-color-preview.dark-blue {
  background-color: #3b82f6;
}

.theme-color-preview.dark-purple {
  background-color: #8b5cf6;
}

.theme-color-preview.dark-green {
  background-color: #10b981;
}

.theme-color-preview.light {
  background-color: #0ea5e9;
}

.theme-color-preview.dark-red {
  background-color: #dc2626;
}

.theme-color-preview.dark-gold {
  background-color: #f59e0b;
}

.theme-color-preview.dark-cyan {
  background-color: #0891b2;
}

.theme-color-preview.high-contrast {
  background-color: #ffff00;
  border: 2px solid #ffffff;
}

.theme-option.active {
  background-color: var(--theme-accent);
  color: #fff;
}

.theme-option.active .theme-color-preview {
  border-color: #fff;
}

/* Enhanced theme selector */
.theme-selector-modal .modal-content {
  background-color: var(--theme-card-bg);
  color: var(--theme-text);
  border-color: var(--theme-border);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 1rem;
}

.theme-grid-item {
  text-align: center;
  cursor: pointer;
  padding: 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.theme-grid-item:hover {
  background-color: var(--theme-card-header);
}

.theme-grid-item.active {
  background-color: var(--theme-accent);
  color: white;
}

.theme-preview {
  width: 100%;
  height: 80px;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  border: 2px solid var(--theme-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.theme-preview-header {
  height: 20px;
  background-color: var(--preview-navbar);
}

.theme-preview-body {
  flex: 1;
  background-color: var(--preview-bg);
  padding: 4px;
}

.theme-preview-card {
  height: 100%;
  background-color: var(--preview-card);
  border-radius: 2px;
}

/* Font size controls */
.font-size-controls {
  display: flex;
  align-items: center;
  margin-top: 1rem;
}

.font-size-controls .btn {
  margin: 0 0.25rem;
}

.font-size-value {
  min-width: 3rem;
  text-align: center;
}

/* Font size variables */
body {
  --base-font-size: 16px;
  font-size: var(--base-font-size);
}

body[data-font-size="small"] {
  --base-font-size: 14px;
}

body[data-font-size="medium"] {
  --base-font-size: 16px;
}

body[data-font-size="large"] {
  --base-font-size: 18px;
}

body[data-font-size="xlarge"] {
  --base-font-size: 20px;
}

/* Reduce animations preference */
body.reduce-animations .accordion-button::after {
  transition: none !important;
}

body.reduce-animations .accordion-button:not(.collapsed)::after {
  transform: none !important;
}

body.reduce-animations * {
  transition-duration: 0s !important;
  animation-duration: 0s !important;
}

body.reduce-animations .accordion-collapse {
  transition: none !important;
}

body.reduce-animations .collapse:not(.show) {
  display: none;
}

body.reduce-animations .collapsing {
  transition: none !important;
  height: auto !important;
}
