/* ===================================
   MantraMap - Color Contrast Fixes
   Improved visibility and accessibility
   =================================== */

/* Timeline Animation Styles */
.timeline-item {
    opacity: 0.8;
    transform: translateX(-20px);
    transition: all 0.6s ease;
    margin-bottom: 1rem;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.timeline-item.animated {
    opacity: 1;
    transform: translateX(0) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.timeline-item h4 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.timeline-item .verse-count {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 600;
}

.timeline-bar {
    height: 8px;
    border-radius: 4px;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timeline-themes {
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 0.5rem;
    opacity: 0.8;
}


/* Gentle fixes that maintain theme integrity */

/* Simple fix for invisible stat card text */
.stat-card {
    background: rgba(255, 255, 255, 0.9) !important;
}

.stat-card h3,
.stat-card .stat-content h3,
.stat-content h3 {
    color: #2c1810 !important;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.stat-card p,
.stat-card .stat-content p,
.stat-content p {
    color: #4a4a4a !important;
    text-shadow: 0.5px 0.5px 1px rgba(255, 255, 255, 0.6) !important;
}

/* CRITICAL: Fix for first stat card on visualization page */
.overview-stats .stat-card:first-child,
.stats-container .stat-card:first-child {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 2px solid rgba(255, 149, 0, 0.4) !important;
    box-shadow: 0 6px 20px rgba(139, 0, 0, 0.15) !important;
}

/* Minimal fix for stat card text visibility */
.stat-card h3,
.stat-card .stat-content h3,
.stat-content h3,
#total-verses-count,
#most-mentioned-deity,
#largest-mandala {
    color: #2c1810 !important;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7) !important;
}

.stat-card p,
.stat-card .stat-content p,
.stat-content p {
    color: #2c1810 !important;
    text-shadow: 0.5px 0.5px 1px rgba(255, 255, 255, 0.5) !important;
}

/* Fix for invisible text in stat cards - ENHANCED */
.stat-card h3, 
.stat-card .stat-number,
.stat-info h4,
.stat-content h3 {
    color: #2c1810 !important; /* Dark text for better contrast */
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.9);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    font-size: 2.2rem !important;
}

/* Ensure visibility on all backgrounds */
.stat-card h3:hover,
.stat-card .stat-number:hover {
    color: #000000 !important;
    text-shadow: 2px 2px 6px rgba(255, 255, 255, 1);
}

.stat-card.highlight h3,
.stat-card.highlight .stat-number {
    color: #8b0000 !important; /* Maroon for highlighted cards */
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.9);
}

.stat-card .stat-label {
    color: #4a4a4a !important; /* Darker gray for labels */
    font-weight: 500;
    text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.5);
}

/* Overview Stats - Better Visibility - ENHANCED */
.overview-stats .stat-card,
.stats-container .stat-card {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 2px solid rgba(255, 149, 0, 0.3);
    box-shadow: 0 6px 20px rgba(139, 0, 0, 0.15);
    backdrop-filter: blur(5px);
}

.overview-stats .stat-card h3,
.stats-container .stat-card h3,
.stat-content h3 {
    font-size: 2.5rem !important;
    color: #000000 !important;
    margin-bottom: 0.5rem;
    font-weight: 800 !important;
    text-shadow: 3px 3px 6px rgba(255, 255, 255, 1);
    letter-spacing: -0.5px;
}

