/* Dashboard Styles */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
}

body {
    background-color: var(--background-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
}

.dashboard-container {
    padding: 2rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Loading State */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 3rem;
}

.spinner-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
}

.main-spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid var(--primary-color);
    border-radius: 50%;
    opacity: 0.3;
    animation: pulse 1.5s ease-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 0.1; }
    100% { transform: scale(1); opacity: 0.3; }
}

/* Ensure dashboard uses full width */
.dashboard-container {
    max-width: 100% !important;
    padding: 0 1rem !important;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 0.1; }
    100% { transform: scale(1); opacity: 0.3; }
}

.loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.loading-subtext {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Error State */
.error-state {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 500px;
    margin: 3rem auto;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.error-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.error-description {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1.5rem;
}

.welcome-section {
    flex: 1;
    min-width: 300px;
}

.dashboard-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-btn.secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.action-btn.secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.primary {
    border-left-color: var(--primary-color);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.info {
    border-left-color: var(--info-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Section Cards */
.section-card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title i {
    color: var(--primary-color);
}

.view-all-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.view-all-link:hover {
    gap: 0.75rem;
    color: var(--secondary-color);
}

/* Recent Exams */
.recent-exams-container {
    display: grid;
    gap: 1rem;
}

.exam-item {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid;
    transition: all 0.3s ease;
    cursor: pointer;
}

.exam-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.exam-item.excellent {
    border-left-color: var(--success-color);
}

.exam-item.good {
    border-left-color: var(--info-color);
}

.exam-item.average {
    border-left-color: var(--warning-color);
}

.exam-item.needs-improvement {
    border-left-color: var(--danger-color);
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.exam-info {
    flex: 1;
}

.exam-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.exam-subject {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: white;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.exam-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.exam-score-badge {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    text-align: center;
    min-width: 80px;
}

.exam-percentage {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.exam-percentage.excellent {
    color: var(--success-color);
}

.exam-percentage.good {
    color: var(--info-color);
}

.exam-percentage.average {
    color: var(--warning-color);
}

.exam-percentage.needs-improvement {
    color: var(--danger-color);
}

.exam-score-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
}

.exam-details {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.exam-detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.exam-detail-item i {
    color: var(--primary-color);
}

/* Subject Performance */
.subject-performance-container {
    display: grid;
    gap: 1rem;
}

.subject-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.subject-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.subject-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.subject-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.subject-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.subject-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.subject-stat {
    text-align: center;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
}

.subject-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.subject-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.chart-header {
    margin-bottom: 1.5rem;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* Subscriptions */
.subscriptions-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.subscription-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    width: 100%;
}

.subscription-badge:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.subscription-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.subscription-name {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-primary-small {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary-small:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    color: white;
}

/* Admin Validation Section */
.admin-validation-section {
    border-left: 4px solid #f59e0b;
}

.admin-pending-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.admin-pending-item {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-radius: 12px;
    padding: 1.25rem;
    border-left: 4px solid #f59e0b;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-pending-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

.admin-pending-subject {
    font-size: 1rem;
    font-weight: 700;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f59e0b;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.2rem 0.75rem;
    border-radius: 12px;
    width: fit-content;
}

.admin-pending-action {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 0.25rem;
}

.admin-all-clear {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-radius: 12px;
    color: #065f46;
    font-weight: 600;
    grid-column: 1 / -1;
}

.admin-all-clear i {
    font-size: 1.5rem;
    color: var(--success-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-title {
        font-size: 1.5rem;
    }

    .quick-actions {
        width: 100%;
    }

    .action-btn {
        flex: 1;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .exam-header {
        flex-direction: column;
    }

    .exam-score-badge {
        align-self: flex-start;
    }

    .subject-stats {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .section-card {
        padding: 1.25rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-icon {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* ──── QOTD Performance Section ──── */

.qotd-section {
    border-top: 3px solid var(--secondary-color);
}

.qotd-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.qotd-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.qotd-stat-card {
    background: var(--background-color);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.qotd-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.qotd-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.qotd-insights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.qotd-insight-card {
    background: var(--background-color);
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.qotd-insight-card h4 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.qotd-strengths h4 { color: var(--success-color); }
.qotd-weaknesses h4 { color: var(--danger-color); }

.qotd-insight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
}

.qotd-insight-item:last-child { border-bottom: none; }

.qotd-insight-topic {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.qotd-insight-subject {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qotd-insight-accuracy {
    font-weight: 600;
    font-size: 0.9rem;
}

.qotd-insight-count {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.qotd-no-data {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}

/* QOTD History */
.qotd-history-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
}

.qotd-history-item:last-child { border-bottom: none; }

.qotd-history-item > i {
    font-size: 1.1rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.qotd-status-correct { color: var(--success-color); }
.qotd-status-incorrect { color: var(--danger-color); }
.qotd-status-skipped { color: var(--text-secondary); }

.qotd-history-content { flex: 1; min-width: 0; }

.qotd-history-preview {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.qotd-history-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

@media (max-width: 768px) {
    .qotd-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .qotd-insights-grid {
        grid-template-columns: 1fr;
    }
}
