/* Theme System for Piogino Meetup App - COMPREHENSIVE DARK MODE FIX WITH IMPROVED COLORS + FAVORITES + ICS DOWNLOAD - ENHANCED */

/* Theme Transition Class */
.theme-transition,
.theme-transition *,
.theme-transition *:before,
.theme-transition *:after {
    transition: 
        background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease,
        backdrop-filter 0.3s ease !important;
}

/* Light Theme (explicit) - DEFAULT */
:root,
[data-theme="light"],
.theme-light {
    --primary-color: #6366f1;
    --primary-hover: #5b5bf6;
    --secondary-color: #6b7280;
    --secondary-hover: #5b6270;
    --success-color: #10b981;
    --success-hover: #059669;
    --accent-color: #8b5cf6;
    --accent-hover: #7c3aed;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --favorite-color: #eab308;
    --favorite-hover: #ca8a04;
    --download-color: #3b82f6;
    --download-hover: #2563eb;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    
    --border-color: #d1d5db;
    --border-focus: var(--primary-color);
}

[data-theme="light"] body,
.theme-light body {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

/* Dark Theme - COMPREHENSIVE FIX */
[data-theme="dark"],
.theme-dark {
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --secondary-color: #9ca3af;
    --secondary-hover: #6b7280;
    --success-color: #34d399;
    --success-hover: #10b981;
    --accent-color: #a78bfa;
    --accent-hover: #8b5cf6;
    --warning-color: #fbbf24;
    --error-color: #f87171;
    --favorite-color: #fbbf24; /* Brighter yellow for dark theme */
    --favorite-hover: #f59e0b;
    --download-color: #60a5fa; /* Brighter blue for dark theme */
    --download-hover: #3b82f6;
    
    --bg-primary: #1f2937;
    --bg-secondary: #374151;
    --bg-tertiary: #4b5563;
    
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
    
    --border-color: #4b5563;
    --border-focus: var(--primary-color);
}

[data-theme="dark"] body,
.theme-dark body {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%) !important;
}

/* COMPREHENSIVE DARK MODE FIXES */

/* Main containers */
[data-theme="dark"] .bg-white,
[data-theme="dark"] #homeScreen,
[data-theme="dark"] #createdScreen,
[data-theme="dark"] #meetupScreen,
.theme-dark .bg-white,
.theme-dark #homeScreen,
.theme-dark #createdScreen,
.theme-dark #meetupScreen {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

