@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

* {
    box-sizing: border-box;
}

.gv-province-chart-container {
    font-family: 'Vazirmatn', 'Vazir', 'Shabnam', 'Samim', 'Noto Sans Arabic', 'Tahoma', sans-serif;
    direction: rtl;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin: 20px auto;
    padding: 30px;
    max-width: 1200px;
}

/* Header */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #f0f0f0;
}

.chart-header h3 {
    font-size: 28px;
    font-weight: 700;
    color: #1976d2;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #1976d2, #1565c0);
}

.btn-success {
    background: linear-gradient(135deg, #388e3c, #2e7d32);
}

.btn-info {
    background: linear-gradient(135deg, #0288d1, #0277bd);
}

.btn-warning {
    background: linear-gradient(135deg, #f57c00, #ef6c00);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

/* Stats Summary */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 40px;
    opacity: 0.8;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

/* Chart */
.chart-wrapper {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    height: 500px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

#province-chart {
    max-height: 450px;
    width: 100% !important;
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.search-input, .sort-select, .rows-select {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.search-input:focus, .sort-select:focus, .rows-select:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

/* Table */
.table-responsive {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.provinces-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

.provinces-table th {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    padding: 15px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.provinces-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.provinces-table th.sortable:hover {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
}

.provinces-table th.sort-asc::after {
    content: '↑';
    position: absolute;
    left: 8px;
    font-weight: bold;
}

.provinces-table th.sort-desc::after {
    content: '↓';
    position: absolute;
    left: 8px;
    font-weight: bold;
}

.provinces-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.table-row {
    transition: all 0.3s ease;
}

.table-row:hover {
    background: #f8f9fa;
    transform: scale(1.01);
}

/* Table Columns */
.rank-col {
    font-weight: 600;
    color: #666;
    width: 60px;
}

.province-col {
    text-align: right !important;
    font-weight: 600;
    color: #1976d2;
    min-width: 120px;
}

.province-name {
    font-size: 15px;
}

/* Number Badges */
.number-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    min-width: 50px;
}

.number-badge.total {
    background: #e3f2fd;
    color: #1976d2;
}

.number-badge.completed {
    background: #e8f5e8;
    color: #388e3c;
}

.number-badge.pending {
    background: #fff3e0;
    color: #f57c00;
}

/* Percentage Badge */
.percentage-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    min-width: 60px;
}

.percentage-badge.status-excellent {
    background: #e8f5e8;
    color: #2e7d32;
}

.percentage-badge.status-good {
    background: #e3f2fd;
    color: #1976d2;
}

.percentage-badge.status-average {
    background: #fff3e0;
    color: #f57c00;
}

.percentage-badge.status-poor {
    background: #ffebee;
    color: #d32f2f;
}

.percentage-badge.status-critical {
    background: #ffebee;
    color: #c62828;
}

/* Mini Progress Bar */
.mini-progress {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.mini-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
}

.mini-progress-bar.status-excellent {
    background: linear-gradient(90deg, #4caf50, #8bc34a);
}

.mini-progress-bar.status-good {
    background: linear-gradient(90deg, #2196f3, #64b5f6);
}

.mini-progress-bar.status-average {
    background: linear-gradient(90deg, #ff9800, #ffb74d);
}

.mini-progress-bar.status-poor {
    background: linear-gradient(90deg, #f44336, #ef5350);
}

.mini-progress-bar.status-critical {
    background: linear-gradient(90deg, #d32f2f, #f44336);
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

.status-badge.status-excellent {
    background: #e8f5e8;
    color: #2e7d32;
}

.status-badge.status-good {
    background: #e3f2fd;
    color: #1976d2;
}

.status-badge.status-average {
    background: #fff3e0;
    color: #f57c00;
}

.status-badge.status-poor {
    background: #ffebee;
    color: #d32f2f;
}

.status-badge.status-critical {
    background: #ffebee;
    color: #c62828;
}

/* Pagination */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

#page-info {
    font-weight: 600;
    color: #666;
}

/* Loading */
.loading-container {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gv-province-chart-container {
        margin: 10px;
        padding: 20px;
    }

    .chart-header {
        flex-direction: column;
        gap: 15px;
    }

    .chart-controls {
        justify-content: center;
        width: 100%;
    }

    .btn {
        flex: 1;
        min-width: auto;
    }

    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input, .sort-select {
        width: 100%;
    }

    .provinces-table {
        font-size: 12px;
    }

    .provinces-table th,
    .provinces-table td {
        padding: 8px 6px;
    }

    .table-pagination {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .stats-summary {
        grid-template-columns: 1fr;
    }

    .chart-controls {
        flex-direction: column;
    }

    .provinces-table th,
    .provinces-table td {
        padding: 6px 4px;
        font-size: 11px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Print Styles */
@media print {
    .chart-controls, .table-controls, .table-pagination {
        display: none !important;
    }

    .gv-province-chart-container {
        box-shadow: none;
        margin: 0;
        padding: 20px;
    }

    .provinces-table {
        font-size: 12px;
    }
}
