/**
 * Community Dashboard Styles
 * Version: 1.0
 */

/* Container & Layout */
.community-dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Header */
.dashboard-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.dashboard-header h1 {
    font-size: 32px;
    color: #333;
    margin-bottom: 10px;
}

.dashboard-subtitle {
    color: #666;
    font-size: 16px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.stat-icon {
    font-size: 48px;
    margin-right: 20px;
    opacity: 0.8;
}

.stat-content h3 {
    font-size: 14px;
    color: #666;
    margin: 0 0 5px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: #999;
    margin-top: 5px;
}

.stat-percent {
    font-size: 20px;
    font-weight: 600;
    margin-top: 5px;
}

/* Stat Card Colors */
.stat-total {
    border-left: 4px solid #4A90E2;
}

.stat-updated {
    border-left: 4px solid #5CB85C;
}

.stat-pending {
    border-left: 4px solid #F0AD4E;
}

.stat-heroes {
    border-left: 4px solid #9B59B6;
}

/* Color Classes */
.text-success { color: #5CB85C; }
.text-warning { color: #F0AD4E; }
.text-danger { color: #D9534F; }
.text-muted { color: #999; }

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* Dashboard Sections */
.dashboard-section {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.dashboard-section h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

/* Province Table */
.province-table table {
    width: 100%;
    border-collapse: collapse;
}

.province-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid #e9ecef;
}

.province-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.province-table tr:hover {
    background: #f8f9fa;
}

.rank-badge {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

.rank-1 { background: #FFD700; color: #333; }
.rank-2 { background: #C0C0C0; color: #333; }
.rank-3 { background: #CD7F32; color: #fff; }
.rank-4, .rank-5 { background: #e9ecef; color: #666; }

.province-name {
    font-weight: 500;
    color: #333;
}

.text-center {
    text-align: center;
}

/* Progress Bar */
.progress-bar {
    position: relative;
    background: #f0f0f0;
    border-radius: 10px;
    height: 24px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #4A90E2, #5BA0F2);
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

/* Other Provinces */
.other-provinces {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    font-size: 14px;
    color: #666;
}

/* Category Chart */
.category-item {
    margin-bottom: 20px;
}

.category-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.category-icon {
    font-size: 24px;
    margin-right: 10px;
}

.category-name {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.category-count {
    font-size: 14px;
    color: #666;
}

.category-bar {
    background: #f0f0f0;
    border-radius: 8px;
    height: 20px;
    overflow: hidden;
}

.category-fill {
    background: linear-gradient(90deg, #5CB85C, #6CC96C);
    height: 100%;
    border-radius: 8px;
    transition: width 0.3s ease;
}

/* Heroes Summary */
.heroes-summary {
    grid-column: span 2;
}

.heroes-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.hero-stat-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 16px;
}

/* Top Heroes */
.top-heroes {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.top-heroes h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.hero-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.hero-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.hero-card:hover {
    border-color: #4A90E2;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(74, 144, 226, 0.2);
}

.hero-medal {
    font-size: 48px;
    margin-bottom: 10px;
}

.hero-name {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.hero-province {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.hero-level {
    font-size: 14px;
    color: #4A90E2;
    margin-bottom: 5px;
}

.hero-score {
    font-size: 16px;
    font-weight: 600;
    color: #5CB85C;
}

/* Footer */
.dashboard-footer {
    text-align: center;
    padding: 30px 0;
    border-top: 2px solid #f0f0f0;
    margin-top: 40px;
    color: #666;
}

.dashboard-footer a {
    color: #4A90E2;
    text-decoration: none;
    margin: 0 10px;
}

.dashboard-footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .heroes-summary {
        grid-column: span 1;
    }
    
    .hero-cards {
        grid-template-columns: 1fr;
    }
    
    .heroes-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        font-size: 36px;
        margin-right: 15px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    .dashboard-section {
        padding: 20px;
    }
    
    .dashboard-header h1 {
        font-size: 24px;
    }
}

/* Print Styles */
@media print {
    .dashboard-footer {
        display: none;
    }
    
    .stat-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .dashboard-section {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* Loading State */
.dashboard-loading {
    text-align: center;
    padding: 100px 20px;
}

.dashboard-loading .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4A90E2;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Error State */
.dashboard-error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    text-align: center;
}