/* History Page Specific Styles */
:root {
    --history-primary: #1565c0;
    --history-border: #e0e7ff;
}

.filter-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.refresh-btn {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: rotate(180deg);
}

.refresh-btn.refreshing {
    pointer-events: none;
}

.refresh-btn.refreshing i {
    animation: spin 1s linear infinite;
}

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

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

.loading-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.loading-state p {
    font-size: 1rem;
    margin: 0;
}

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

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* History Content */
.history-content {
    background: transparent;
}

/* Empty State */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* History List */
.history-list {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.exam-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 1rem;
}

.exam-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
    font-size: 1.5rem;
    color: white;
}

.exam-icon.mathematics {
    background: linear-gradient(135deg, #1565c0, #1976d2);
}

.exam-icon.physics {
    background: linear-gradient(135deg, #2e7d32, #388e3c);
}

.exam-icon.chemistry {
    background: linear-gradient(135deg, #f57c00, #ff9800);
}

.exam-main-info {
    flex: 1;
    margin-right: 1rem;
}

.exam-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.exam-topic {
    font-size: 0.875rem;
    color: var(--primary);
    background: rgba(26, 35, 126, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.exam-meta {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-medium);
}

.exam-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.exam-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    min-width: 120px;
}

.exam-score {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: white;
    text-align: center;
    min-width: 80px;
}

.exam-score.excellent {
    background: var(--success);
}

.exam-score.good {
    background: var(--info);
}

.exam-score.average {
    background: var(--warning);
}

.exam-score.poor {
    background: var(--error);
}

.exam-questions {
    font-size: 0.875rem;
    color: var(--text-medium);
    text-align: center;
}

.exam-date {
    font-size: 0.875rem;
    color: var(--text-medium);
    text-align: right;
    margin-top: 0.25rem;
}

/* Materials Suggested */
.materials-suggested {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(245, 124, 0, 0.1);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--warning);
}

.materials-suggested i {
    font-size: 1rem;
}

/* Filter Select Styling */
.filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--text-dark);
    background-color: white;
    transition: var(--transition);
    font-family: inherit;
    box-sizing: border-box;
    cursor: pointer;
    min-width: 140px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

/* Modal styles for ExamDetailModal - extends base modal styles */
.exam-detail-modal .modal-content {
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.exam-detail-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.exam-detail-score {
    text-align: center;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.score-circle.excellent {
    background: linear-gradient(135deg, var(--success), #4caf50);
}

.score-circle.good {
    background: linear-gradient(135deg, var(--info), #03a9f4);
}

.score-circle.average {
    background: linear-gradient(135deg, var(--warning), #ff9800);
}

.score-circle.poor {
    background: linear-gradient(135deg, var(--error), #e57373);
}

.score-value {
    font-size: 1.5rem;
    line-height: 1;
}

.score-label {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.detail-item {
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: 8px;
    font-size: 0.875rem;
}

.exam-materials {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.exam-materials h4 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 600;
}

.materials-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.material-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 1rem 4rem;
    border-bottom: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: var(--bg-light);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 44px;
}

.material-item:hover {
    background: var(--border-light);
    transform: translateX(4px);
}

.material-item::before {
    content: "??";
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    z-index: 2;
}

.material-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-dark);
    padding-right: 1rem;
    line-height: 1.6;
    font-size: 0.95rem;
    z-index: 1;
    position: relative;
}

.material-arrow {
    color: var(--text-medium);
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    z-index: 1;
}

.material-item:hover .material-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .history-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .filter-controls {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .filter-select {
        min-width: 120px;
        flex: 1;
    }
    
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .exam-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }
    
    .exam-main-info {
        width: 100%;
        margin-right: 0;
    }
    
    .exam-stats {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: space-between;
    }
    
    .exam-meta {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .history-content {
        max-height: calc(100vh - 250px);
    }
    
    .exam-detail-modal .modal-content {
        width: 95%;
        max-width: none;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
    }
    
    .score-value {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .stats-overview {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .exam-item {
        padding: 0.75rem;
    }
    
    .history-content {
        max-height: calc(100vh - 200px);
    }
    
    .score-circle {
        width: 80px;
        height: 80px;
    }
    
    .score-value {
        font-size: 1rem;
    }
    
    .material-item {
        padding: 0.75rem 0.75rem 0.75rem 3rem;
    }
    
    .material-item::before {
        left: 1rem;
        font-size: 1rem;
    }
}