/* All gray backgrounds */
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-gray-100,
.theme-dark .bg-gray-50,
.theme-dark .bg-gray-100 {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* Section cards */
[data-theme="dark"] .section-card,
[data-theme="dark"] .card-enhanced,
[data-theme="dark"] .proposal-card,
.theme-dark .section-card,
.theme-dark .card-enhanced,
.theme-dark .proposal-card {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* All text colors */
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-600,
.theme-dark .text-gray-900,
.theme-dark .text-gray-800,
.theme-dark .text-gray-700,
.theme-dark .text-gray-600 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-gray-400,
.theme-dark .text-gray-500,
.theme-dark .text-gray-400 {
    color: var(--text-secondary) !important;
}

/* IMPROVED: Proposal time colors for better dark mode visibility */
[data-theme="dark"] .text-indigo-600,
.theme-dark .text-indigo-600 {
    color: #93c5fd !important; /* Much brighter blue for proposal times */
}

[data-theme="dark"] .text-indigo-700,
.theme-dark .text-indigo-700 {
    color: #bfdbfe !important; /* Even brighter for "today" proposals */
}

[data-theme="dark"] .text-indigo-900,
.theme-dark .text-indigo-900 {
    color: #dbeafe !important; /* Brightest for today's date text */
}

/* IMPROVED: Message sender names in bright purple for better readability */
[data-theme="dark"] .border-l-4.border-indigo-500 .text-indigo-600,
[data-theme="dark"] #messagesList .text-indigo-600,
.theme-dark .border-l-4.border-indigo-500 .text-indigo-600,
.theme-dark #messagesList .text-indigo-600 {
    color: #c084fc !important; /* Bright purple for message sender names */
}

/* Headings */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
.theme-dark h1,
.theme-dark h2,
.theme-dark h3,
.theme-dark h4,
.theme-dark h5,
.theme-dark h6 {
    color: var(--text-primary) !important;
}

/* Input fields */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select,
.theme-dark input,
.theme-dark textarea,
.theme-dark select {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

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

/* Buttons */
[data-theme="dark"] .bg-indigo-600,
.theme-dark .bg-indigo-600 {
    background: var(--primary-color) !important;
}

[data-theme="dark"] .bg-indigo-600:hover,
.theme-dark .bg-indigo-600:hover {
    background: var(--primary-hover) !important;
}

[data-theme="dark"] .bg-green-600,
.theme-dark .bg-green-600 {
    background: var(--success-color) !important;
}

[data-theme="dark"] .bg-green-600:hover,
.theme-dark .bg-green-600:hover {
    background: var(--success-hover) !important;
}

[data-theme="dark"] .bg-gray-600,
.theme-dark .bg-gray-600 {
    background: var(--bg-tertiary) !important;
}

[data-theme="dark"] .bg-gray-600:hover,
.theme-dark .bg-gray-600:hover {
    background: var(--secondary-color) !important;
}

/* NEW: Dark theme ICS download button styles */
[data-theme="dark"] .bg-blue-500,
[data-theme="dark"] .bg-blue-600,
.theme-dark .bg-blue-500,
.theme-dark .bg-blue-600 {
    background: var(--download-color) !important;
    color: var(--bg-primary) !important;
}

[data-theme="dark"] .bg-blue-500:hover,
[data-theme="dark"] .bg-blue-600:hover,
.theme-dark .bg-blue-500:hover,
.theme-dark .bg-blue-600:hover {
    background: var(--download-hover) !important;
}

[data-theme="dark"] .btn-download,
[data-theme="dark"] .ics-download-btn,
.theme-dark .btn-download,
.theme-dark .ics-download-btn {
    background: var(--download-color) !important;
    color: var(--bg-primary) !important;
}

[data-theme="dark"] .btn-download:hover,
[data-theme="dark"] .ics-download-btn:hover,
.theme-dark .btn-download:hover,
.theme-dark .ics-download-btn:hover {
    background: var(--download-hover) !important;
}

/* Dark theme favorite/star button styles */
[data-theme="dark"] .bg-yellow-500,
[data-theme="dark"] .bg-yellow-600,
.theme-dark .bg-yellow-500,
.theme-dark .bg-yellow-600 {
    background: var(--favorite-color) !important;
    color: var(--bg-primary) !important; /* Dark text on bright yellow */
}

[data-theme="dark"] .bg-yellow-500:hover,
[data-theme="dark"] .bg-yellow-600:hover,
.theme-dark .bg-yellow-500:hover,
.theme-dark .bg-yellow-600:hover {
    background: var(--favorite-hover) !important;
}

[data-theme="dark"] .hover\\:bg-yellow-100,
.theme-dark .hover\\:bg-yellow-100 {
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] .hover\\:bg-yellow-100:hover,
.theme-dark .hover\\:bg-yellow-100:hover {
    background: rgba(251, 191, 36, 0.2) !important;
}

[data-theme="dark"] .border-yellow-400,
[data-theme="dark"] .hover\\:border-yellow-400,
.theme-dark .border-yellow-400,
.theme-dark .hover\\:border-yellow-400 {
    border-color: var(--favorite-color) !important;
}

[data-theme="dark"] .text-yellow-600,
[data-theme="dark"] .text-yellow-700,
[data-theme="dark"] .hover\\:text-yellow-700,
.theme-dark .text-yellow-600,
.theme-dark .text-yellow-700,
.theme-dark .hover\\:text-yellow-700 {
    color: var(--favorite-color) !important;
}

[data-theme="dark"] .hover\\:text-yellow-700:hover,
.theme-dark .hover\\:text-yellow-700:hover {
    color: var(--favorite-hover) !important;
}

/* ENHANCED: Dark theme favorite proposal backgrounds */
[data-theme="dark"] .bg-yellow-50,
.theme-dark .bg-yellow-50 {
    background: rgba(251, 191, 36, 0.15) !important;
    border: 2px solid rgba(251, 191, 36, 0.4) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.2), var(--shadow-md) !important;
}

[data-theme="dark"] .border-yellow-400,
.theme-dark .border-yellow-400 {
    border-color: var(--favorite-color) !important;
    border-width: 2px !important;
}

[data-theme="dark"] .border-yellow-200,
.theme-dark .border-yellow-200 {
    border-color: rgba(251, 191, 36, 0.4) !important;
}

/* ENHANCED: Dark theme star indicators */
[data-theme="dark"] .text-yellow-500,
.theme-dark .text-yellow-500 {
    color: var(--favorite-color) !important;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.7) !important;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6)) !important;
}

