[data-theme="dark"],
[data-theme="dark-blue"] {
    /* Text - High contrast grey/white */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8; /* Bumped from #64748b for better accessibility (WCAG 4.5:1) */
    
    /* Semantic Colors - Brighter versions for Dark Mode */
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
    --primary-light: #93c5fd;

    /* Borders */
    --border-color: #334155;
    
    /* Overlays/Modals */
    --modal-overlay: rgba(0, 0, 0, 0.85);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);

    /* Checkboxes & Radios */
    --check-border: rgba(255, 255, 255, 0.6); /* Increased contrast */
    --check-bg: rgba(255, 255, 255, 0.08);
}

:root {
    --check-border: #94a3b8; /* Solid gray for high contrast in light theme */
    --check-bg: #ffffff;
    --primary-rgb: 59, 130, 246;
    --success-rgb: 34, 197, 94;
    --warning-rgb: 245, 158, 11;
    --danger-rgb: 239, 68, 68;
}

[data-theme="dark"] {
    /* Backgrounds - Pure dark for battery saving */
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2a2a2a;
    
    /* Semantic Colors - Brighter for Dark */
    --primary-rgb: 96, 165, 250;
    --success-rgb: 74, 222, 128;
    --warning-rgb: 251, 191, 36;
    --danger-rgb: 248, 113, 113;

    /* Inputs - Darker with white text */
    --input-bg: #2a2a2a;
    --input-border: #475569;
    --input-text: #f8fafc;

    /* Floating Icons Background */
    --bg-floating: #2a2a2a;
}

[data-theme="dark-blue"] {
    /* Backgrounds - Deep Blue / Navy */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    
    /* Semantic Colors - Brighter for Dark Blue */
    --primary-rgb: 96, 165, 250;
    --success-rgb: 74, 222, 128;
    --warning-rgb: 251, 191, 36;
    --danger-rgb: 248, 113, 113;

    /* Inputs */
    --input-bg: #1e293b;
    --input-border: #475569;
    --input-text: #f8fafc;

    /* Overlays/Modals */
    --modal-overlay: rgba(15, 23, 42, 0.9);

    /* Floating Icons Background */
    --bg-floating: #1e293b;
}

/* Base adjustment for global background when in dark mode */
[data-theme="dark"] body,
[data-theme="dark-blue"] body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Force dark backgrounds on all core containers */
[data-theme="dark"] .dashboard-container,
[data-theme="dark-blue"] .dashboard-container,
[data-theme="dark"] .management-view,
[data-theme="dark-blue"] .management-view,
[data-theme="dark"] .treinos-view,
[data-theme="dark-blue"] .treinos-view,
[data-theme="dark"] .clients-view,
[data-theme="dark-blue"] .clients-view,
[data-theme="dark"] .app-header,
[data-theme="dark-blue"] .app-header,
[data-theme="dark"] .bottom-nav,
[data-theme="dark-blue"] .bottom-nav,
[data-theme="dark"] .modal-content,
[data-theme="dark-blue"] .modal-content,
[data-theme="dark"] .tab-panel,
[data-theme="dark-blue"] .tab-panel,
[data-theme="dark"] .tab-content,
[data-theme="dark-blue"] .tab-content,
[data-theme="dark"] .form-section,
[data-theme="dark-blue"] .form-section,
[data-theme="dark"] .report-table-container,
[data-theme="dark-blue"] .report-table-container,
[data-theme="dark"] .plan-modal,
[data-theme="dark-blue"] .plan-modal,
[data-theme="dark"] .exercises-header,
[data-theme="dark-blue"] .exercises-header,
[data-theme="dark"] .add-exercise-footer,
[data-theme="dark-blue"] .add-exercise-footer {
    background-color: var(--bg-primary) !important;
    background: var(--bg-primary) !important;
}

