/* Stats Page Styles - Fully Responsive */

/* Hide scrollbar globally */
::-webkit-scrollbar {
    display: none;
}

html {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    color: #ffffff;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ef4444, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.header p {
    color: #a3a3a3;
    font-size: 1rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #a3a3a3;
    text-decoration: none;
    margin-bottom: 20px;
    transition: color 0.4s;
    font-size: 0.95rem;
}

.back-link:hover {
    color: #ffffff;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(239, 68, 68, 0.3);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ef4444, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    word-break: break-word;
}

.stat-label {
    color: #a3a3a3;
    font-size: 0.9rem;
    margin-top: 8px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.chart-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    overflow: hidden;
}

.chart-card h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: #ffffff;
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Regions List */
.regions-list {
    list-style: none;
    max-height: 250px;
    overflow-y: auto;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.regions-list::-webkit-scrollbar {
    display: none;
}

.regions-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.regions-list li:last-child {
    border-bottom: none;
}

.region-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.region-count {
    color: #ef4444;
    font-weight: 600;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px;
    color: #a3a3a3;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(239, 68, 68, 0.2);
    border-top-color: #ef4444;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.85rem;
}

.footer a {
    color: #ef4444;
    text-decoration: none;
}

/* Tablet */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .stat-value {
        font-size: 2rem;
    }

    .chart-card {
        padding: 20px;
    }
}

/* Small Tablet / Large Phone */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .header {
        margin-bottom: 28px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px 12px;
        border-radius: 12px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-card {
        padding: 16px;
        border-radius: 12px;
    }

    .chart-card h3 {
        font-size: 1rem;
        margin-bottom: 16px;
    }

    .chart-container {
        height: 220px;
    }

    .regions-list {
        max-height: 220px;
    }

    .regions-list li {
        padding: 10px 0;
    }

    .region-name {
        font-size: 0.9rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .back-link {
        font-size: 0.85rem;
        margin-bottom: 16px;
    }

    .header {
        margin-bottom: 24px;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .header p {
        font-size: 0.9rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 24px;
    }

    .stat-card {
        padding: 20px 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    .stat-value {
        font-size: 1.75rem;
        order: 2;
    }

    .stat-label {
        margin-top: 0;
        font-size: 0.9rem;
        order: 1;
    }

    .charts-grid {
        gap: 12px;
        margin-bottom: 24px;
    }

    .chart-card {
        padding: 14px;
    }

    .chart-card h3 {
        font-size: 0.95rem;
        margin-bottom: 14px;
    }

    .chart-container {
        height: 200px;
    }

    .regions-list {
        max-height: 200px;
    }

    .regions-list li {
        padding: 8px 0;
    }

    .region-name {
        font-size: 0.85rem;
        gap: 6px;
    }

    .region-count {
        font-size: 0.9rem;
    }

    .footer {
        padding: 16px;
        font-size: 0.8rem;
    }
}

/* Small phones */
@media (max-width: 360px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .chart-container {
        height: 180px;
    }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 12px;
    }

    .header {
        margin-bottom: 16px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header p {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 16px;
    }

    .chart-card {
        padding: 12px;
    }

    .chart-card h3 {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }

    .chart-container {
        height: 150px;
    }

    .regions-list {
        max-height: 150px;
    }

    .footer {
        padding: 12px;
    }
}

/* Touch device improvements */
@media (hover: none) {
    .stat-card:hover {
        transform: none;
    }

    .back-link:active {
        color: #ffffff;
    }
}

.link {
    color: orange;
    text-decoration: none;
    transition: all 0.5s;
}

.link:hover {
    color: #ff6347;
    text-decoration: underline;
}