/**
 * Enhanced History Styles
 * Улучшенные стили для страницы истории
 */

/* ============ Page Header ============ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid #f0f0f0;
}

.history-title {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.history-subtitle {
    font-size: 16px;
    color: #7f8c8d;
}

/* ============ Statistics ============ */

.stats-container {
    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%);
    padding: 25px;
    border-radius: 16px;
    color: white;
    text-align: center;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============ Filters Section ============ */

.filters-section {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.filters-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-input,
.filter-select {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-input::placeholder {
    color: #bdc3c7;
}

/* ============ History Cards ============ */

.history-list {
    display: grid;
    gap: 20px;
}

.history-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.history-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #667eea;
}

/* Card Header */

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.history-card-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.scenario-icon {
    font-size: 18px;
}

.scenario-text {
    font-size: 13px;
}

.history-card-date {
    text-align: right;
}

.date-main {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.date-relative {
    display: block;
    font-size: 12px;
    color: #95a5a6;
    margin-top: 2px;
}

/* Card Body */

.history-card-body {
    margin-bottom: 20px;
}

.analysis-preview {
    font-size: 15px;
    line-height: 1.6;
    color: #34495e;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #7f8c8d;
}

.meta-icon {
    font-size: 16px;
}

.badge {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

/* Card Footer */

.history-card-footer {
    display: flex;
    gap: 10px;
}

/* ============ Buttons ============ */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #bdc3c7;
}

.btn-outline {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-icon-only {
    padding: 10px;
    width: 45px;
    height: 45px;
}

.btn-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.btn:hover .btn-icon {
    transform: translateX(3px);
}

/* ============ Pagination ============ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #2c3e50;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(.disabled) {
    border-color: #667eea;
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.pagination-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.pagination-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-dots {
    padding: 8px;
    color: #95a5a6;
}

.pagination-info {
    margin-left: 15px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
    color: #7f8c8d;
}

/* ============ States ============ */

.loading-state,
.error-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.error-state p,
.empty-state h2 {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 16px;
    color: #7f8c8d;
    margin-bottom: 25px;
}

.retry-btn,
.start-quiz-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.retry-btn:hover,
.start-quiz-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ============ Animations ============ */

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* Toast Notifications */

.toast {
    animation: slideInUp 0.3s ease-out;
}

/* ============ Responsive ============ */

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .filters-row {
        grid-template-columns: 1fr;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .history-card-header {
        flex-direction: column;
        gap: 10px;
    }

    .history-card-date {
        text-align: left;
    }

    .history-card-footer {
        flex-wrap: wrap;
    }

    .btn-primary {
        width: 100%;
    }

    .pagination {
        gap: 5px;
    }

    .pagination-btn {
        min-width: 35px;
        height: 35px;
        font-size: 12px;
    }

    .pagination-info {
        width: 100%;
        text-align: center;
        margin-left: 0;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .history-title {
        font-size: 24px;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 28px;
    }
}

/* ============ Dark Mode Support ============ */

@media (prefers-color-scheme: dark) {
    .history-card {
        background: #2c3e50;
        color: #ecf0f1;
    }

    .analysis-preview {
        background: #34495e;
        color: #ecf0f1;
    }

    .filter-input,
    .filter-select {
        background: #34495e;
        color: #ecf0f1;
        border-color: #4a5f7f;
    }

    .pagination-btn {
        background: #34495e;
        color: #ecf0f1;
        border-color: #4a5f7f;
    }
}

/* ============ Print Styles ============ */

@media print {
    .navbar,
    .footer,
    .filters-section,
    .pagination,
    .history-card-footer {
        display: none;
    }

    .history-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}