/* Specific card adjustments */
[data-theme="dark"] .card, 
[data-theme="dark-blue"] .card,
[data-theme="dark"] .exercise-card,
[data-theme="dark-blue"] .exercise-card,
[data-theme="dark"] .plan-card,
[data-theme="dark-blue"] .plan-card,
[data-theme="dark"] .report-total-card,
[data-theme="dark-blue"] .report-total-card,
[data-theme="dark"] .history-card,
[data-theme="dark-blue"] .history-card,
[data-theme="dark"] .settings-section .card,
[data-theme="dark-blue"] .settings-section .card,
[data-theme="dark"] .todo-list-container .card,
[data-theme="dark-blue"] .todo-list-container .card,
[data-theme="dark"] .sortable-item,
[data-theme="dark-blue"] .sortable-item,
[data-theme="dark"] .exercise-container,
[data-theme="dark-blue"] .exercise-container,
[data-theme="dark"] .pesagem-card,
[data-theme="dark-blue"] .pesagem-card,
[data-theme="dark"] .pesagem-list-card,
[data-theme="dark-blue"] .pesagem-list-card,
[data-theme="dark"] .historico-card,
[data-theme="dark-blue"] .historico-card {
    background-color: var(--bg-secondary) !important;
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    box-shadow: var(--card-shadow);
}

/* Table adjustments */
[data-theme="dark"] table,
[data-theme="dark-blue"] table,
[data-theme="dark"] .table,
[data-theme="dark-blue"] .table,
[data-theme="dark"] .report-table,
[data-theme="dark-blue"] .report-table,
[data-theme="dark"] .report-table tbody tr,
[data-theme="dark-blue"] .report-table tbody tr {
    background-color: var(--bg-secondary) !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .report-table tbody tr:nth-child(even),
[data-theme="dark-blue"] .report-table tbody tr:nth-child(even),
[data-theme="dark"] .report-table tbody tr:nth-child(odd),
[data-theme="dark-blue"] .report-table tbody tr:nth-child(odd) {
    background-color: var(--bg-secondary) !important;
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] .report-table thead tr,
[data-theme="dark-blue"] .report-table thead tr {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--bg-secondary) 100%) !important;
}

/* Fix for zebra stripes in Management View */
[data-theme="dark"] .report-table tbody tr:nth-child(odd),
[data-theme="dark-blue"] .report-table tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03) !important;
}

[data-theme="dark"] .report-table tbody tr:nth-child(even),
[data-theme="dark-blue"] .report-table tbody tr:nth-child(even) {
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] .report-table th,
[data-theme="dark-blue"] .report-table th,
[data-theme="dark"] .report-table td,
[data-theme="dark-blue"] .report-table td {
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .report-table tfoot tr,
[data-theme="dark-blue"] .report-table tfoot tr {
    background: var(--bg-tertiary) !important;
}

/* Form controls and inputs */
[data-theme="dark"] .form-control,
[data-theme="dark-blue"] .form-control,
[data-theme="dark"] .todo-input,
[data-theme="dark-blue"] .todo-input,
[data-theme="dark"] .manual-rep-tempo,
[data-theme="dark-blue"] .manual-rep-tempo,
[data-theme="dark"] .peso-value,
[data-theme="dark-blue"] .peso-value,
[data-theme="dark"] .form-input,
[data-theme="dark-blue"] .form-input,
[data-theme="dark"] .exercicio.form-control-sm,
[data-theme="dark-blue"] .exercicio.form-control-sm,
[data-theme="dark"] .observacao-texto,
[data-theme="dark-blue"] .observacao-texto,
[data-theme="dark"] select,
[data-theme="dark-blue"] select,
[data-theme="dark"] textarea,
[data-theme="dark-blue"] textarea {
    background-color: var(--input-bg) !important;
    background: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--input-text) !important;
}

[data-theme="dark"] .unit-select,
[data-theme="dark-blue"] .unit-select,
[data-theme="dark"] .unit-select option,
[data-theme="dark-blue"] .unit-select option {
    background-color: var(--bg-tertiary) !important;
}