/* ENHANCED: Dark theme star count styling */
[data-theme="dark"] .star-count,
.theme-dark .star-count {
    background: rgba(251, 191, 36, 0.2) !important;
    color: var(--favorite-color) !important;
    border-color: rgba(251, 191, 36, 0.4) !important;
    box-shadow: 0 1px 3px rgba(251, 191, 36, 0.3) !important;
}

/* Borders */
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300,
[data-theme="dark"] .border,
.theme-dark .border-gray-200,
.theme-dark .border-gray-300,
.theme-dark .border {
    border-color: var(--border-color) !important;
}

/* Specific UI elements */
[data-theme="dark"] .success-icon,
.theme-dark .success-icon {
    background: rgba(52, 211, 153, 0.2) !important;
}

[data-theme="dark"] .participant-selection,
.theme-dark .participant-selection {
    background: rgba(129, 140, 248, 0.2) !important;
    border-color: rgba(129, 140, 248, 0.3) !important;
}

[data-theme="dark"] .proposal-card.today,
.theme-dark .proposal-card.today {
    background: rgba(129, 140, 248, 0.1) !important;
    border-color: var(--primary-color) !important;
}

/* Status badges */
[data-theme="dark"] .status-available,
.theme-dark .status-available {
    background: rgba(52, 211, 153, 0.2) !important;
    color: #6ee7b7 !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
}

[data-theme="dark"] .status-maybe,
.theme-dark .status-maybe {
    background: rgba(251, 191, 36, 0.2) !important;
    color: #fde047 !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
}

[data-theme="dark"] .status-unavailable,
.theme-dark .status-unavailable {
    background: rgba(248, 113, 113, 0.2) !important;
    color: #fca5a5 !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
}

/* Participant cards */
[data-theme="dark"] .participant-card,
.theme-dark .participant-card {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

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

[data-theme="dark"] .participant-card.bg-indigo-100,
.theme-dark .participant-card.bg-indigo-100 {
    background: rgba(129, 140, 248, 0.3) !important;
    border-color: var(--primary-color) !important;
}

/* Messages */
[data-theme="dark"] #messagesList > div,
.theme-dark #messagesList > div {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .border-l-4.border-indigo-500,
.theme-dark .border-l-4.border-indigo-500 {
    border-left-color: var(--primary-color) !important;
}

/* Calendar */
[data-theme="dark"] .calendar-day,
.theme-dark .calendar-day {
    border-color: var(--border-color) !important;
}

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

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

/* Modal */
[data-theme="dark"] #dayModal .bg-white,
.theme-dark #dayModal .bg-white {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] #dayModal .border-gray-300,
.theme-dark #dayModal .border-gray-300 {
    border-color: var(--border-color) !important;
}

/* Emote suggestions */
[data-theme="dark"] #emote-suggestions,
.theme-dark #emote-suggestions {
    background: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] #emote-suggestions::before,
.theme-dark #emote-suggestions::before {
    background: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
    border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .emote-suggestion:hover:not(.bg-indigo-600),
