/* History Page Styles */

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2rem;
}

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

.stat-content .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.stat-content .stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Content Area */
.content-area {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.list-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.list-actions {
    display: flex;
    gap: 0.75rem;
}

.list-actions select {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
}

.list-actions select:focus {
    outline: none;
    border-color: var(--primary);
}

/* History List */
.history-list {
    min-height: 300px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* History Item */
.history-item {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.2s;
}

.history-item:hover {
    background: var(--gray-50);
}

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

.item-score {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    flex-shrink: 0;
}

.item-score.excellent { background: linear-gradient(135deg, #10b981, #059669); }
.item-score.good { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.item-score.average { background: linear-gradient(135deg, #f59e0b, #d97706); }
.item-score.poor { background: linear-gradient(135deg, #ef4444, #dc2626); }

.score-num {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.score-label {
    font-size: 0.7rem;
    opacity: 0.9;
}

.item-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.item-type {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 0.35rem;
}

.item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.35rem;
}

.item-preview {
    font-size: 0.85rem;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    justify-content: center;
    flex-shrink: 0;
}

.item-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-700);
}

.item-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}

.item-btn.danger:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: #fef2f2;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

.page-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay:not([hidden]) {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

/* Modal Content */
.modal-score-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-score-badge {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
}

.modal-score-badge .score {
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-score-badge .unit {
    font-size: 0.7rem;
    opacity: 0.9;
}

.modal-score-badge.excellent { background: linear-gradient(135deg, #10b981, #059669); }
.modal-score-badge.good { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.modal-score-badge.average { background: linear-gradient(135deg, #f59e0b, #d97706); }
.modal-score-badge.poor { background: linear-gradient(135deg, #ef4444, #dc2626); }

.modal-score-info h4 {
    font-size: 1rem;
    color: var(--gray-800);
}

.modal-score-info p {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.modal-scores-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.modal-score-item {
    text-align: center;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.modal-score-item .val {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.modal-score-item .lbl {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.modal-section {
    margin-bottom: 1rem;
}

.modal-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-section p, .modal-section li {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.6;
}

.modal-section ul {
    list-style: none;
}

.modal-section li {
    padding: 0.3rem 0;
    padding-left: 1rem;
    position: relative;
}

.modal-section li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
}

/* Toast */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 0.75rem 1.25rem;
    background: var(--gray-800);
    color: white;
    border-radius: var(--radius);
    font-size: 0.9rem;
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .history-item {
        grid-template-columns: 60px 1fr;
    }
    
    .item-actions {
        display: none;
    }
    
    .list-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .modal-scores-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-content .stat-value {
        font-size: 1.25rem;
    }
    
    .history-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .item-score {
        width: 50px;
        height: 50px;
    }
    
    .score-num {
        font-size: 1.25rem;
    }
}
