/* User Progress page styles */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #059669;
}

/* Hero header — compact, matching subjects_page */
.progress-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 1.25rem 0 1rem;
    text-align: center;
}

.progress-hero h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.progress-hero__sub {
    font-size: 0.92rem;
    opacity: 0.9;
    max-width: 540px;
    margin: 0 auto 0.75rem;
}

/* Quick action strip */
.progress-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.progress-actions .btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.45rem 1rem;
}

.progress-actions .btn-light {
    background: rgba(255,255,255,0.95);
    color: #4f46e5;
    border: none;
}

.progress-actions .btn-light:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.progress-actions .btn-outline-light {
    border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    background: transparent;
}

.progress-actions .btn-outline-light:hover {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
}

/* Main content area */
.progress-main {
    background: #f8fafc;
    min-height: calc(100vh - 160px);
    padding: 1.5rem 0;
}

.progress-main .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Two-column layout: tips sidebar + content */
.progress-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Tips sidebar (left) */
.progress-tips-sidebar {
    position: sticky;
    top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.progress-tips-sidebar h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.25rem;
    line-height: 1.3;
}

.progress-tips-sidebar .tip-card {
    background: #fff;
    border: 1px solid #f0f1f3;
    border-radius: 12px;
    padding: 1rem;
    text-align: left;
    transition: transform 0.2s;
}

.progress-tips-sidebar .tip-card:hover {
    transform: translateY(-2px);
}

.progress-tips-sidebar .tip-card i {
    font-size: 1.1rem;
    color: #4f46e5;
    margin-bottom: 0.4rem;
    display: block;
}

.progress-tips-sidebar .tip-card h5 {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.2rem;
}

.progress-tips-sidebar .tip-card p {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

/* Content area (right) */
.progress-content {
    min-width: 0;
}

/* Navbar overrides */
.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;
}

.navbar { z-index: 1030; }

.dropdown-menu {
    z-index: 1031 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.1);
}

.dropdown-item { transition: all 0.2s ease; }

.dropdown-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

/* Validation Filter (admin) */
.validation-filter {
    background: white;
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
    margin: 0;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

.btn-filter {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-filter:hover {
    border-color: #667eea;
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.btn-filter.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.btn-filter[data-filter="unvalidated"].active {
    background: #f59e0b;
    border-color: #f59e0b;
}

.btn-filter[data-filter="validated"].active {
    background: #059669;
    border-color: #059669;
}

.filter-count {
    color: #6b7280;
    font-size: 0.9rem;
    margin-left: auto;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: white;
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border-left: 4px solid;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.stat-card.overall  { border-left-color: var(--accent-color); }
.stat-card.topics   { border-left-color: var(--primary-color); }
.stat-card.accuracy { border-left-color: #f59e0b; }
.stat-card.streak   { border-left-color: #ef4444; }

.stat-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.stat-icon {
    font-size: 1.3rem;
    padding: 0.4rem;
    border-radius: 8px;
    background: rgba(0,0,0,0.05);
}

.stat-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.3rem;
}

.stat-description {
    font-size: 0.85rem;
    color: #6b7280;
}

/* Progress overview */
.progress-overview {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 1.25rem;
}

.overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.overview-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #111827;
}

.overall-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: conic-gradient(var(--accent-color) var(--progress, 0%), #e5e7eb var(--progress, 0%));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.progress-circle::before {
    content: '';
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: white;
    position: absolute;
}

.progress-percentage {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    z-index: 1;
}

.progress-details { flex: 1; }

.progress-main-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.2rem;
}

.progress-sub {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Topics grid */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.topic-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: all 0.2s ease;
    border: 1px solid #f3f4f6;
}

.topic-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    border-color: var(--primary-color);
}

.topic-header {
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.topic-name {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.4rem;
}

.topic-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: #6b7280;
    flex-wrap: wrap;
}

.topic-progress {
    padding: 0.85rem 1.25rem;
    background: #f9fafb;
}

.progress-bar-container {
    background: #e5e7eb;
    border-radius: 6px;
    height: 7px;
    margin-bottom: 0.6rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #34d399);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.progress-fraction { color: #6b7280; }
.progress-percent  { font-weight: 600; color: var(--accent-color); }

.topic-actions {
    padding: 0.85rem 1.25rem;
    display: flex;
    gap: 0.6rem;
}

.btn-topic {
    flex: 1;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-topic.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-topic.btn-primary:hover {
    background: #5a6fd6;
    color: white;
}

.btn-topic.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-topic.btn-secondary:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.empty-description {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* Loading spinner */
.loading-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner-container {
    position: relative;
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
}

.main-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.pulse-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(102, 126, 234, 0.3);
    animation: pulse 1.5s ease-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.loading-text {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
}

.loading-subtext {
    font-size: 0.85rem;
    color: #6b7280;
}

/* Subtopics modal */
.subtopics-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    padding: 2rem;
    box-sizing: border-box;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    margin: 2rem auto;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0.25rem;
}

.modal-body { padding: 1.25rem 1.5rem; }

.subtopic-item {
    padding: 1rem;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    margin-bottom: 0.85rem;
    transition: border-color 0.2s ease;
}

.subtopic-item:hover {
    border-color: var(--primary-color);
}

.subtopic-name {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.validated-count {
    font-size: 0.82rem;
    color: #059669;
}

/* Responsive */
@media (max-width: 1000px) {
    .progress-layout {
        grid-template-columns: 1fr;
    }

    .progress-tips-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .progress-tips-sidebar h3 {
        width: 100%;
    }

    .progress-tips-sidebar .tip-card {
        flex: 1;
        min-width: 200px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .progress-hero {
        padding: 2rem 0 1.5rem;
    }

    .progress-hero h1 {
        font-size: 1.7rem;
    }

    .progress-actions {
        flex-direction: column;
        align-items: center;
    }

    .progress-tips-sidebar .tip-card {
        min-width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topics-grid {
        grid-template-columns: 1fr;
    }

    .validation-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-group {
        flex-direction: column;
    }

    .filter-count {
        margin-left: 0;
        text-align: center;
    }

    .overall-progress {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    .topics-grid {
        grid-template-columns: 1fr;
    }
}
