/* theme-card-overlay.css */
:root {
    --bg-color: #f0f2f5;
    --text-color: #1c1e21;
    --card-bg: #ffffff;
    --border-color: #dcdfe3;
    
    /* App accent colors from story-view-progress-completed */
    --app-accent-primary: #9c27b0;
    --app-accent-secondary: #ff02ff;
    --app-accent-light: #6d0dbd;
    --app-accent-light-secondary: #fbe1ff;
    
    /* Updated theme colors using app accent */
    --primary-btn-bg: linear-gradient(135deg, var(--app-accent-primary), var(--app-accent-secondary));
    --primary-btn-bg-solid: #9c27b0;
    --primary-btn-text: #ffffff;
    --secondary-btn-bg: #f5f5f7;
    --secondary-btn-text: #050505;
    
    /* Theme transition colors */
    --theme-transition-bg: rgba(255,255,255,0.95);
    --theme-overlay-shadow: rgba(0,0,0,0.1);
    
    /* Card background with subtle accent */
    --theme-card-bg: #fafafa;
    --theme-card-border: rgba(156, 39, 176, 0.1);
     --toggle-label-color: rgba(0,0,0,0.7);
    --toggle-label-highlight: #222;
    --toggle-label-shadow: 0 1px 3px rgba(0,0,0,0.2);
    --toggle-label-highlight-shadow: 0 2px 8px rgba(255,255,255,0.2);

}

html.dark {
    --bg-color: #18191a;
    --text-color: #ffffff;
    --card-bg: #242526;
    --border-color: #3a3b3c;
    
    /* Dark mode accent colors */
    --primary-btn-bg: linear-gradient(135deg, var(--app-accent-primary), var(--app-accent-secondary));
    --primary-btn-bg-solid: #9c27b0;
    --secondary-btn-bg: #3a3b3c;
    --secondary-btn-text: #e4e6eb;
    
    /* Theme transition colors for dark mode */
    --theme-transition-bg: rgba(42,42,42,0.95);
    --theme-overlay-shadow: rgba(0,0,0,0.3);
    
    /* Dark mode card background */
    --theme-card-bg: #2a2a2a;
    --theme-card-border: rgba(156, 39, 176, 0.2);
    --toggle-label-color: rgba(255,255,255,0.8);
    --toggle-label-highlight: #fff;
    --toggle-label-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --toggle-label-highlight-shadow: 0 2px 8px rgba(255,255,255,0.3);

}
body {
    z-index: 999;
}
/* Overlay as modal (full screen) */
.theme-card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    border-left: 4px solid var(--app-accent-primary);
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible;
    height: auto;
    cursor: auto;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
    z-index: 1000;
}