.theme-dark .emote-suggestion:hover:not(.bg-indigo-600) {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .emote-suggestion span,
.theme-dark .emote-suggestion span {
    color: var(--text-primary) !important;
}

/* Loading spinner */
[data-theme="dark"] .loading-spinner,
.theme-dark .loading-spinner {
    border-color: rgba(255, 255, 255, 0.3) !important;
    border-top-color: white !important;
}

/* Notifications */
[data-theme="dark"] .notification,
.theme-dark .notification {
    background: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Deleted Proposals - Dark Mode Fix */
[data-theme="dark"] .bg-red-50,
.theme-dark .bg-red-50 {
    background: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .border-red-200,
.theme-dark .border-red-200 {
    border-color: rgba(239, 68, 68, 0.4) !important;
}

[data-theme="dark"] .text-red-800,
.theme-dark .text-red-800 {
    color: #fca5a5 !important;
    font-weight: 600 !important;
}

[data-theme="dark"] .text-red-600,
.theme-dark .text-red-600 {
    color: #f87171 !important;
}

[data-theme="dark"] .text-red-500,
.theme-dark .text-red-500 {
    color: #ef4444 !important;
}

/* Better visual separation for deleted proposals */
[data-theme="dark"] .bg-red-50 > div,
.theme-dark .bg-red-50 > div {
    opacity: 0.9;
}

/* Fix other colored backgrounds in dark mode */
[data-theme="dark"] .bg-green-100,
.theme-dark .bg-green-100 {
    background: rgba(52, 211, 153, 0.15) !important;
}

[data-theme="dark"] .bg-blue-50,
.theme-dark .bg-blue-50 {
    background: rgba(129, 140, 248, 0.1) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-blue-600,
.theme-dark .text-blue-600 {
    color: #93c5fd !important;
}

/* Sepia Theme */
[data-theme="sepia"],
.theme-sepia {
    --primary-color: #8b4513;
    --primary-hover: #a0522d;
    --secondary-color: #696969;
    --secondary-hover: #556b2f;
    --success-color: #556b2f;
    --success-hover: #228b22;
    --accent-color: #cd853f;
    --accent-hover: #daa520;
    --warning-color: #daa520;
    --error-color: #b22222;
    --favorite-color: #daa520; /* Gold color for sepia theme */
    --favorite-hover: #b8860b;
    --download-color: #1e40af; /* Navy blue for sepia theme */
    --download-hover: #1e3a8a;
    
    --bg-primary: #fdf6e3;
    --bg-secondary: #f5e6d3;
    --bg-tertiary: #e6d5c0;
    
    --text-primary: #2f1b14;
    --text-secondary: #5d4e37;
    --text-tertiary: #8b7355;
    
    --border-color: #d2b48c;
    --border-focus: var(--primary-color);
}

[data-theme="sepia"] body,
.theme-sepia body {
    background: linear-gradient(135deg, #fdf6e3 0%, #f5e6d3 100%);
}

[data-theme="sepia"] .success-icon,
.theme-sepia .success-icon {
    background: rgba(85, 107, 47, 0.2);
}

[data-theme="sepia"] .participant-selection,
.theme-sepia .participant-selection {
    background: rgba(139, 69, 19, 0.1);
    border-color: rgba(139, 69, 19, 0.3);
}

[data-theme="sepia"] .proposal-card.today,
.theme-sepia .proposal-card.today {
    background: rgba(139, 69, 19, 0.05);
    border-color: var(--primary-color);
}

[data-theme="sepia"] .status-available,
.theme-sepia .status-available {
    background: rgba(85, 107, 47, 0.15);
    color: #556b2f;
    border-color: rgba(85, 107, 47, 0.3);
}

[data-theme="sepia"] .status-maybe,
.theme-sepia .status-maybe {
    background: rgba(218, 165, 32, 0.15);
    color: #b8860b;
    border-color: rgba(218, 165, 32, 0.3);
}

[data-theme="sepia"] .status-unavailable,
.theme-sepia .status-unavailable {
    background: rgba(178, 34, 34, 0.15);
    color: #8b0000;
    border-color: rgba(178, 34, 34, 0.3);
}

/* NEW: Sepia theme ICS download button styles */
[data-theme="sepia"] .bg-blue-500,
[data-theme="sepia"] .bg-blue-600,
.theme-sepia .bg-blue-500,
.theme-sepia .bg-blue-600 {
    background: var(--download-color) !important;
    color: var(--bg-primary) !important;
}

[data-theme="sepia"] .bg-blue-500:hover,
[data-theme="sepia"] .bg-blue-600:hover,
.theme-sepia .bg-blue-500:hover,
.theme-sepia .bg-blue-600:hover {
    background: var(--download-hover) !important;
}

[data-theme="sepia"] .btn-download,
[data-theme="sepia"] .ics-download-btn,
.theme-sepia .btn-download,
.theme-sepia .ics-download-btn {
    background: var(--download-color) !important;
    color: var(--bg-primary) !important;
}

[data-theme="sepia"] .btn-download:hover,
[data-theme="sepia"] .ics-download-btn:hover,
.theme-sepia .btn-download:hover,
.theme-sepia .ics-download-btn:hover {
    background: var(--download-hover) !important;
}

/* Sepia theme favorite/star styles */
[data-theme="sepia"] .bg-yellow-500,
[data-theme="sepia"] .bg-yellow-600,
.theme-sepia .bg-yellow-500,
.theme-sepia .bg-yellow-600 {
    background: var(--favorite-color) !important;
    color: var(--bg-primary) !important;
}

[data-theme="sepia"] .bg-yellow-500:hover,
[data-theme="sepia"] .bg-yellow-600:hover,
.theme-sepia .bg-yellow-500:hover,
.theme-sepia .bg-yellow-600:hover {
    background: var(--favorite-hover) !important;
}

[data-theme="sepia"] .hover\\:bg-yellow-100,
.theme-sepia .hover\\:bg-yellow-100 {
    background: var(--bg-secondary) !important;
}

[data-theme="sepia"] .hover\\:bg-yellow-100:hover,
.theme-sepia .hover\\:bg-yellow-100:hover {
    background: rgba(218, 165, 32, 0.2) !important;
}

[data-theme="sepia"] .border-yellow-400,
[data-theme="sepia"] .hover\\:border-yellow-400,
.theme-sepia .border-yellow-400,
.theme-sepia .hover\\:border-yellow-400 {
    border-color: var(--favorite-color) !important;
}

[data-theme="sepia"] .text-yellow-600,
[data-theme="sepia"] .text-yellow-700,
[data-theme="sepia"] .hover\\:text-yellow-700,
.theme-sepia .text-yellow-600,
.theme-sepia .text-yellow-700,
.theme-sepia .hover\\:text-yellow-700 {
    color: var(--favorite-color) !important;
}

[data-theme="sepia"] .hover\\:text-yellow-700:hover,
.theme-sepia .hover\\:text-yellow-700:hover {
    color: var(--favorite-hover) !important;
}

/* ENHANCED: Sepia theme favorite proposal backgrounds */
[data-theme="sepia"] .bg-yellow-50,
.theme-sepia .bg-yellow-50 {
    background: rgba(218, 165, 32, 0.12) !important;
    border: 2px solid rgba(218, 165, 32, 0.3) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 0 1px rgba(218, 165, 32, 0.2), var(--shadow-md) !important;
}

[data-theme="sepia"] .border-yellow-400,
.theme-sepia .border-yellow-400 {
    border-color: var(--favorite-color) !important;
    border-width: 2px !important;
}

[data-theme="sepia"] .border-yellow-200,
.theme-sepia .border-yellow-200 {
    border-color: rgba(218, 165, 32, 0.3) !important;
}

/* ENHANCED: Sepia theme star indicators */
[data-theme="sepia"] .text-yellow-500,
.theme-sepia .text-yellow-500 {
    color: var(--favorite-color) !important;
    text-shadow: 0 0 8px rgba(218, 165, 32, 0.6) !important;
}

/* ENHANCED: Sepia theme star count styling */
[data-theme="sepia"] .star-count,
.theme-sepia .star-count {
    background: rgba(218, 165, 32, 0.2) !important;
    color: var(--favorite-color) !important;
    border-color: rgba(218, 165, 32, 0.4) !important;
    box-shadow: 0 1px 3px rgba(218, 165, 32, 0.3) !important;
}

/* Calendar sepia adjustments */
[data-theme="sepia"] .calendar-day,
.theme-sepia .calendar-day {
    border-color: #d2b48c;
}

[data-theme="sepia"] .calendar-day.neutral,
.theme-sepia .calendar-day.neutral {
    background-color: #e6d5c0;
    color: #8b7355;
    border-color: #d2b48c;
}

[data-theme="sepia"] .calendar-day.other-month,
.theme-sepia .calendar-day.other-month {
    background-color: #f5e6d3;
    color: #a0956b;
}

/* Deleted Proposals - Sepia Mode */
[data-theme="sepia"] .bg-red-50,
.theme-sepia .bg-red-50 {
    background: rgba(178, 34, 34, 0.08) !important;
    border: 1px solid rgba(178, 34, 34, 0.2) !important;
    color: var(--text-primary) !important;
}

[data-theme="sepia"] .border-red-200,
.theme-sepia .border-red-200 {
    border-color: rgba(178, 34, 34, 0.3) !important;
}

[data-theme="sepia"] .text-red-800,
.theme-sepia .text-red-800 {
    color: #8b0000 !important;
    font-weight: 600 !important;
}

[data-theme="sepia"] .text-red-600,
.theme-sepia .text-red-600 {
    color: #b22222 !important;
}

[data-theme="sepia"] .text-red-500,
.theme-sepia .text-red-500 {
    color: #dc143c !important;
}

/* Better visual separation for deleted proposals in sepia */
[data-theme="sepia"] .bg-red-50 > div,
.theme-sepia .bg-red-50 > div {
    opacity: 0.9;
}

/* Fix other colored backgrounds in sepia mode */
[data-theme="sepia"] .bg-green-100,
.theme-sepia .bg-green-100 {
    background: rgba(85, 107, 47, 0.15) !important;
}

[data-theme="sepia"] .bg-blue-50,
.theme-sepia .bg-blue-50 {
    background: rgba(139, 69, 19, 0.08) !important;
    color: var(--text-primary) !important;
}

[data-theme="sepia"] .text-blue-600,
.theme-sepia .text-blue-600 {
    color: #8b4513 !important;
}

/* Warning and error state improvements */
[data-theme="dark"] .bg-yellow-50,
.theme-dark .bg-yellow-50 {
    background: rgba(251, 191, 36, 0.1) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-yellow-600,
[data-theme="dark"] .text-yellow-700,
.theme-dark .text-yellow-600,
.theme-dark .text-yellow-700 {
    color: #fbbf24 !important;
}

[data-theme="sepia"] .bg-yellow-50,
.theme-sepia .bg-yellow-50 {
    background: rgba(218, 165, 32, 0.1) !important;
    color: var(--text-primary) !important;
}

[data-theme="sepia"] .text-yellow-600,
[data-theme="sepia"] .text-yellow-700,
.theme-sepia .text-yellow-600,
.theme-sepia .text-yellow-700 {
    color: #daa520 !important;
}

/* Theme Switcher Specific Styles */
#themeSwitcher {
    user-select: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#themeSwitcher button {
    user-select: none;
    border: none;
    outline: none;
    cursor: pointer;
}

#themeSwitcher button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth transitions for all themed elements */
body,
.card-enhanced,
.section-card,
.proposal-card,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-accent,
.btn-download,
.ics-download-btn,
.input-primary,
.notification,
#themeSwitcher {
    transition: 
        background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

/* Accessibility: Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .theme-transition,
    .theme-transition *,
    .theme-transition *:before,
    .theme-transition *:after {
        transition: none !important;
    }
    
    #themeSwitcher {
        transition: none !important;
    }
    
    .star-indicator {
        animation: none !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
        --bg-secondary: #ffffff;
        --bg-tertiary: #f0f0f0;
        --favorite-color: #ffff00; /* Bright yellow for high contrast */
        --favorite-hover: #cccc00;
        --download-color: #0000ff; /* Bright blue for high contrast */
        --download-hover: #000080;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-accent,
    .btn-download,
    .ics-download-btn {
        border: 2px solid #000000;
    }
    
    .input-primary {
        border: 2px solid #000000;
    }
    
    .card-enhanced,
    .section-card,
    .proposal-card {
        border: 2px solid #000000;
    }
    
    .star-button {
        border: 2px solid #000000 !important;
    }
    
    .star-indicator {
        color: #000000 !important;
        text-shadow: 2px 2px 0px #ffffff !important;
    }
}

/* Print Styles */
@media print {
    #themeSwitcher {
        display: none !important;
    }
    
    /* Force light theme for printing */
    * {
        background: white !important;
        color: black !important;
        border-color: black !important;
    }
    
    .star-indicator::after {
        content: " [FAVORITE]";
        font-size: 0.75rem;
        font-weight: bold;
        color: black !important;
    }
    
    .star-button,
    .btn-download,
    .ics-download-btn {
        display: none !important;
    }
    
    .star-count::after {
        content: " (" attr(data-star-count) " stars)";
        font-size: 0.75rem;
        color: black !important;
    }
}

/* Mobile adjustments for theme switcher */
@media (max-width: 640px) {
    #themeSwitcher {
        top: 0.75rem;
        left: 0.75rem;
        padding: 0.5rem;
    }
    
    #themeButton {
        padding: 0.5rem !important;
        gap: 0.25rem !important;
    }
    
    #themeIcon {
        font-size: 1rem;
    }
}

/* Hide theme label on very small screens */
@media (max-width: 480px) {
    #themeLabel {
        display: none !important;
    }
}

/* Ensure proper contrast in all themes */
.btn-primary:focus,
.btn-secondary:focus,
.btn-success:focus,
.btn-accent:focus,
.btn-download:focus,
.ics-download-btn:focus {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

.input-primary:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Focus styles for star and download buttons */
.star-button:focus-visible,
.btn-download:focus-visible,
.ics-download-btn:focus-visible {
    outline: 2px solid var(--favorite-color);
    outline-offset: 2px;
}