/* ========================================
   Question Tracker Styles - Clean Table Design
   ======================================== */

/* Tab Navigation */
.tracker-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tracker-tab {
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tracker-tab:hover {
    background: var(--bg-secondary);
}

.tracker-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.tracker-tab .badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.tracker-tab.active .badge {
    background: rgba(255, 255, 255, 0.3);
}

/* Sub-tabs for papers */
.paper-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.paper-tab {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.paper-tab:hover {
    background: var(--bg-card);
}

.paper-tab.active {
    background: var(--bg-card);
    border-color: #667eea;
    color: #667eea;
}

/* Legend - Compact */
.tracker-legend {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.85rem;
}

.legend-title {
    font-weight: 600;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.done {
    background: #10b981;
}

.legend-dot.silly {
    background: #f59e0b;
}

.legend-dot.wrong {
    background: #ef4444;
}

/* Overall Progress - Compact */
.overall-progress {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.overall-progress h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.overall-progress-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.overall-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 999px;
    transition: width 0.5s ease;
}

.overall-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.overall-stat {
    text-align: center;
}

.overall-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.overall-stat-label {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Chapter Table */
.chapter-table {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
}

.chapter-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    cursor: pointer;
    user-select: none;
    gap: 1rem;
    flex-wrap: wrap;
}

.chapter-table-header:hover {
    background: rgba(102, 126, 234, 0.1);
}

.chapter-title-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
}

.chapter-emoji {
    font-size: 1.5rem;
}

.chapter-name {
    font-weight: 600;
    font-size: 1rem;
}

.chapter-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.chapter-stats-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
}

.mini-stat.done {
    color: #10b981;
}

.mini-stat.silly {
    color: #f59e0b;
}

.mini-stat.wrong {
    color: #ef4444;
}

.mini-progress {
    width: 80px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    background: #10b981;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.chapter-toggle {
    font-size: 1rem;
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.chapter-table.expanded .chapter-toggle {
    transform: rotate(180deg);
}

/* Questions Table Content */
.chapter-table-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.chapter-table.expanded .chapter-table-content {
    max-height: 2000px;
}

.questions-table {
    width: 100%;
    border-collapse: collapse;
}

.questions-table th,
.questions-table td {
    padding: 0.5rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.questions-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.questions-table th:first-child {
    width: 60px;
    text-align: center;
}

.questions-table th:nth-child(2) {
    width: 100px;
}

.questions-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.questions-table tbody tr:last-child td {
    border-bottom: none;
}

/* Question Number */
.q-number {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Status Buttons */
.status-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.status-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    opacity: 0.4;
}

.status-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.status-btn.active {
    opacity: 1;
}

.status-btn.done {
    border-color: #10b981;
}

.status-btn.done.active {
    background: #10b981;
    color: white;
}

.status-btn.silly {
    border-color: #f59e0b;
}

.status-btn.silly.active {
    background: #f59e0b;
    color: white;
}

.status-btn.wrong {
    border-color: #ef4444;
}

.status-btn.wrong.active {
    background: #ef4444;
    color: white;
}

/* Status indicator in row */
.row-status {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.row-status.done {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.row-status.silly {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.row-status.wrong {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.row-status.pending {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

/* Loading State */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .chapter-stats-row {
        gap: 0.5rem;
    }

    .mini-stat {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    .questions-table th,
    .questions-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }

    .status-btn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .chapter-title-section {
        min-width: 150px;
    }

    .chapter-name {
        font-size: 0.9rem;
    }

    .status-buttons {
        gap: 0.35rem;
    }

    .status-btn {
        width: 26px;
        height: 26px;
    }
}