/* User Exams Page Styles */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #4facfe;
    --warning-color: #43e97b;
    --danger-color: #f093fb;
    --text-color: #222;
    --muted-color: #666;
    --border-color: #e9ecef;
    --background-light: #f8f9fa;
    --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.1);
    --border-radius: 15px;
    --border-radius-sm: 8px;
}

body {
    background: white;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding-top: 0;
}

/* Navigation styles */
.navbar-nav .nav-link {
    color: #333 !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0 2px;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
    background: rgba(102, 126, 234, 0.1);
}

.navbar-nav .nav-link.active {
    color: var(--primary-color) !important;
    background: rgba(102, 126, 234, 0.15);
    font-weight: 600;
}

.dropdown-menu {
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dropdown-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

/* ── Hero header (full-width, matches subjects_page) ── */
.exams-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 1.25rem 0 1rem;
    text-align: center;
}

.exams-hero h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.exams-hero__sub {
    font-size: 0.92rem;
    opacity: 0.9;
    max-width: 540px;
    margin: 0 auto 0.75rem;
}

.exams-hero__actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.exams-hero__actions .btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.45rem 1rem;
}

.exams-hero__actions .btn-light {
    background: rgba(255,255,255,0.95);
    color: #4f46e5;
    border: none;
}

.exams-hero__actions .btn-light:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.exams-hero__actions .btn-outline-light {
    border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    background: transparent;
}

.exams-hero__actions .btn-outline-light:hover {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
}

/* ── How It Works guide (matches subjects_page tip-card style) ── */
.exams-guide {
    margin: 15px;
    padding: 0;
}

.exams-guide__inner {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 1.5rem 2rem;
}

.exams-guide__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.exams-guide__title i {
    color: #4f46e5;
}

.exams-guide__steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.exams-guide__card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #f0f1f3;
    transition: transform 0.2s;
}

.exams-guide__card:hover {
    transform: translateY(-2px);
}

.exams-guide__number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.exams-guide__content h5 {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.2rem 0;
}

.exams-guide__content p {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

.exams-guide__content a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.exams-guide__content a:hover {
    text-decoration: underline;
}

.exams-guide__note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #92400e;
    line-height: 1.5;
}

.exams-guide__note i {
    color: #f59e0b;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.exams-guide__note a {
    color: #92400e;
    font-weight: 600;
    text-decoration: underline;
}

/* Main container */
.main-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    margin: 15px;
    padding: 20px;
    max-width: 100%;
}

/* Section cards */
.section-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    width: 100%;
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.section-header .icon {
    font-size: 1.2rem;
    margin-right: 8px;
    color: var(--secondary-color);
}

/* Paper cards */
.paper-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.paper-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.paper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.paper-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.paper-type {
    font-size: 0.9rem;
    color: var(--muted-color);
    background: var(--background-light);
    padding: 4px 8px;
    border-radius: 5px;
}

/* Paper metadata */
.paper-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--muted-color);
}

.meta-icon {
    color: var(--secondary-color);
}

/* Progress section */
.progress-section {
    background: var(--background-light);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-label {
    font-weight: 500;
    color: #495057;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--warning-color));
    transition: width 0.3s ease;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #6c757d;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.status-in-progress {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

.status-not-started {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.status-processing {
    background: #e0e7ff;
    color: #3730a3;
    border: 1px solid #6366f1;
    animation: processing-pulse 2s ease-in-out infinite;
}

/* Action buttons */
.paper-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    color: white;
}

.action-btn.secondary {
    background: var(--background-light);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.action-btn.secondary:hover {
    background: #e9ecef;
    color: var(--primary-color);
}

.action-btn.danger {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

.action-btn.danger:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    color: white;
}

.action-btn.warning {
    background: #ffc107;
    color: #212529;
    border: 1px solid #ffc107;
}

.action-btn.warning:hover {
    background: #e0a800;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
    color: #212529;
}

/* Form controls */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid var(--border-color);
    padding: 12px 15px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: white;
    color: var(--text-color);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Filter controls */
.filter-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
    margin-bottom: 0;
}

.filter-controls label {
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

#subjectFilter {
    flex: 0 1 420px;
    width: min(100%, 420px);
    max-width: 100%;
}

/* Button improvements */
.btn-lg {
    padding: 15px 30px;
    font-size: 1.1rem;
}

/* Messages */
.loading-message {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 2rem;
}

.no-papers-message {
    text-align: center;
    color: var(--muted-color);
    padding: 60px 40px;
}

.no-papers-message h4 {
    color: var(--text-color);
    margin-bottom: 10px;
}

.no-papers-message .text-muted {
    margin-bottom: 30px;
}

/* Alerts */
.alert {
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: none;
}

.alert-info {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border: 1px solid #2196f3;
    color: #1976d2;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3e0, #fce4ec);
    border: 1px solid #ff9800;
    color: #f57c00;
}

/* Delete modal */
.delete-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 2rem;
    box-sizing: border-box;
}

.delete-modal-content {
    background: white;
    border-radius: var(--border-radius);
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.delete-modal-icon {
    font-size: 3rem;
    color: #dc3545;
    margin-bottom: 1rem;
}

.delete-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.delete-modal-text {
    color: var(--muted-color);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.delete-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.delete-modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delete-modal-btn.cancel {
    background: var(--background-light);
    color: var(--muted-color);
    border: 1px solid #dee2e6;
}

.delete-modal-btn.cancel:hover {
    background: #e9ecef;
}

.delete-modal-btn.confirm {
    background: #dc3545;
    color: white;
}

.delete-modal-btn.confirm:hover {
    background: #c82333;
}

/* Restart modal specific styles */
.restart-icon {
    color: #ffc107 !important;
}

.delete-modal-btn.restart-confirm {
    background: #ffc107;
    color: #212529;
}

.delete-modal-btn.restart-confirm:hover {
    background: #e0a800;
}

/* ── Icon action buttons ── */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
}

.icon-btn:hover {
    transform: translateY(-2px);
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Tooltip on hover */
.icon-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #1f2937;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

.icon-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2937;
    pointer-events: none;
    z-index: 10;
}

.icon-btn--primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
}

.icon-btn--primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: #fff;
}