.theme-card {
    background: linear-gradient(135deg, #270d2b 0%, #6d1b7b 100%);
    padding: 32px;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    border: none;
    box-shadow: 0 20px 40px rgba(156, 39, 176, 0.2);
    box-sizing: border-box;
    margin: 0;
    color: white;
    position: relative;
    overflow: hidden;
}

/* Add geometric pattern overlay to all theme cards */
.theme-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255,255,255,0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

/* Ensure content appears above overlay and has proper text color */
.theme-card > * {
    position: relative;
    z-index: 2;
}

/* Ensure all text in theme cards is white for gradient backgrounds */
.theme-card,
.theme-card p,
.theme-card span,
.theme-card label,
.theme-card div {
    color: white;
}

.theme-card p,
.theme-card span,
.theme-card label {
    font-size: 3.2vw;
}

html.light .theme-card.adaptive-card p{
    color: var(--text-color);
}


/* Compact card with gradient */
.theme-card.compact-card {
    background: linear-gradient(135deg, #9c27b0 0%, #6d1b7b 100%);
    border: none;
    border-radius: 0;
    max-width: 100%;
    width: 100%;
    padding: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 25px rgba(156, 39, 176, 0.15);
}
.theme-card.settings {
    background: #f8f9fa;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    border: 1px solid #e9ecef;
    max-width: 95vw;
    max-height: 95vh;
    overflow: auto;
    color: #212529;
}

.theme-card h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: white;
    position: relative;
    z-index: 2;
}

.theme-card.settings h2 {
    color: #212529;
}

.theme-card.settings p,.theme-card.settings span {
    color: #495057;
}

html.dark .theme-card.settings h2 {
    color: #f8f9fa;
}

html.dark .theme-card.settings p, html.dark .theme-card.settings span {
    color: #ced4da;
}

.theme-option {
    padding: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    color: white;
    background: rgba(255,255,255,0.1);
    position: relative;
    z-index: 2;
}

.theme-card.settings .theme-option {
    border: 2px solid #dee2e6;
    color: #212529;
    background: #ffffff;
}

html.dark .theme-card.settings .theme-option {
    border: 2px solid #495057;
    color: #f8f9fa;
    background: #495057;
}

.theme-option:hover {
    background-color: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.theme-card.settings .theme-option:hover {
    background-color: #e9ecef;
    border-color: #9c27b0;
}

html.dark .theme-card.settings .theme-option:hover {
    background-color: #6c757d;
    border-color: #9c27b0;
}

.theme-option.selected {
    border-color: rgba(255,255,255,0.8);
    background-color: rgba(255,255,255,0.2);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

.theme-card.settings .theme-option.selected {
    border-color: #9c27b0;
    background-color: rgba(156, 39, 176, 0.1);
    box-shadow: 0 0 0 2px rgba(156, 39, 176, 0.2);
}

html.dark .theme-card.settings .theme-option.selected {
    border-color: #9c27b0;
    background-color: rgba(156, 39, 176, 0.2);
    box-shadow: 0 0 0 2px rgba(156, 39, 176, 0.3);
}

.time-inputs {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.time-inputs label {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.theme-card.settings .time-inputs label {
    color: #495057;
}

html.dark .theme-card.settings .time-inputs label {
    color: #ced4da;
}

.time-inputs input[type="time"] {
    margin-top: 5px;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    background-color: rgba(255,255,255,0.1);
    color: white;
    position: relative;
    z-index: 2;
}

.theme-card.settings .time-inputs input[type="time"] {
    border: 1px solid #dee2e6;
    background-color: #ffffff;
    color: #212529;
}

html.dark .theme-card.settings .time-inputs input[type="time"] {
    border: 1px solid #495057;
    background-color: #495057;
    color: #f8f9fa;
}

.card-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.card-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

#save-theme-btn {
    background: var(--primary-btn-bg);
    color: var(--primary-btn-text);
    border: none;
}

#save-theme-btn:hover {
    background: var(--primary-btn-bg-solid);
    transform: translateY(-1px);
}

.theme-card.settings #save-theme-btn {
    background: #9c27b0;
    color: #ffffff;
    border: 1px solid #9c27b0;
}

.theme-card.settings #save-theme-btn:hover {
    background: #8e24aa;
    border-color: #7b1fa2;
    transform: translateY(-1px);
}

#dismiss-theme-btn {
    background-color: var(--secondary-btn-bg);
    color: var(--secondary-btn-text);
}

.theme-card.settings #dismiss-theme-btn {
    background-color: #6c757d;
    color: #ffffff;
    border: 1px solid #6c757d;
}

.theme-card.settings #dismiss-theme-btn:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

html.dark .theme-card.settings #dismiss-theme-btn {
    background-color: #6c757d;
    color: #f8f9fa;
    border: 1px solid #6c757d;
}

html.dark .theme-card.settings #dismiss-theme-btn:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

/* Settings card time spans */
.theme-card.settings span[style*="color: var(--app-accent-primary)"] {
    color: var(--app-accent-primary) !important;
}

/* New UI States Styles */

/* Full-width card inherits base gradient */
.theme-card.full-width-card {
    max-width: 100%;
    width: 100%;
    padding: 1rem;
    border-radius: 0;
}

