/* Statistics Dashboard CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #fff;
    background-color: #000;
    min-height: 100vh;
}

.container {
    max-width: 95%;
    margin: 0 auto;
    padding: 20px;
    background: #000;
    min-height: 100vh;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    background-color: #111;
    color: white;
    border-radius: 10px;
    border: 2px solid #f26822;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #f26822;
}

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    padding: 12px 24px;
    border: 2px solid #f26822;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
    background-color: #222;
}

.nav-link:hover {
    background: #f26822;
    color: #000;
    transform: translateY(-2px);
}


/* Section Styles */
.stats-category {
    margin-bottom: 60px;
    background: #111;
    border-radius: 10px;
    padding: 30px;
    border: 2px solid #f26822;
}

.stats-category h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #f26822;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 3px solid #333;
}

/* Charts Grid */
.charts-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 30px;
}

.chart-container {
    background: #222;
    border-radius: 10px;
    padding: 25px;
    border: 1px solid #444;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 90%;
    margin: 0 auto;
}

.chart-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(242, 104, 34, 0.3);
}

.chart-container.wide {
    width: 95%;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
}

.chart-header h3 {
    color: #f26822;
    font-size: 1.3rem;
    font-weight: 600;
}

.author-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.author-selector label {
    color: #fff;
    font-weight: 500;
}

.author-selector select {
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    min-width: 200px;
}

.author-selector select:focus {
    outline: none;
    border-color: #f26822;
}


/* Chart Styles */
.chart {
    position: relative;
    background: #333;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #555;
    height: 400px;
    max-height: 70vh;
}

.chart.large {
    height: 500px;
    max-height: 80vh;
}

#age-genre-matrix {
    display: flex;
    justify-content: center;
}

.chart-description {
    margin-top: 15px;
    font-style: italic;
    color: #6c757d;
    text-align: center;
    font-size: 0.95rem;
}

/* D3.js Specific Styles */
.axis {
    font-size: 18px;
    font-weight: 600;
}

.axis text {
    fill: #fff;
    font-size: 16px;
    font-weight: 600;
}

.axis line,
.axis path {
    fill: none;
    stroke: #f26822;
    stroke-width: 2px;
    shape-rendering: crispEdges;
}

.grid line {
    stroke: #555;
    stroke-dasharray: 2,2;
}

.tooltip {
    position: absolute;
    padding: 12px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 8px;
    pointer-events: none;
    font-size: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

/* Enhanced Text Styling for Charts */
.chart text {
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
    font-weight: 600;
    fill: #f26822 !important;
    font-size: 14px !important;
}

/* Override for treemap text to be white */
#genre-treemap text {
    fill: white !important;
}

/* Override for pie chart text to be white */
#series-pie text {
    fill: white !important;
}

/* Simple treemap hover effects */
#genre-treemap .treemap-rect {
    transition: stroke-width 0.2s ease, opacity 0.2s ease;
}

.chart .axis text {
    fill: #fff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
}

.chart .tick text {
    fill: #fff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
}

.chart .axis-label {
    fill: #f26822 !important;
    font-size: 16px !important;
    font-weight: bold !important;
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
}

/* Specific styling for axis tick numbers */
.chart g.axis g.tick text,
.chart .axis .tick text,
svg .axis text,
svg g.axis text {
    fill: #fff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
}

/* Interactive Elements */
.interactive-element {
    cursor: pointer;
    transition: all 0.3s ease;
}

.interactive-element:hover {
    stroke-width: 2px;
    filter: brightness(1.1);
}

/* Bar Chart Styles */
.bar {
    fill: #3498db;
    transition: fill 0.3s ease;
}

.bar:hover {
    fill: #2980b9;
}

/* Pie Chart Styles */
.arc path {
    stroke: white;
    stroke-width: 2px;
}


/* Network Styles */
.node {
    stroke: #fff;
    stroke-width: 2px;
    cursor: pointer;
}

.link {
    stroke: #999;
    stroke-opacity: 0.6;
}

/* Heatmap Styles */
.heatmap-cell {
    stroke: white;
    stroke-width: 1px;
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1.2rem;
    color: #666;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-right: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    margin-top: 40px;
    background: #111;
    color: white;
    border-radius: 10px;
    border: 2px solid #f26822;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        max-width: 100%;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    nav {
        flex-direction: column;
        gap: 15px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-container {
        width: 100%;
        margin: 0;
        padding: 15px;
        overflow-x: auto;
    }
    
    .chart-container.wide {
        width: 100%;
    }
    
    .chart {
        min-height: 300px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 15px;
        min-width: 320px;
    }
    
    .chart.large {
        min-height: 400px;
        min-width: 100%;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .chart-header h3 {
        font-size: 1.1rem;
    }
    
    .stats-category h2 {
        font-size: 1.5rem;
    }
    
    /* Mobile-specific chart text sizing */
    .chart text {
        font-size: 13px !important;
        font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
    }

    .chart .axis text {
        font-size: 12px !important;
        font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
    }

    .chart .tick text {
        font-size: 12px !important;
        font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
    }

    .chart .axis-label {
        font-size: 15px !important;
        font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
    }
    
    /* Ensure SVG charts are responsive */
    .chart svg {
        max-width: 100%;
        height: auto;
        min-width: 300px;
    }
    
    /* Specific adjustments for complex charts */
    #genre-treemap,
    #publication-timeline,
    #genre-sankey,
    #age-genre-matrix {
        min-width: 100%;
        overflow-x: auto;
    }
    
    /* Tooltip adjustments for mobile */
    .tooltip {
        font-size: 11px;
        padding: 8px;
        max-width: 200px;
        word-wrap: break-word;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    .stats-category {
        padding: 15px;
        margin-bottom: 30px;
    }
    
    .chart-container {
        padding: 10px;
    }
    
    .chart {
        padding: 10px;
        min-height: 250px;
    }
    
    .chart.large {
        min-height: 300px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .stats-category h2 {
        font-size: 1.3rem;
    }
    
    .chart-header h3 {
        font-size: 1rem;
    }
    
    /* Even smaller text for very small screens */
    .chart text {
        font-size: 12px !important;
        font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
    }

    .chart .axis text {
        font-size: 11px !important;
        font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
    }

    .chart .tick text {
        font-size: 11px !important;
        font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
    }

    .chart .axis-label {
        font-size: 13px !important;
        font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif !important;
    }
    
    .chart-description {
        font-size: 0.85rem;
    }
    
    .nav-link {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    footer {
        padding: 20px;
        font-size: 1rem;
    }
}

/* Mobile landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .chart {
        min-height: 250px;
    }
    
    .chart.large {
        min-height: 300px;
    }
}

/* Ensure charts don't break on very wide mobile screens */
@media (min-width: 768px) and (max-width: 1024px) {
    .chart-container {
        width: 95%;
    }
    
    .chart svg {
        max-width: 100%;
    }
}

/* Chord Diagram Specific Styles */
.chord-diagram {
    height: 105vh !important;
    max-height: 105vh !important;
    min-height: 80vh;
    padding: 5px !important;
}

@media (max-width: 768px) {
    .chord-diagram {
        height: 90vh !important;
        min-height: 70vh;
    }
}

@media (max-width: 480px) {
    .chord-diagram {
        height: 80vh !important;
        min-height: 60vh;
    }
}