.icon-btn--secondary {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.icon-btn--secondary:hover {
    background: #e5e7eb;
    color: #1f2937;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.icon-btn--warning {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}

.icon-btn--warning:hover {
    background: #fde68a;
    color: #92400e;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.icon-btn--danger {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

.icon-btn--danger:hover {
    background: #fecaca;
    color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Animations */
@keyframes processing-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes completion-flash {
    0%, 100% { background: inherit; }
    50% { background: linear-gradient(135deg, #d4edda, #c3e6cb); }
}

/* Responsive design */
@media (max-width: 768px) {
    .main-container {
        margin: 10px;
        padding: 15px;
        max-width: 100%;
    }

    .exams-hero h1 {
        font-size: 1.3rem;
    }

    .exams-hero__actions {
        gap: 0.5rem;
    }

    .exams-hero__actions .btn {
        font-size: 0.78rem;
        padding: 0.4rem 0.75rem;
    }

    .exams-guide__inner {
        padding: 1rem 1.25rem;
    }

    .exams-guide__steps {
        grid-template-columns: 1fr;
    }

    .section-card {
        padding: 12px;
        margin-bottom: 12px;
    }

    .paper-meta {
        grid-template-columns: 1fr;
    }

    .filter-controls {
        flex-direction: column;
        gap: 10px;
    }

    #subjectFilter {
        width: 100%;
        flex: 1 1 auto;
    }

    .paper-actions {
        flex-direction: column;
    }

    .action-btn {
        text-align: center;
    }
}

/* ── My Exams: dual accordion (My papers / Subscribed & assigned) ── */
.papers-dual-section {
    padding-top: 0.5rem;
}

.papers-accordions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.papers-accordion {
    border: 1px solid var(--border-color, #e9ecef);
    border-radius: var(--border-radius-sm, 8px);
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-light, 0 2px 8px rgba(0, 0, 0, 0.06));
}

.papers-accordion-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    margin: 0;
    border: none;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.06) 0%, rgba(118, 75, 162, 0.05) 100%);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease;
}

.papers-accordion-header:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.08) 100%);
}

.papers-accordion-header-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-color, #1e293b);
}

.papers-accordion-chevron {
    transition: transform 0.22s ease;
    color: #64748b;
    font-size: 0.85rem;
}

.papers-accordion-chevron.is-collapsed {
    transform: rotate(-90deg);
}

.papers-accordion-icon {
    color: #667eea;
    font-size: 1rem;
}

.papers-accordion-title {
    flex: 1 1 auto;
}

.papers-accordion-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(102, 126, 234, 0.15);
    color: #4f46e5;
}

.papers-accordion-sub {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--muted-color, #64748b);
    line-height: 1.35;
    padding-left: 1.5rem;
}

.papers-accordion-body {
    border-top: 1px solid var(--border-color, #e9ecef);
    padding: 0.75rem;
    background: #fafbfc;
}

.papers-accordion-body.is-collapsed {
    display: none;
}

.papers-list-host {
    min-height: 0;
}

.papers-section-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--muted-color, #64748b);
    font-size: 0.95rem;
}

.papers-section-empty p {
    margin-bottom: 0.5rem;
}

.papers-section-empty p:last-child {
    margin-bottom: 0;
}

.papers-global-empty .no-papers-message {
    padding: 2rem 1rem;
}

.papers-load-more-host {
    text-align: center;
    padding: 1rem 0 0.25rem;
}

.papers-load-more-done {
    margin: 0;
    font-size: 0.9rem;
}