.overview-stats .stat-card p,
.stats-container .stat-card p,
.stat-content p {
    color: #2c1810 !important;
    font-weight: 600 !important;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* Chart Containers - Better Backgrounds */
.chart-container {
    background: rgba(255, 255, 255, 0.98) !important;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 24px rgba(139, 0, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.1);
}

.chart-container.active {
    display: block;
}

.chart-container h3,
.chart-container h4 {
    color: #2c1810 !important;
    margin-bottom: 1rem;
}

.chart-container p {
    color: #4a4a4a !important;
    line-height: 1.6;
}

/* Chart Controls - Better Contrast */
.tab-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e0e0e0;
    color: #4a4a4a !important;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: #fff9f0;
    border-color: #ff9500;
    color: #2c1810 !important;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(135deg, #ff9500 0%, #e8850a 100%);
    border-color: #ff9500;
    color: white !important;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

/* Visualization Page Header */
.page-title {
    color: #2c1810 !important;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
}

.page-description {
    color: #4a4a4a !important;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* Chart Insights - Better Readability */
.chart-insights h4,
.mandala-insights li,
.word-insights h4 {
    color: #2c1810 !important;
}

.chart-insights ul li {
    color: #4a4a4a !important;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

/* Deity Legend - Better Colors */
.legend-grid .legend-item h5 {
    color: #2c1810 !important;
    font-weight: 600;
}

.legend-grid .legend-item p {
    color: #4a4a4a !important;
}

/* Timeline Theme Items */
.theme-legend .theme-item span {
    color: #2c1810 !important;
    font-weight: 500;
}

/* Timeline Visualization - Dynamic Text Colors */
.timeline-item {
    position: relative;
}

.timeline-item h5,
.timeline-item p,
.timeline-content h5,
.timeline-content p {
    color: rgba(255, 255, 255, 0.95) !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    font-weight: 600;
}

.timeline-item .verse-count,
.timeline-content .verse-count {
    color: rgba(255, 255, 255, 0.8) !important;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    font-weight: 500;
}

/* Timeline marker text */
.timeline-marker {
    color: rgba(255, 255, 255, 1) !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: 800 !important;
}

/* Ensure all timeline text is visible on dark backgrounds */
.timeline-item[style*="background-color"] h5,
.timeline-item[style*="background-color"] p {
    color: white !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Exploration Section */
.exploration-card h4 {
    color: #2c1810 !important;
    margin-bottom: 0.75rem;
}

.exploration-card p {
    color: #4a4a4a !important;
    line-height: 1.5;
}

/* Button Improvements */
.btn {
    font-weight: 500;
    text-shadow: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #ff9500 0%, #e8850a 100%);
    border: none;
    color: white !important;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #e8850a 0%, #d4710a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 149, 0, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #8b0000 0%, #6d0000 100%);
    border: none;
    color: white !important;
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #a50000 0%, #8b0000 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 0, 0, 0.4);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ff9500;
    color: #ff9500 !important;
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.1);
}

.btn-outline:hover {
    background: #ff9500;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

/* Toast Notifications - Better Contrast */
.toast {
    background: rgba(255, 255, 255, 0.98);
    color: #2c1810 !important;
    border-left: 4px solid #ff9500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.toast.success {
    border-left-color: #4caf50;
}

.toast.error {
    border-left-color: #f44336;
}

.toast.warning {
    border-left-color: #ff9800;
}

.toast.info {
    border-left-color: #2196f3;
}

/* Modal Improvements */
.modal-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 149, 0, 0.1);
}

.modal-header h3,
.modal-header h4 {
    color: #2c1810 !important;
}

.modal-body {
    color: #4a4a4a !important;
}

/* Verse Cards - Better Contrast */
.verse-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 149, 0, 0.1);
    box-shadow: 0 4px 16px rgba(139, 0, 0, 0.1);
}

.verse-reference {
    color: #2c1810 !important;
    font-weight: 600;
}

.verse-text {
    color: #2c1810 !important;
    background: rgba(255, 248, 231, 0.8);
    border-left-color: #ff9500;
}

.verse-translation {
    color: #4a4a4a !important;
    font-style: italic;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(245, 245, 220, 0.6);
    border-radius: 8px;
}

/* Deity and Theme Tags */
.deity-tag,
.theme-tag {
    background: #ff9500;
    color: white !important;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0.25rem 0.25rem 0 0;
    display: inline-block;
}

.theme-tag {
    background: #8b0000;
}

/* Search Highlights */
.search-highlight {
    background: #fff3cd !important;
    color: #856404 !important;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* History Cards */
.history-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 149, 0, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(139, 0, 0, 0.1);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-card .verse-reference {
    color: #ff9500 !important;
    font-weight: 600;
}

.history-time {
    color: #757575 !important;
    font-size: 0.85rem;
}

.verse-preview {
    color: #2c1810 !important;
    font-style: italic;
    margin: 0.5rem 0;
}

/* Action Buttons */
.action-btn {
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.3);
    color: #ff9500 !important;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 0.25rem;
}

.action-btn:hover {
    background: #ff9500;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

/* Three.js Canvas Enhancements */
.vedic-3d-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    opacity: 0.1;
    pointer-events: none;
}

.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.05;
    pointer-events: none;
}

/* Loading States */
.loading-overlay {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.loading-overlay p {
    color: #2c1810 !important;
    font-weight: 500;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .stat-card h3,
    .stat-card .stat-number {
        font-size: 1.5rem !important;
    }
    
    .overview-stats {
        padding: 1rem;
    }
    
    .chart-container {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Dark mode friendly improvements */
@media (prefers-color-scheme: dark) {
    .stat-card,
    .chart-container,
    .verse-card {
        background: rgba(255, 255, 255, 0.98) !important;
    }
    
    .stat-card h3,
    .stat-card .stat-number,
    .chart-container h3,
    .verse-text {
        color: #2c1810 !important;
    }
}

/* Print styles */
@media print {
    .stat-card h3,
    .stat-card .stat-number {
        color: #000 !important;
    }
    
    .chart-container {
        background: #fff !important;
    }
}