/* Collapse / Accordion / Headers */
[data-theme="dark"] .collapse-header,
[data-theme="dark-blue"] .collapse-header,
[data-theme="dark"] .accordion-button,
[data-theme="dark-blue"] .accordion-button,
[data-theme="dark"] .client-group-header,
[data-theme="dark-blue"] .client-group-header,
[data-theme="dark"] .pesagem-header,
[data-theme="dark-blue"] .pesagem-header,
[data-theme="dark"] .pesagem-list-header,
[data-theme="dark-blue"] .pesagem-list-header,
[data-theme="dark"] .historico-header,
[data-theme="dark-blue"] .historico-header,
[data-theme="dark"] .picker-group-header,
[data-theme="dark-blue"] .picker-group-header,
[data-theme="dark"] .add-exercise-header,
[data-theme="dark-blue"] .add-exercise-header {
    background-color: var(--bg-tertiary) !important;
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .collapse-body,
[data-theme="dark-blue"] .collapse-body,
[data-theme="dark"] .accordion-body,
[data-theme="dark-blue"] .accordion-body,
[data-theme="dark"] .pesagem-body,
[data-theme="dark-blue"] .pesagem-body,
[data-theme="dark"] .pesagem-list-body,
[data-theme="dark-blue"] .pesagem-list-body,
[data-theme="dark"] .historico-body,
[data-theme="dark-blue"] .historico-body,
[data-theme="dark"] .picker-group-list,
[data-theme="dark-blue"] .picker-group-list {
    background-color: var(--bg-secondary) !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* Modal and Overlays */
[data-theme="dark"] .modal-header,
[data-theme="dark-blue"] .modal-header,
[data-theme="dark"] .modal-footer,
[data-theme="dark-blue"] .modal-footer,
[data-theme="dark"] .custom-modal,
[data-theme="dark-blue"] .custom-modal,
[data-theme="dark"] .exercise-picker-modal,
[data-theme="dark-blue"] .exercise-picker-modal {
    background-color: var(--bg-secondary) !important;
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .modal-body,
[data-theme="dark-blue"] .modal-body,
[data-theme="dark"] .picker-search,
[data-theme="dark-blue"] .picker-search {
    background-color: var(--bg-primary) !important;
    background: var(--bg-primary) !important;
}

/* Buttons and UI Elements */
[data-theme="dark"] .btn-secondary,
[data-theme="dark-blue"] .btn-secondary,
[data-theme="dark"] .modal-btn-secondary,
[data-theme="dark-blue"] .modal-btn-secondary,
[data-theme="dark"] .confirm-modal-content .btn-secondary,
[data-theme="dark-blue"] .confirm-modal-content .btn-secondary {
    background-color: var(--bg-tertiary) !important;
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark-blue"] .btn-secondary:hover,
[data-theme="dark"] .modal-btn-secondary:hover,
[data-theme="dark-blue"] .modal-btn-secondary:hover,
[data-theme="dark"] .confirm-modal-content .btn-secondary:hover,
[data-theme="dark-blue"] .confirm-modal-content .btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
}

/* Specific button styles for clarity */
[data-theme="dark"] .btn-light,
[data-theme="dark-blue"] .btn-light,
[data-theme="dark"] .btn-sm,
[data-theme="dark-blue"] .btn-sm,
[data-theme="dark"] .btn-mini,
[data-theme="dark-blue"] .btn-mini,
[data-theme="dark"] .btn-close,
[data-theme="dark-blue"] .btn-close,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark-blue"] .dropdown-menu,
[data-theme="dark"] .dropdown-item,
[data-theme="dark-blue"] .dropdown-item,
[data-theme="dark"] .history-popover,
[data-theme="dark-blue"] .history-popover,
[data-theme="dark"] .weight-history-popover,
[data-theme="dark-blue"] .weight-history-popover {
    background-color: var(--bg-tertiary) !important;
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .history-popover-header,
[data-theme="dark-blue"] .history-popover-header {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .history-popover table td,
[data-theme="dark-blue"] .history-popover table td,
[data-theme="dark"] .weight-history-popover table td,
[data-theme="dark-blue"] .weight-history-popover table td {
    background: transparent !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .history-empty,
[data-theme="dark-blue"] .history-empty {
    background: var(--bg-tertiary) !important;
    color: var(--text-muted) !important;
}

/* Badges adjustments - Fix white background on training count */
[data-theme="dark"] .badge,
[data-theme="dark-blue"] .badge,
[data-theme="dark"] .badge-primary,
[data-theme="dark-blue"] .badge-primary,
[data-theme="dark"] .management-tab .badge,
[data-theme="dark-blue"] .management-tab .badge,
[data-theme="dark"] .historico-badges .badge,
[data-theme="dark-blue"] .historico-badges .badge {
    background-color: var(--primary-dark) !important;
    color: white !important;
    border: none !important;
}

[data-theme="dark"] .badge-secondary,
[data-theme="dark-blue"] .badge-secondary {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
}

/* Force dark header on all modals/cards */
[data-theme="dark"] .card-header,
[data-theme="dark-blue"] .card-header,
[data-theme="dark"] .modal-header,
[data-theme="dark-blue"] .modal-header {
    background-color: var(--bg-tertiary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark-blue"] .dropdown-item:hover,
[data-theme="dark"] .picker-exercise-item:hover,
[data-theme="dark-blue"] .picker-exercise-item:hover {
    background-color: var(--primary) !important;
    color: white !important;
}

/* Bottom Navigation Contrast */
[data-theme="dark"] .bottom-nav .nav-item,
[data-theme="dark-blue"] .bottom-nav .nav-item {
    color: #94a3b8 !important; /* var(--text-muted) is too dark, using a lighter gray */
}

[data-theme="dark"] .bottom-nav .nav-item.active,
[data-theme="dark-blue"] .bottom-nav .nav-item.active {
    color: #60a5fa !important; /* Lighter blue for better contrast */
}

/* Audit Groups Contrast */
[data-theme="dark"] .audit-group,
[data-theme="dark-blue"] .audit-group {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .audit-group[style*="rgba(239, 68, 68"],
[data-theme="dark-blue"] .audit-group[style*="rgba(239, 68, 68"] {
    background: rgba(239, 68, 68, 0.15) !important;
    border-left-color: #f87171 !important;
}

[data-theme="dark"] .audit-group[style*="rgba(245, 158, 11"],
[data-theme="dark-blue"] .audit-group[style*="rgba(245, 158, 11"] {
    background: rgba(245, 158, 11, 0.15) !important;
    border-left-color: #fbbf24 !important;
}

[data-theme="dark"] .audit-group[style*="rgba(6, 182, 212"],
[data-theme="dark-blue"] .audit-group[style*="rgba(6, 182, 212"] {
    background: rgba(6, 182, 212, 0.15) !important;
    border-left-color: #22d3ee !important;
}

[data-theme="dark"] .audit-group[style*="rgba(139, 92, 246"],
[data-theme="dark-blue"] .audit-group[style*="rgba(139, 92, 246"] {
    background: rgba(139, 92, 246, 0.15) !important;
    border-left-color: #a78bfa !important;
}


/* Sortable Draggable Items */
[data-theme="dark"] .sortable-drag,
[data-theme="dark-blue"] .sortable-drag,
[data-theme="dark"] .sortable-fallback,
[data-theme="dark-blue"] .sortable-fallback {
    background-color: var(--bg-tertiary) !important;
    background: var(--bg-tertiary) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .handle-container,
[data-theme="dark-blue"] .handle-container,
[data-theme="dark"] .delete-button-container,
[data-theme="dark-blue"] .delete-button-container {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

/* Labels and Small Text */
[data-theme="dark"] label,
[data-theme="dark-blue"] label,
[data-theme="dark"] .text-muted,
[data-theme="dark-blue"] .text-muted,
[data-theme="dark"] .settings-item-value,
[data-theme="dark-blue"] .settings-item-value,
[data-theme="dark"] .report-total-label,
[data-theme="dark-blue"] .report-total-label,
[data-theme="dark"] .exercise-count,
[data-theme="dark-blue"] .exercise-count,
[data-theme="dark"] .historico-meta,
[data-theme="dark-blue"] .historico-meta,
[data-theme="dark"] .pesagem-list-meta,
[data-theme="dark-blue"] .pesagem-list-meta {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] h1, [data-theme="dark-blue"] h1,
[data-theme="dark"] h2, [data-theme="dark-blue"] h2,
[data-theme="dark"] h3, [data-theme="dark-blue"] h3,
[data-theme="dark"] h4, [data-theme="dark-blue"] h4,
[data-theme="dark"] .modal-title, [data-theme="dark-blue"] .modal-title,
[data-theme="dark"] .plan-modal-title, [data-theme="dark-blue"] .plan-modal-title {
    color: var(--text-primary) !important;
}

/* Scrollbar styling for dark mode (Webkit) */
[data-theme="dark"] ::-webkit-scrollbar,
[data-theme="dark-blue"] ::-webkit-scrollbar {
    width: 8px;
}
[data-theme="dark"] ::-webkit-scrollbar-track,
[data-theme="dark-blue"] ::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb,
[data-theme="dark-blue"] ::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover,
[data-theme="dark-blue"] ::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Services Stats Cards - Dark Theme */
[data-theme="dark"] .services-stats .stat-card.stat-suspensao,
[data-theme="dark-blue"] .services-stats .stat-card.stat-suspensao {
    background: rgba(245, 158, 11, 0.15) !important;
}
[data-theme="dark"] .services-stats .stat-card.stat-suspensao .stat-value,
[data-theme="dark-blue"] .services-stats .stat-card.stat-suspensao .stat-value,
[data-theme="dark"] .services-stats .stat-card.stat-suspensao .stat-label,
[data-theme="dark-blue"] .services-stats .stat-card.stat-suspensao .stat-label {
    color: #fbbf24 !important;
}

[data-theme="dark"] .services-stats .stat-card.stat-alteracao,
[data-theme="dark-blue"] .services-stats .stat-card.stat-alteracao {
    background: rgba(59, 130, 246, 0.15) !important;
}
[data-theme="dark"] .services-stats .stat-card.stat-alteracao .stat-value,
[data-theme="dark-blue"] .services-stats .stat-card.stat-alteracao .stat-value,
[data-theme="dark"] .services-stats .stat-card.stat-alteracao .stat-label,
[data-theme="dark-blue"] .services-stats .stat-card.stat-alteracao .stat-label {
    color: #60a5fa !important;
}

[data-theme="dark"] .services-stats .stat-card.stat-cancelamento,
[data-theme="dark-blue"] .services-stats .stat-card.stat-cancelamento {
    background: rgba(239, 68, 68, 0.15) !important;
}
[data-theme="dark"] .services-stats .stat-card.stat-cancelamento .stat-value,
[data-theme="dark-blue"] .services-stats .stat-card.stat-cancelamento .stat-value,
[data-theme="dark"] .services-stats .stat-card.stat-cancelamento .stat-label,
[data-theme="dark-blue"] .services-stats .stat-card.stat-cancelamento .stat-label {
    color: #f87171 !important;
}

/* Flatpickr Calendar - Dark Theme */
[data-theme="dark"] .flatpickr-calendar,
[data-theme="dark-blue"] .flatpickr-calendar {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .flatpickr-months,
[data-theme="dark-blue"] .flatpickr-months {
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] .flatpickr-months .flatpickr-month,
[data-theme="dark-blue"] .flatpickr-months .flatpickr-month {
    background: var(--bg-secondary) !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months,
[data-theme="dark-blue"] .flatpickr-current-month .flatpickr-monthDropdown-months {
    background: var(--bg-secondary) !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months option,
[data-theme="dark-blue"] .flatpickr-current-month .flatpickr-monthDropdown-months option {
    background: var(--bg-secondary) !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .flatpickr-current-month input.cur-year,
[data-theme="dark-blue"] .flatpickr-current-month input.cur-year {
    color: #f8fafc !important;
}

[data-theme="dark"] .flatpickr-months .flatpickr-prev-month,
[data-theme="dark-blue"] .flatpickr-months .flatpickr-prev-month,
[data-theme="dark"] .flatpickr-months .flatpickr-next-month,
[data-theme="dark-blue"] .flatpickr-months .flatpickr-next-month {
    color: #cbd5e1 !important;
    fill: #cbd5e1 !important;
}

[data-theme="dark"] .flatpickr-months .flatpickr-prev-month svg,
[data-theme="dark-blue"] .flatpickr-months .flatpickr-prev-month svg,
[data-theme="dark"] .flatpickr-months .flatpickr-next-month svg,
[data-theme="dark-blue"] .flatpickr-months .flatpickr-next-month svg {
    fill: #cbd5e1 !important;
}

[data-theme="dark"] .flatpickr-months .flatpickr-prev-month:hover,
[data-theme="dark-blue"] .flatpickr-months .flatpickr-prev-month:hover,
[data-theme="dark"] .flatpickr-months .flatpickr-next-month:hover,
[data-theme="dark-blue"] .flatpickr-months .flatpickr-next-month:hover {
    color: #f8fafc !important;
}

[data-theme="dark"] .flatpickr-months .flatpickr-prev-month:hover svg,
[data-theme="dark-blue"] .flatpickr-months .flatpickr-prev-month:hover svg,
[data-theme="dark"] .flatpickr-months .flatpickr-next-month:hover svg,
[data-theme="dark-blue"] .flatpickr-months .flatpickr-next-month:hover svg {
    fill: #f8fafc !important;
}

[data-theme="dark"] .flatpickr-innerContainer,
[data-theme="dark-blue"] .flatpickr-innerContainer {
    background: var(--bg-secondary) !important;
    border-bottom: none !important;
}

[data-theme="dark"] .flatpickr-rContainer,
[data-theme="dark-blue"] .flatpickr-rContainer {
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] .flatpickr-weekdays,
[data-theme="dark-blue"] .flatpickr-weekdays {
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] span.flatpickr-weekday,
[data-theme="dark-blue"] span.flatpickr-weekday {
    color: #64748b !important;
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] .flatpickr-days,
[data-theme="dark-blue"] .flatpickr-days {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .dayContainer,
[data-theme="dark-blue"] .dayContainer {
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] .flatpickr-day,
[data-theme="dark-blue"] .flatpickr-day {
    color: #f8fafc !important;
    border-color: transparent !important;
}

[data-theme="dark"] .flatpickr-day:hover,
[data-theme="dark-blue"] .flatpickr-day:hover {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .flatpickr-day.today,
[data-theme="dark-blue"] .flatpickr-day.today {
    border-color: #3b82f6 !important;
}

[data-theme="dark"] .flatpickr-day.selected,
[data-theme="dark-blue"] .flatpickr-day.selected,
[data-theme="dark"] .flatpickr-day.startRange,
[data-theme="dark-blue"] .flatpickr-day.startRange,
[data-theme="dark"] .flatpickr-day.endRange,
[data-theme="dark-blue"] .flatpickr-day.endRange {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: white !important;
}

[data-theme="dark"] .flatpickr-day.inRange,
[data-theme="dark-blue"] .flatpickr-day.inRange {
    background: rgba(59, 130, 246, 0.2) !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
    box-shadow: -5px 0 0 rgba(59, 130, 246, 0.2), 5px 0 0 rgba(59, 130, 246, 0.2) !important;
}

[data-theme="dark"] .flatpickr-day.prevMonthDay,
[data-theme="dark-blue"] .flatpickr-day.prevMonthDay,
[data-theme="dark"] .flatpickr-day.nextMonthDay,
[data-theme="dark-blue"] .flatpickr-day.nextMonthDay {
    color: #475569 !important;
}

[data-theme="dark"] .flatpickr-day.flatpickr-disabled,
[data-theme="dark-blue"] .flatpickr-day.flatpickr-disabled,
[data-theme="dark"] .flatpickr-day.flatpickr-disabled:hover,
[data-theme="dark-blue"] .flatpickr-day.flatpickr-disabled:hover {
    color: var(--border-color) !important;
}

[data-theme="dark"] .flatpickr-time,
[data-theme="dark-blue"] .flatpickr-time {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .flatpickr-time input,
[data-theme="dark-blue"] .flatpickr-time input,
[data-theme="dark"] .flatpickr-time .flatpickr-am-pm,
[data-theme="dark-blue"] .flatpickr-time .flatpickr-am-pm {
    color: #f8fafc !important;
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] .flatpickr-time input:hover,
[data-theme="dark-blue"] .flatpickr-time input:hover,
[data-theme="dark"] .flatpickr-time .flatpickr-am-pm:hover,
[data-theme="dark-blue"] .flatpickr-time .flatpickr-am-pm:hover {
    background: var(--bg-tertiary) !important;
}

/* Native date/month input - Dark Theme */
[data-theme="dark"] input[type="date"],
[data-theme="dark-blue"] input[type="date"],
[data-theme="dark"] input[type="month"],
[data-theme="dark-blue"] input[type="month"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark-blue"] input[type="datetime-local"] {
    color-scheme: dark;
}

/* Checkbox and Radio visibility across all themes */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--check-border);
    border-radius: 4px;
    background: var(--check-bg);
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    transition: all 0.2s ease;
}

input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
    content: "\f00c";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 11px;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--check-border);
    border-radius: 50%;
    background: var(--check-bg);
    cursor: pointer;
    position: relative;
    vertical-align: middle;
}

input[type="radio"]:checked {
    border-color: var(--primary);
}

input[type="radio"]:checked::after {
    content: "";
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ============================================
   HEALTH ALERTS & PAR-Q THEME SUPPORT
   ============================================ */

.health-alert-card {
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.health-alert-card--critical {
    background-color: rgba(var(--danger-rgb), 0.08) !important;
    border-color: rgba(var(--danger-rgb), 0.3) !important;
}

.health-alert-card--warning {
    background-color: rgba(var(--warning-rgb), 0.08) !important;
    border-color: rgba(var(--warning-rgb), 0.3) !important;
}

.health-alert-card--info {
    background-color: rgba(var(--primary-rgb), 0.08) !important;
    border-color: rgba(var(--primary-rgb), 0.3) !important;
}

.health-alert-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.health-alert-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
}

.health-alert-icon {
    font-size: 1.125rem;
}

.health-alert-card--critical .health-alert-title,
.health-alert-card--critical .health-alert-icon {
    color: var(--danger) !important;
}

.health-alert-card--warning .health-alert-title,
.health-alert-card--warning .health-alert-icon {
    color: var(--warning) !important;
}

.health-alert-card--info .health-alert-title,
.health-alert-card--info .health-alert-icon {
    color: var(--info) !important;
}

.health-alert-list {
    margin: 0;
    padding-left: 20px;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.health-alert-card--critical .health-alert-list {
    color: var(--danger) !important;
    opacity: 0.9;
}

.health-alert-card--warning .health-alert-list {
    color: var(--warning) !important;
    opacity: 0.9;
}

.health-alert-note {
    margin-top: 8px;
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .health-alert-note,
[data-theme="dark-blue"] .health-alert-note {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

/* Form-specific alert boxes (Clients View) */
.parq-section-box {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.parq-group-box {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid transparent;
}

.parq-group-box--critical {
    background: rgba(var(--danger-rgb), 0.08);
    border-color: rgba(var(--danger-rgb), 0.2);
}

.parq-group-box--warning {
    background: rgba(var(--warning-rgb), 0.08);
    border-color: rgba(var(--warning-rgb), 0.2);
}

.parq-group-box--info {
    background: rgba(var(--primary-rgb), 0.08);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.parq-group-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.parq-group-box--critical .parq-group-title { color: var(--danger); }
.parq-group-box--warning .parq-group-title { color: var(--warning); }
.parq-group-box--info .parq-group-title { color: var(--info); }

/* Common SweetAlert2 adjustments */
.swal2-popup {
    border-radius: 16px !important;
    padding: 2rem !important;
    font-family: 'Inter', sans-serif !important;
}

.swal2-title {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
}

.swal2-input {
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    height: 3rem !important;
}

.swal2-actions {
    gap: 12px !important;
    width: 100% !important;
    margin-top: 1.5rem !important;
}

.swal2-confirm, .swal2-cancel {
    border-radius: 8px !important;
    font-size: 0.9375rem !important;
    font-weight: 500 !important;
    padding: 12px 24px !important;
    margin: 0 !important;
    flex: 1 !important;
}

/* Light Theme (Default) Swal Adjustments */
:root .swal2-cancel {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
}

:root .swal2-cancel:hover {
    background-color: #e2e8f0 !important;
}

/* Dark and Dark-Blue Theme Swal Overrides */
[data-theme="dark"] .swal2-popup,
[data-theme="dark-blue"] .swal2-popup {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .swal2-title,
[data-theme="dark-blue"] .swal2-title,
[data-theme="dark"] .swal2-html-container,
[data-theme="dark-blue"] .swal2-html-container,
[data-theme="dark"] .swal2-input-label,
[data-theme="dark-blue"] .swal2-input-label {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .swal2-input,
[data-theme="dark-blue"] .swal2-input {
    background-color: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--input-border) !important;
    box-shadow: none !important;
}

[data-theme="dark"] .swal2-input:focus,
[data-theme="dark-blue"] .swal2-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

[data-theme="dark"] .swal2-input::placeholder,
[data-theme="dark-blue"] .swal2-input::placeholder {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .swal2-confirm,
[data-theme="dark-blue"] .swal2-confirm {
    background-color: var(--primary) !important;
    color: white !important;
}

[data-theme="dark"] .swal2-cancel,
[data-theme="dark-blue"] .swal2-cancel {
    background-color: rgba(255, 255, 255, 0.08) !important; /* Semi-transparent white for better contrast on all dark backgrounds */
    color: var(--text-primary) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

[data-theme="dark"] .swal2-cancel:hover,
[data-theme="dark-blue"] .swal2-cancel:hover {
    background-color: rgba(255, 255, 255, 0.12) !important;
}

[data-theme="dark"] .swal2-validation-message,
[data-theme="dark-blue"] .swal2-validation-message {
    background-color: var(--bg-tertiary) !important;
    color: #f87171 !important;
}

[data-theme="dark"] .swal2-close,
[data-theme="dark-blue"] .swal2-close {
    color: var(--text-muted) !important;
}