/* Dark theme gradient */
/* Dark theme gradients for all card types */
html.dark .theme-card {
    background: linear-gradient(135deg, #300c36 0%, #4a1259 100%);
    box-shadow: 0 20px 40px rgba(109, 27, 123, 0.3);
}

html.dark .theme-card.compact-card {
    background: linear-gradient(135deg, #6d1b7b 0%, #4a1259 100%);
    box-shadow: 0 10px 25px rgba(109, 27, 123, 0.25);
}

html.dark .theme-card.adaptive-card {
    background: linear-gradient(135deg, #300c36 0%, #4a1259 100%);
    box-shadow: 0 8px 20px rgba(109, 27, 123, 0.2);
}

html.dark .theme-card.settings {
    background: #343a40;
    border: 1px solid #495057;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    color: #f8f9fa;
}

/* Light theme gradients for all card types */
html.light .theme-card {
    background: linear-gradient(135deg, #ba68c845 10%, #9c27b029 100%);
    box-shadow: 0 20px 40px rgba(186, 104, 200, 0.3);
}

html.light .theme-card .theme-text-container .intro-title,
html.light .theme-card .theme-text-container .insight-text {
    color: black;
}





html.light .theme-card.compact-card {
    background: linear-gradient(135deg, #ba68c8 0%, #9c27b0 100%);
    box-shadow: 0 10px 25px rgba(186, 104, 200, 0.2);
}

html.light .theme-card.adaptive-card {
    background: linear-gradient(135deg, #ba68c854 20%, #9c27b029 100%);
    box-shadow: 0 8px 20px rgba(186, 104, 200, 0.15);
}

html.light .theme-card.settings {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    color: #212529;
}



.intro-title {
    text-align: center;
    margin-bottom: 15px;
    font-size: 2.2rem;
    color: white;
    font-weight: 600;
    position: relative;
    z-index: 2;
}

.insight-text {
    color: white;
    font-weight: 400;
    position: relative;
    z-index: 2;
    font-style: italic;
    margin: 20px 0;
    text-align: center;
    font-size: clamp(1rem, 4vw, 1.2rem);
}

/* Modern toggle design matching the reference */
.theme-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    
    padding: 30px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    position: relative;
    z-index: 2;
}

/* Toggle labels with glassmorphism effect */
.toggle-label {
    font-weight: 600;
    color: white;
    font-size: clamp(0.9rem, 4vw, 1.1rem);
    transition: all 0.3s ease;
    text-shadow: var(--toggle-label-shadow);
}

.toggle-label.highlighted {
    color: white;
    text-shadow: var(--toggle-label-highlight-shadow);
    font-weight: 700;
}

/* Enhanced toggle switch */
.theme-toggle {
    width: 80px;
    height: 40px;
    background: rgba(0,0,0,0.3);
    border-radius: 25px;
    position: relative;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 
        inset 0 2px 5px rgba(0,0,0,0.2),
        0 4px 15px rgba(0,0,0,0.1);
}

.theme-toggle.dark-mode {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
}

.toggle-slider {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.2),
        0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.1);
}



.theme-toggle.dark-mode .toggle-slider {
    transform: translateX(40px);
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border-color: rgba(255,255,255,0.1);
    margin-top: 1px;
}

/* Hover effects */
.theme-toggle:hover {
    /* transform: scale(1.05); */
    box-shadow: 
        inset 0 2px 5px rgba(0,0,0,0.3),
        0 8px 25px rgba(0,0,0,0.15);
}

.toggle-label:hover {
    color: white;
    /* transform: scale(1.05); */
}

/* Adaptive section with glassmorphism */
.adaptive-checkbox-section {
    margin-top: 25px;
    padding: 25px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.2);
    display: block;
    transition: all 0.4s ease-in-out;
    opacity: 1;
    transform: translateY(0);
    max-height: 500px;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.adaptive-checkbox-section.hidden {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    padding: 0 25px;
    margin-top: 0;
    transition: all 0.4s ease-in-out;
}

.adaptive-checkbox-section.animating-in {
    animation: slideInAdaptive 0.2s ease-out forwards;
}

.adaptive-checkbox-section.animating-out {
    animation: slideOutAdaptive 0.2s ease-in forwards;
}

@keyframes slideInAdaptive {
    0% {
        opacity: 0;
        transform: translateY(-15px);
        max-height: 0;
        padding: 0 25px;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        max-height: 500px;
        padding: 25px;
    }
}

@keyframes slideOutAdaptive {
    0% {
        opacity: 1;
        transform: translateY(0);
        max-height: 500px;
        padding: 25px;
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
        padding: 0 25px;
    }
}

.adaptive-section-header {
    color: white;
    font-size: 4vw;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.adaptive-main-row {
    display: flex;
    gap: 10px;
    padding-top: 1.5rem;
}

.adaptive-main-row input[type="checkbox"] {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    accent-color: white;
    cursor: pointer;
    margin-top: 1rem;
}

.adaptive-main-row label {
    font-size: 1rem;
    line-height: 1.4;
    cursor: pointer;
    color: white;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.adaptive-time-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 32px;
}

.time-display-text {
    font-size: 1rem;
    color: white;
    font-weight: 500;
}

.time-highlight {
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.edit-time-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 2.5vw;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    backdrop-filter: blur(5px);
}

.edit-time-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}



.status-text {
    margin: 0 0 20px 0;
    color: white;
    font-size: 1rem;
    line-height: 1.5;
    position: relative;
    z-index: 2;
}

.settings-btn {
    background: var(--primary-btn-bg);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-btn:hover {
    background: var(--primary-btn-bg-solid);
    transform: translateY(-1px);
}

/* Adaptive card compact horizontal layout with gradient */
.theme-card.adaptive-card {
    background: linear-gradient(135deg, #9c27b0 0%, #6d1b7b 100%);
    border: none;
    border-radius: 0;
    max-width: 100%;
    width: 100%;
    padding: 16px 20px;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 8px 20px rgba(156, 39, 176, 0.1);
}


.adaptive-horizontal-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    transition: all 0.3s ease;
}

.adaptive-horizontal-layout.hidden {
    display: none;
}

.adaptive-editing-layout {
    display: none;
    flex-direction: column;
    /* gap: 20px; */
}

.adaptive-editing-layout.show {
    display: flex;
}

.adaptive-text-container {
    flex: 1;
    display: flex;
    align-self: center;
}

.adaptive-status-text {
    margin: 0;
    color: white;
    font-size: 0.95rem;
    line-height: 1.4;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.adaptive-button-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.adaptive-dismiss-btn {
    background: var(--primary-btn-bg);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 70px;
}

.adaptive-dismiss-btn:hover {
    background: var(--primary-btn-bg-solid);
    transform: translateY(-1px);
}

/* Responsive adjustments for modern design */
@media (max-width: 768px) {
    .theme-card.full-width-card {
        width: 95%;
        padding: 1rem;
        margin: 0 auto;
    }
    
    .intro-title {
        font-size: 1.8rem;
    }
    
    .insight-text {
        font-size: clamp(0.95rem, 4vw, 1.1rem);
    }
    
    .theme-toggle-container {
        gap: 20px;
        padding: 25px 20px;
        
    }
    
    .toggle-label {
        font-size: clamp(0.85rem, 4vw, 1rem);
    }
    
    .theme-toggle {
        width: 70px;
        height: 36px;
    }
    
    .toggle-slider {
        width: 28px;
        height: 28px;
    }
    
    .theme-toggle.dark-mode .toggle-slider {
        transform: translateX(34px);
    }
    
    .adaptive-checkbox-section {
        padding: 20px;
        margin-top: 20px;
    }
    
    .adaptive-time-row {
        flex-wrap: wrap;
        margin-left: 0;
        gap: 8px;
    }
    
    .time-edit-container {
        margin-left: 0;
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* Save button with modern styling */
.save-preferences-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
    backdrop-filter: blur(10px);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 4vw;
    margin-top: 20px;
    width: 100%;
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Dismiss button styling */
.dismiss-preferences-btn {
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(1px);
    color: rgba(255,255,255,0.8);
    border: 2px solid rgba(255,255,255,0.2);
    padding: 10px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 4vw;
    margin-top: 10px;
    width: 100%;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.save-preferences-btn.show {
    opacity: 1;
    transform: translateY(0);
    max-height: fit-content;
    padding: 10px;
    animation: slideInButton 0.4s ease-out;
}
.save-preferences-btn.show.adaptive {
    animation: pulseGlow 1.5s ease-in-out;
}
.save-preferences-btn.show.adaptive {
    animation: pulseGlow 1.5s ease-in-out;
}
.save-preferences-btn.show.adaptive.minus {
    animation: '';
}
.save-preferences-btn.hide {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    animation: slideOutButton 0.3s ease-in;
}

@keyframes slideInButton {
    0% {
        opacity: 0;
        transform: translateY(-15px);
        max-height: 0;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        max-height: 60px;
    }
}

@keyframes slideOutButton {
    0% {
        opacity: 1;
        transform: translateY(0);
        max-height: 60px;
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
}

.save-preferences-btn:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.2) 100%);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.save-preferences-btn:active {
    transform: translateY(0);
}

.dismiss-preferences-btn:hover {
    background: rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    color: rgba(255,255,255,0.9);
}

.dismiss-preferences-btn:active {
    transform: translateY(0);
}

/* Move save button inside adaptive section */
.adaptive-checkbox-section .save-preferences-btn {
    margin-top: 20px;
    width: 100%;
}

/* Focus states for accessibility */
.theme-toggle:focus,
.settings-btn:focus,
.save-preferences-btn:focus,
.edit-time-btn:focus {
    outline: 2px solid var(--app-accent-primary);
    outline-offset: 2px;
}

/* Enhanced time editing styles */
.time-edit-container {
    display: none;
    gap: 10px;
    align-items: center;
    margin-left: 32px;
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
}

.time-edit-container.active {
    display: flex;
}

.time-edit-input {
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 3vw;
    
    backdrop-filter: blur(5px);
}

.time-edit-input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.2);
    box-shadow: 0 0 0 2px rgba(156, 39, 176, 0.3);
}

.time-edit-actions {
    display: flex;
    gap: 8px;
}

.time-edit-save, .time-edit-cancel {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.time-edit-save {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.time-edit-save:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.time-edit-cancel {
    background: rgba(0,0,0,0.2);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.2);
}

.time-edit-cancel:hover {
    background: rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.3);
}


/* Clock UI Component for time selection */
.clock-ui-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
    padding: 20px;
    background: var(--secondary-btn-bg);
    border-radius: 12px;
    border: 1px solid var(--theme-card-border);
}

.clock-ui-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.clock-ui-label {
    font-weight: 500;
    color: var(--text-color);
    min-width: 140px;
}

.clock-time-input {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-family: monospace;
    font-size: 16px;
    min-width: 120px;
}

.clock-time-input:focus-within {
    border-color: var(--app-accent-primary);
    outline: none;
}

.time-display {
    background: none;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    color: var(--text-color);
    text-align: center;
    width: 100%;
}

.time-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.demo-btn {
    margin: 5px;
    padding: 12px 24px;
    border: none;
    background: var(--primary-btn-bg-solid);
    color: var(--primary-btn-text);
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.demo-btn:hover {
    background: var(--app-accent-primary);
    transform: translateY(-1px);
}

.time-btn:hover {
    background: var(--app-accent-primary);
    color: white;
    border-color: var(--app-accent-primary);
}

/* Mobile responsive styles for theme previews and clock UI */
@media (max-width: 768px) {
    .adaptive-horizontal-layout {
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
    }
    
    .adaptive-button-container {
        justify-content: flex-end;
    }
    
    .adaptive-dismiss-btn {
        min-width: 80px;
    }
    
    .clock-ui-container {
        padding: 15px;
        gap: 12px;
    }
    
    .clock-ui-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .clock-ui-label {
        min-width: auto;
        font-size: 0.9rem;
    }
    
    .clock-time-input {
        width: 100%;
        min-width: auto;
        justify-content: center;
    }
    
    .adaptive-time-row {
        flex-wrap: wrap;
        margin-left: 0;
    }
    
    .time-edit-container {
        margin-left: 0;
        flex-wrap: wrap;
    }
}

.adaptive-checkbox-section[data-context="light_mornings"] {
    background: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.7) 70%, rgba(0,0,0,0.1) 100%), url('/static/images/morning2.jpeg') center/cover no-repeat;
    text-shadow: 0 2px black;
}

.adaptive-checkbox-section[data-context="dark_nights"] {
    background: linear-gradient(rgba(0,0,0,0.9), rgba(0,0,0,0.2)), url('/static/images/night.jpg') center/cover no-repeat;
}

 .adaptive-description {
    /* text-align: center; */
    color: white;
 }

 .demo-section .insight-text {
    color: white;
 }

/* Theme-aware utility classes */
.theme-text-primary {
    color: var(--text-color);
}

.theme-text-secondary {
    color: rgba(var(--text-color), 0.7);
}

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

.theme-border-primary {
    border-color: var(--theme-card-border);
}

/* Ensure consistent theming for all interactive elements */
.theme-card button:not(.demo-btn):not(.save-preferences-btn):not(.dismiss-preferences-btn):not(.time-edit-save):not(.time-edit-cancel) {
    background: #9c27b0;
    color: var(--primary-btn-text);
    border: none;
}

.theme-card button:hover:not(.demo-btn):not(.save-preferences-btn):not(.dismiss-preferences-btn):not(.time-edit-save):not(.time-edit-cancel) {
    background: var(--primary-btn-bg-solid);
}

/* Subtle shake animation for adaptive mode disable */
@keyframes subtleShake {
    0%, 100% {
        transform: translateX(0);
    }
    10% {
        transform: translateX(-2px);
    }
    20% {
        transform: translateX(2px);
    }
    30% {
        transform: translateX(-2px);
    }
    40% {
        transform: translateX(2px);
    }
    50% {
        transform: translateX(-1px);
    }
    60% {
        transform: translateX(1px);
    }
    70% {
        transform: translateX(0);
    }
}

/* Pulse glow animation for save button */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    50% {
        box-shadow: 0 0 20px rgba(156, 39, 176, 0.5), 0 4px 15px rgba(156, 39, 176, 0.3);
        transform: scale(1.02);
    }
}

/* Fade out animation for dismissing theme card */
@keyframes fadeOutAndSlideUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Disabled state indication for adaptive section */
.adaptive-checkbox-section.disabled-indication {
    animation: subtleShake 0.4s ease;
}

/* Dismissing theme card animation */
.theme-card-overlay.dismissing {
    animation: fadeOutAndSlideUp 0.4s ease-in-out forwards;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .theme-card {
        border: 2px solid var(--app-accent-primary);
    }
    
    .toggle-label {
        font-weight: 700;
    }
    
    .theme-toggle {
        border-width: 3px;
    }
}


/* New horizontal layout for title/text on left, toggle on right */
.theme-header-layout {
    display: flex;
    justify-content: space-between;
    gap: 0;
    padding: 0 10px;
}

.theme-text-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.theme-text-container .intro-title {
    font-size: 4vw;
    margin: 0;
    line-height: 1.2;
    text-align: left;
    padding-left: 0;
}

.theme-text-container .insight-text {
    font-size: 3vw;
    margin: 0;
    line-height: 1.3;
    opacity: 0.9;
    text-align: left;
    padding-left: 0;
}

.theme-toggle-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* Remove the old theme-toggle-container styles */
.theme-toggle-container {
    display: none;
}

/* Enhanced toggle switch with text inside */
.theme-toggle {
    width: 120px; /* Slightly smaller width */
    height: 50px; /* Keep height for text visibility */
    background: #ffffff; /* Light background by default */
    border-radius: 25px;
    position: relative;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 
        inset 0 2px 5px rgba(0,0,0,0.1),
        0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.theme-toggle.dark-mode {
    background: #111; /* Dark background when dark mode is active */
    border-color: rgba(255,255,255,0.3);
}

/* Text labels inside the toggle - only show active text */
.theme-toggle::before {
    content: 'Light';
    position: absolute;
    left: 50%;
    transform: translateX(20%);
    font-size: 14px;
    font-weight: 600;
    color: #4a5568; /* Dark text on light background */
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1;
    opacity: 1;
}

.theme-toggle::after {
    content: 'Dark';
    position: absolute;
    left: 50%;
    transform: translateX(20%);
    font-size: 14px;
    font-weight: 600;
    color: #ffffff; /* White text on dark background */
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1;
    opacity: 0; /* Hidden by default */
}

.theme-toggle.dark-mode::before {
    opacity: 0; /* Hide Light text when in dark mode */
}

.theme-toggle.dark-mode::after {
    opacity: 1; /* Show Dark text when in dark mode */
    transform: translateX(-100%);
}

.toggle-slider {
    width: 40px; /* Increased size */
    height: 40px;
    background: linear-gradient(135deg, #9c27b0 0%, #6d1b7b 100%); /* Purple gradient */
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 5px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 
        0 4px 8px rgba(156, 39, 176, 0.3),
        0 2px 4px rgba(0,0,0,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    z-index: 2; /* Above the text */
}

.theme-toggle.dark-mode .toggle-slider {
    transform: translateX(65px); /* Adjusted for smaller width */
    background: linear-gradient(135deg, #9c27b0 0%, #6d1b7b 100%); /* Keep same purple */
    border-color: rgba(255,255,255,0.3);
}

/* Hover effects */
.theme-toggle:hover {
    box-shadow: 
        inset 0 2px 5px rgba(0,0,0,0.15),
        0 8px 25px rgba(0,0,0,0.15);
}

.theme-toggle:hover .toggle-slider {
    box-shadow: 
        0 6px 12px rgba(156, 39, 176, 0.4),
        0 3px 6px rgba(0,0,0,0.15);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .theme-header-layout {
        align-items: center;
        gap: 0;
        text-align: left;
    }
    
    .theme-text-container .intro-title {
        font-size: 4vw;
    }
    
    .theme-text-container .insight-text {
        font-size: 3vw;
    }
    
    .theme-toggle-wrapper {
        align-self: center;
    }
    
    .theme-toggle {
        width: 100px;
        height: 45px;
    }
    
    .theme-toggle::before,
    .theme-toggle::after {
        font-size: 12px;
    }
    
    .toggle-slider {
        width: 35px;
        height: 35px;
    }
    
    .theme-toggle.dark-mode .toggle-slider {
        transform: translateX(55px);
    }
}

html.light .theme-card .theme-text-container .intro-title,
html.light .theme-card .theme-text-container .insight-text {
    color: black;
}

