/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.6;
}
a { color: #4361ee; text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Navbar === */
.navbar {
    background: #1a1a2e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand a { color: #fff; font-size: 1.2rem; font-weight: 700; text-decoration: none; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: #ccc; font-size: 0.9rem; text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: #fff; }
.nav-logout { color: #ff6b6b !important; }

/* === Container === */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }

/* === Page Header === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.page-header h1 { font-size: 1.8rem; color: #1a1a2e; }

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}
.btn:hover { background: #f5f5f5; text-decoration: none; }
.btn-primary { background: #4361ee; color: #fff; border-color: #4361ee; }
.btn-primary:hover { background: #3a56d4; }
.btn-success { background: #2ec4b6; color: #fff; border-color: #2ec4b6; }
.btn-success:hover { background: #28b0a3; }
.btn-full { width: 100%; text-align: center; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* === Cards === */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 1rem;
}
.card h2 { font-size: 1.2rem; margin-bottom: 1rem; color: #1a1a2e; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

/* === Stats === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid #4361ee;
}
.stat-card.stat-success { border-left-color: #2ec4b6; }
.stat-card.stat-warning { border-left-color: #ff9f1c; }
.stat-number { font-size: 2.5rem; font-weight: 700; color: #1a1a2e; }
.stat-label { color: #666; font-size: 0.9rem; margin-top: 0.3rem; }

/* === Dashboard Grid === */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 768px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* === Activity === */
.activity-item {
    display: flex;
    flex-direction: column;
    padding: 0.8rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.activity-item:last-child { border-bottom: none; }
.activity-meta { font-size: 0.85rem; margin-top: 0.2rem; }

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e9ecef;
    color: #666;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* === Progress Bar === */
.progress-bar {
    background: #e9ecef;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin: 0.5rem 0;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4361ee, #2ec4b6);
    border-radius: 10px;
    transition: width 0.3s;
}
.progress-indeterminate {
    width: 30% !important;
    animation: indeterminate 1.5s infinite ease-in-out;
}
@keyframes indeterminate {
    0% { margin-left: 0; }
    50% { margin-left: 70%; }
    100% { margin-left: 0; }
}

/* === Subject Stats === */
.subject-stat { margin-bottom: 1rem; }
.subject-stat strong { display: block; margin-bottom: 0.3rem; }

/* === Login === */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-card h1 { text-align: center; color: #1a1a2e; margin-bottom: 0.3rem; }
.login-subtitle { text-align: center; color: #666; margin-bottom: 2rem; font-size: 0.9rem; }
.login-card h2 { text-align: center; margin-bottom: 1.5rem; }
.toggle-auth { text-align: center; margin-top: 1rem; font-size: 0.9rem; color: #666; }

/* === Form === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 600; font-size: 0.9rem; color: #333; }
.form-group input, .form-group select {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: #4361ee; }
.error-msg { background: #fff5f5; color: #c53030; padding: 0.7rem; border-radius: 8px; font-size: 0.9rem; margin-bottom: 1rem; }

/* === Upload === */
.upload-card { max-width: 600px; margin: 0 auto; }
.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: #4361ee; background: #f8f9ff; }
.drop-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.file-info #file-name { font-weight: 600; flex: 1; }
.file-info #file-size { color: #666; }

/* === Video Cards === */
.video-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.video-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.video-thumb {
    background: #1a1a2e;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.play-icon { font-size: 3rem; color: rgba(255,255,255,0.8); }
.video-card-body { padding: 1rem; }
.video-card-body h3 { font-size: 0.95rem; margin-bottom: 0.3rem; word-break: break-all; }
.video-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }

/* === Result Cards === */
.result-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.result-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.result-card-header { margin-bottom: 0.5rem; }
.result-card-body h3 { font-size: 0.95rem; margin-bottom: 0.3rem; word-break: break-all; }

/* === Detail Grid === */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    align-items: start;
}
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }
.card-stack { display: flex; flex-direction: column; gap: 1rem; }

/* === Info List === */
.info-list { display: flex; flex-direction: column; gap: 0.5rem; }
.info-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid #f0f0f0; }
.info-label { color: #666; font-size: 0.9rem; }

/* === Video Player === */
.video-player-card { padding: 0; overflow: hidden; }
.video-player-card video { display: block; border-radius: 12px; }

/* === Result Content === */
.result-content {
    line-height: 1.8;
    font-size: 0.95rem;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}
.result-content h2 { font-size: 1.2rem; margin: 1rem 0 0.5rem; color: #1a1a2e; }
.result-content h3 { font-size: 1.05rem; margin: 0.8rem 0 0.4rem; color: #333; }
.mark-o { color: #2ec4b6; font-weight: 700; }
.mark-x { color: #ff6b6b; font-weight: 700; }

/* === Questions === */
.subject-section { margin-bottom: 2rem; }
.subject-section h2 { font-size: 1.4rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid #4361ee; }
.question-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.question-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.question-card.disabled { opacity: 0.5; cursor: default; }
.question-card.disabled:hover { transform: none; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.question-card h3 { margin-bottom: 0.5rem; }

/* === Modal === */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}
.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}
.modal-header h2 { font-size: 1.3rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}
.modal-body { padding: 1.5rem; }
.checklist-section { margin-bottom: 1.5rem; }
.checklist-section h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: #1a1a2e; }
.checklist-section ol { padding-left: 1.5rem; }
.checklist-section li { margin-bottom: 0.4rem; line-height: 1.5; }

/* === Format Guide === */
.format-guide { display: flex; flex-direction: column; gap: 1rem; }
.guide-item code {
    display: block;
    background: #f8f9fa;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #4361ee;
    margin-bottom: 0.3rem;
}
.guide-item p { font-size: 0.85rem; }

/* === Empty State === */
.empty-state { text-align: center; padding: 3rem; grid-column: 1 / -1; }
.empty-state p { color: #666; margin-bottom: 1rem; font-size: 1.1rem; }

/* === Utilities === */
.text-muted { color: #888; }
.text-center { text-align: center; }

/* === Responsive === */
@media (max-width: 600px) {
    .navbar { padding: 0 1rem; }
    .nav-links { gap: 0.8rem; font-size: 0.8rem; }
    .container { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }
}
