@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Cairo:wght@300;400;600;700&display=swap');

:root {
    --primary-gradient: linear-gradient(-135deg, #af41b1 0%, #216d9e 100%);
    --primary-color: #152c5b;
    --secondary-color: #7c3fa3;
    --background: #f8faff;
    --card-bg: white;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --success: #48bb78;
    --warning: #ed8936;
    --danger: #f56565;
    --border: #e2e8f0;
    --shadow: 0 4px 20px rgba(104, 121, 227, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    direction: rtl;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--primary-gradient);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow);
}

.header h1 {
    font-family: 'Amiri', serif;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Navigation */
.nav {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 1rem 0;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.7rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
}

.nav-btn:hover, .nav-btn.active {
    background: var(--primary-gradient);
    border: white;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(104, 121, 227, 0.3);
}
button[disabled], button[disabled]:hover{
  border: 1px solid #999999 !important;
  background: #cccccc !important;
  transform: none !important;
  color: #666666 !important;
  box-shadow: none !important;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h2 {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.stat-card {
    background: var(--secondary-color);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    transform: scale(1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: scale(1.05);
}

.stat-card h3 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.stat-card p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

th, td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

tr:hover {
    background: #f7fafc;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    margin-left: 0.5rem;
}

.rank-1 { background: #e1bf01; }
.rank-2 { background: #c0c0c0; }
.rank-3 { background: #cd7f32; }
.rank-other { background: var(--primary-color); }

/* Chart Container */
.chart-container {
    position: relative;
    min-height: 600px;
    height: auto;
    width: 100%;    
    margin: 2rem 0;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading i {
    font-size: 3rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

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

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

/* Countdown Timer */
.countdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--danger);
    font-weight: 600;
}

.countdown.safe {
    color: var(--success);
}

.countdown.warning {
    color: var(--warning);
}

/* Records Section */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.record-card {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.record-card h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.record-item:last-child {
    border-bottom: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .nav-container {
        padding: 0.5rem;
    }
    
    .nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .chart-container {
        height: 300px;
    }
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-safe {
    background: #c6f6d5;
    color: #22543d;
}

.status-warning {
    background: #fef5e7;
    color: #c05621;
}

.status-danger {
    background: #fed7d7;
    color: #c53030;
}

.admin-only {
    display: none !important;
}

@keyframes spinner {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

#nedhalIcon {
    animation: spinner 2s infinite;
}