/* SYNGAP1 Census Statistics - Custom Styles */
/* Extends the main style.css for statistics dashboard specific components */

/* Rapid Growth Alert Section */
.growth-alert-section {
    background: linear-gradient(135deg, rgba(108, 117, 125, 0.2) 0%, rgba(73, 80, 87, 0.3) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.growth-alert-card {
    background: rgba(33, 37, 41, 0.8);
    border: 1px solid rgba(0, 123, 255, 0.2);
    border-radius: 15px;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.growth-factor-card {
    transition: all var(--transition-normal);
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.growth-factor-card:hover {
    background: rgba(0, 123, 255, 0.1);
    transform: translateX(5px);
    border-color: rgba(0, 123, 255, 0.3);
}

/* Growth Potential Indicator */
#growth-indicator {
    color: #20c997;
    font-size: 2rem;
    animation: trendPulse 3s ease-in-out infinite;
}

@keyframes trendPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(33, 37, 41, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.spinner-container {
    text-align: center;
    color: var(--light-color);
}

.spinner-container .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Statistics Cards */
.stat-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 100%;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--light-color);
    margin: 0.5rem 0;
    line-height: 1;
}

.stat-card h6 {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-card small {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

/* Chart Containers */
.chart-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Chart.js Legend Visibility */
.chart-container canvas + div,
.chart-card canvas + div {
    color: #ffffff !important;
}

/* Ensure legend text is visible on dark sections */
.chart-container .chartjs-legend,
.chart-container .chartjs-legend-item {
    color: #ffffff !important;
}

.chart-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chart-header {
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 1rem;
}

.chart-header h4 {
    color: var(--light-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.chart-header p {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.8);
}

.chart-canvas {
    position: relative;
    height: 300px !important;
    width: 100% !important;
    flex-grow: 1;
}

/* Market share chart specific - ensure it's round */
.chart-canvas #market-share-chart {
    max-width: 100%;
    max-height: 100%;
}

/* Chart Controls */
.chart-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.chart-controls .btn-group .btn {
    border-radius: 20px;
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.chart-controls .btn-group .btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.chart-controls .btn-group .btn:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.projection-controls {
    margin-top: 0.5rem;
}

.projection-controls select {
    max-width: 200px;
}

/* Regional Growth Stats */
.regional-stats {
    max-height: 500px; /* Increased to fit 6 regions without scrolling */
    overflow-y: auto;
    padding-right: 0.5rem;
}

.doubling-stats {
    max-height: 500px; /* Increased for better visibility */
    overflow-y: auto;
    padding-right: 0.5rem;
}

.insights-container {
    max-height: 600px; /* Increased for planning insights */
    overflow-y: auto;
    padding-right: 0.5rem;
}

.regional-stat-item,
.doubling-stat-item,
.insight-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    border-left: 3px solid var(--primary-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.regional-stat-item h6,
.doubling-stat-item h6,
.insight-item h6 {
    color: var(--light-color);
    font-weight: 600;
}

.regional-stat-item p,
.doubling-stat-item p,
.insight-item p {
    color: rgba(255, 255, 255, 0.8);
}

.progress {
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 10px;
    transition: width var(--transition-normal);
}

/* Milestone Timeline */
.milestone-container {
    padding: 1rem 0;
    max-height: 600px; /* Increased height */
    overflow-y: auto;
}

.timeline {
    position: relative;
    padding: 1rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-color), var(--success-color));
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.2rem; /* Reduced from 2rem for more compact layout */
    display: flex;
    align-items: center;
}

.timeline-left {
    justify-content: flex-end;
    text-align: right;
}

.timeline-left .timeline-content {
    margin-right: 3rem;
}

.timeline-right {
    justify-content: flex-start;
    text-align: left;
}

.timeline-right .timeline-content {
    margin-left: 3rem;
}

.timeline-marker {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: var(--light-color);
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.timeline-marker i {
    font-size: 0.875rem;
}

.timeline-content {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0.8rem; /* Reduced from 1rem for more compact layout */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.timeline-header h6 {
    color: var(--light-color);
    font-weight: 600;
}

.timeline-content p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

/* Insight Items */
.insight-header {
    display: flex;
    align-items: center;
}

.insight-header i {
    font-size: 1.25rem;
}

.insight-item p {
    line-height: 1.4;
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .stat-card .stat-number {
        font-size: 1.5rem;
    }
    
    .chart-canvas {
        height: 250px !important;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chart-controls .btn-group {
        width: 100%;
    }
    
    .chart-controls .btn-group .btn {
        flex: 1;
    }
    
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item {
        justify-content: flex-start !important;
        text-align: left !important;
    }
    
    .timeline-left .timeline-content,
    .timeline-right .timeline-content {
        margin-left: 3rem;
        margin-right: 0;
    }
    
    .timeline-marker {
        left: 20px;
    }
    
    .timeline-content {
        max-width: calc(100% - 4rem);
    }
}

@media (max-width: 576px) {
    .chart-container,
    .chart-card {
        padding: 1rem;
    }
    
    .stat-card {
        padding: 1rem 0.5rem;
    }
    
    .chart-canvas {
        height: 200px !important;
    }
    
    .regional-stats {
        max-height: 400px; /* Better mobile height for 6 regions */
    }

    .doubling-stats {
        max-height: 400px;
    }

    .insights-container {
        max-height: 450px; /* Better mobile height for insights */
    }
    
    .milestone-container {
        max-height: 450px; /* Better mobile height */
    }
}

/* Dark theme text improvements */
.text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Dark theme enhancements for charts section */
.bg-light .chart-card {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.bg-light .chart-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* Chart.js Legend Specific Styling */
canvas[id*="-chart"] {
    position: relative;
}

/* Force legend visibility for all chart types */
.chart-card .chart-canvas,
.chart-container .chart-canvas {
    position: relative;
}

.chart-card .chart-canvas::after,
.chart-container .chart-canvas::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* Animation for loading stats */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card .stat-number {
    animation: countUp 0.6s ease-out;
}

/* Hover effects for interactive elements */
.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all var(--transition-normal);
}

.regional-stat-item:hover,
.doubling-stat-item:hover,
.insight-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
    transition: all var(--transition-fast);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Custom scrollbar for better UX */
.regional-stats::-webkit-scrollbar,
.doubling-stats::-webkit-scrollbar,
.insights-container::-webkit-scrollbar,
.milestone-container::-webkit-scrollbar {
    width: 6px;
}

.regional-stats::-webkit-scrollbar-track,
.doubling-stats::-webkit-scrollbar-track,
.insights-container::-webkit-scrollbar-track,
.milestone-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.regional-stats::-webkit-scrollbar-thumb,
.doubling-stats::-webkit-scrollbar-thumb,
.insights-container::-webkit-scrollbar-thumb,
.milestone-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.regional-stats::-webkit-scrollbar-thumb:hover,
.doubling-stats::-webkit-scrollbar-thumb:hover,
.insights-container::-webkit-scrollbar-thumb:hover,
.milestone-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
    opacity: 0.8;
}

/* Badge styling improvements */
.badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 20px;
    font-weight: 500;
}

/* Button improvements */
.btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: var(--light-color);
}

/* Form select improvements */
.form-select {
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--light-color);
    backdrop-filter: blur(5px);
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background-color: rgba(255, 255, 255, 0.15);
}

.form-select option {
    background-color: rgba(33, 37, 41, 0.95);
    color: var(--light-color);
}

/* Print styles */
@media print {
    .loading-overlay,
    .btn,
    .dropdown,
    nav,
    footer {
        display: none !important;
    }
    
    .chart-container,
    .chart-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .stat-card {
        background: white !important;
        border: 1px solid #ddd !important;
    }
}