/* Theme System for Gita App */

/* Light Theme (Default) */
.theme-light {
    --background-primary: #ffffff;
    --background-secondary: #f8f9fa;
    --background-tertiary: #f1f3f4;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-muted: #bdc3c7;
    --border-color: #e9ecef;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 30px rgba(0, 0, 0, 0.2);
    --overlay-bg: rgba(255, 255, 255, 0.9);
    --card-bg: rgba(255, 255, 255, 0.8);
}

.theme-light .book-container {
    background: linear-gradient(135deg, #faf4e6 0%, #f5f0e6 50%, #ede7d9 100%);
}

.theme-light .page {
    background: linear-gradient(135deg, #fefefe 0%, #f8f8f8 100%);
    border-color: #ddd;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.theme-light .verse-container {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 107, 53, 0.1);
}

.theme-light .verse-container.current {
    background: rgba(255, 107, 53, 0.02);
    border: 2px solid rgba(255, 107, 53, 0.1);
}

/* Dark Theme */
.theme-dark {
    --background-primary: #1a1a1a;
    --background-secondary: #2d2d2d;
    --background-tertiary: #3d3d3d;
    --text-primary: #e8e6e3;
    --text-secondary: #c0bcb5;
    --text-muted: #8b8680;
    --border-color: #404040;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-heavy: 0 8px 30px rgba(0, 0, 0, 0.5);
    --overlay-bg: rgba(26, 26, 26, 0.95);
    --card-bg: rgba(45, 45, 45, 0.9);
}

.theme-dark .book-container {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #404040 100%);
}

.theme-dark .page {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #404040;
    color: var(--text-primary);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.theme-dark .verse-container {
    background: rgba(45, 45, 45, 0.8);
    border: 1px solid rgba(255, 107, 53, 0.2);
}

.theme-dark .verse-container.current {
    background: rgba(255, 107, 53, 0.1);
    border: 2px solid rgba(255, 107, 53, 0.3);
}

.theme-dark .main-header {
    background: rgba(26, 26, 26, 0.95);
    border-bottom-color: var(--border-color);
}

.theme-dark .search-input {
    background-color: var(--background-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.theme-dark .search-input:focus {
    background-color: var(--background-primary);
    border-color: var(--primary-color);
}

.theme-dark .action-btn {
    background: rgba(45, 45, 45, 0.8);
    border-color: rgba(255, 107, 53, 0.3);
    color: var(--text-primary);
}

.theme-dark .action-btn:hover {
    background: var(--primary-color);
    color: white;
}

.theme-dark .settings-panel {
    background-color: var(--background-primary);
    border-left-color: var(--border-color);
}

.theme-dark .chapter-navigation {
    background: rgba(26, 26, 26, 0.95);
    border-right-color: var(--border-color);
}

.theme-dark .verse-navigation {
    background: rgba(26, 26, 26, 0.95);
    border-color: rgba(255, 107, 53, 0.2);
}

/* Sepia Theme */
.theme-sepia {
    --background-primary: #f4f1e8;
    --background-secondary: #ede8d5;
    --background-tertiary: #e6d8c5;
    --text-primary: #3d2914;
    --text-secondary: #8b6914;
    --text-muted: #b8860b;
    --border-color: #d2c5a8;
    --shadow-light: 0 2px 10px rgba(61, 41, 20, 0.15);
    --shadow-medium: 0 4px 20px rgba(61, 41, 20, 0.2);
    --shadow-heavy: 0 8px 30px rgba(61, 41, 20, 0.25);
    --overlay-bg: rgba(244, 241, 232, 0.95);
    --card-bg: rgba(237, 232, 213, 0.9);
    --sepia-accent: #8b4513;
    --sepia-light: #deb887;
}

.theme-sepia .book-container {
    background: linear-gradient(135deg, #f4f1e8 0%, #ede8d5 50%, #e6d8c5 100%);
}

.theme-sepia .page {
    background: linear-gradient(135deg, #f4f1e8 0%, #ede8d5 100%);
    border-color: #d2c5a8;
    color: var(--text-primary);
    box-shadow: 
        0 10px 30px rgba(61, 41, 20, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.theme-sepia .verse-container {
    background: rgba(237, 232, 213, 0.7);
    border: 1px solid rgba(139, 69, 19, 0.2);
}

.theme-sepia .verse-container.current {
    background: rgba(139, 69, 19, 0.05);
    border: 2px solid rgba(139, 69, 19, 0.3);
}

.theme-sepia .main-header {
    background: rgba(244, 241, 232, 0.95);
    border-bottom-color: var(--border-color);
}

.theme-sepia .search-input {
    background-color: var(--background-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.theme-sepia .search-input:focus {
    background-color: var(--background-primary);
    border-color: var(--sepia-accent);
}

.theme-sepia .action-btn {
    background: rgba(237, 232, 213, 0.8);
    border-color: rgba(139, 69, 19, 0.3);
    color: var(--sepia-accent);
}

.theme-sepia .action-btn:hover {
    background: var(--sepia-accent);
    color: white;
}

.theme-sepia .settings-panel {
    background-color: var(--background-primary);
    border-left-color: var(--border-color);
}

.theme-sepia .chapter-navigation {
    background: rgba(244, 241, 232, 0.95);
    border-right-color: var(--border-color);
}

.theme-sepia .verse-navigation {
    background: rgba(244, 241, 232, 0.95);
    border-color: rgba(139, 69, 19, 0.2);
}

.theme-sepia .page-control {
    background: linear-gradient(135deg, var(--sepia-accent), var(--sepia-light));
}

.theme-sepia .verse-dot.active {
    background: linear-gradient(135deg, var(--sepia-accent), var(--sepia-light));
}

/* Sanskrit Text Styling per Theme */
.theme-light .sanskrit-text .text-content {
    color: var(--sanskrit-red);
}

.theme-dark .sanskrit-text .text-content {
    color: #ff6b6b;
}

.theme-sepia .sanskrit-text .text-content {
    color: var(--sepia-accent);
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Theme Transition Animations */
.theme-light,
.theme-dark,
.theme-sepia {
    transition: all 0.3s ease;
}

.theme-light *,
.theme-dark *,
.theme-sepia * {
    transition: 
        background-color 0.3s ease,
        border-color 0.3s ease,
        color 0.3s ease,
        box-shadow 0.3s ease;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .theme-light {
        --text-primary: #000000;
        --text-secondary: #333333;
        --border-color: #666666;
    }
    
    .theme-dark {
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --border-color: #999999;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .theme-light *,
    .theme-dark *,
    .theme-sepia * {
        transition: none !important;
        animation: none !important;
    }
    
    .book.flipping-left .page-left,
    .book.flipping-right .page-right {
        animation: none !important;
    }
}

/* Print Styles */
@media print {
    .theme-light,
    .theme-dark,
    .theme-sepia {
        --background-primary: white;
        --background-secondary: white;
        --text-primary: black;
        --text-secondary: #333;
        color-adjust: exact;
    }
    
    .main-header,
    .verse-navigation,
    .quick-actions,
    .book-controls {
        display: none !important;
    }
    
    .page {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }
    
    .verse-container {
        break-inside: avoid;
        margin-bottom: 20px;
    }
}

/* Theme-specific Scrollbar Styling */
.theme-light ::-webkit-scrollbar {
    width: 8px;
    background: var(--background-secondary);
}

.theme-light ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.theme-light ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.theme-dark ::-webkit-scrollbar {
    width: 8px;
    background: var(--background-secondary);
}

.theme-dark ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.theme-dark ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.theme-sepia ::-webkit-scrollbar {
    width: 8px;
    background: var(--background-secondary);
}

.theme-sepia ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.theme-sepia ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Focus indicators for accessibility */
.theme-light button:focus,
.theme-light a:focus,
.theme-light input:focus,
.theme-light select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.theme-dark button:focus,
.theme-dark a:focus,
.theme-dark input:focus,
.theme-dark select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.theme-sepia button:focus,
.theme-sepia a:focus,
.theme-sepia input:focus,
.theme-sepia select:focus {
    outline: 2px solid var(--sepia-accent);
    outline-offset: 2px;
}

/* Theme-specific gradient overlays */
.theme-light .gradient-overlay {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(255, 210, 63, 0.1));
}

.theme-dark .gradient-overlay {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 210, 63, 0.2));
}

.theme-sepia .gradient-overlay {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.1), rgba(222, 184, 135, 0.1));
}