/* ==========================================
   GenZClass Typing Platform — Stylesheet
   Executive Styling system for Typing Test & 1-Hour Course
========================================== */

/* Sub-Navigation Tabs */
.typing-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface, #ffffff);
    padding: 12px 24px;
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--border, #e2e8f0);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

/* Compact Workspace Header Bar (Zero-Scroll Layout) */
.typing-workspace-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface, #ffffff);
    padding: 10px 18px;
    border-radius: var(--radius, 12px);
    border: 1px solid var(--border, #e2e8f0);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.ws-stat-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.ws-chip {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg);
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ws-chip strong {
    color: var(--text);
    font-size: 14px;
}

.ws-chip.primary strong { color: var(--primary); }
.ws-chip.accent strong { color: #10b981; }
.ws-chip.danger strong { color: #ef4444; }

.ws-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sm-ws {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 700;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
}

.btn-sm-ws:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.typing-nav-tabs {
    display: flex;
    gap: 10px;
    background: var(--surface-2, #f1f5f9);
    padding: 5px;
    border-radius: var(--radius-pill, 9999px);
}

.typing-tab-btn {
    padding: 8px 18px;
    border-radius: var(--radius-pill, 9999px);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted, #475569);
    text-decoration: none;
    transition: var(--transition, all 0.2s ease);
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-tab-btn:hover {
    color: var(--primary, #4f46e5);
}

.typing-tab-btn.active {
    background: var(--surface, #ffffff);
    color: var(--primary, #4f46e5);
    box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.08));
}

/* Controls Bar */
.typing-controls-card {
    background: var(--surface, #ffffff);
    padding: 20px 24px;
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--border, #e2e8f0);
    box-shadow: var(--shadow, 0 4px 6px rgba(0,0,0,0.04));
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
}

.control-group-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-item label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light, #64748b);
}

.control-select {
    padding: 9px 14px;
    border-radius: var(--radius, 10px);
    border: 1px solid var(--border, #cbd5e1);
    background: var(--bg, #f8fafc);
    color: var(--text, #0f172a);
    font-size: 13.5px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.control-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Caps Lock Alert Banner */
.capslock-alert-banner {
    display: none;
    background: rgba(239, 68, 68, 0.12);
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    color: var(--danger, #ef4444);
    padding: 10px 18px;
    border-radius: var(--radius, 10px);
    font-weight: 700;
    font-size: 13.5px;
    margin-bottom: 20px;
    align-items: center;
    gap: 10px;
    animation: pulseAlert 1.5s infinite;
}

.capslock-alert-banner.active {
    display: flex;
}

@keyframes pulseAlert {
    0%, 100% { border-color: rgba(239, 68, 68, 0.3); }
    50% { border-color: rgba(239, 68, 68, 0.8); }
}

/* Live Stats Row */
.typing-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-badge-card {
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    padding: 14px;
    border-radius: var(--radius, 12px);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-badge-card .stat-val {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary, #4f46e5);
    line-height: 1.1;
}

.stat-badge-card .stat-lbl {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-light, #64748b);
    margin-top: 4px;
}

/* Progress Bar */
.typing-progress-container {
    width: 100%;
    height: 8px;
    background: var(--surface-2, #f1f5f9);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.typing-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.2s ease;
}

/* Real-Time Typing Text Arena */
.typing-arena-card {
    background: var(--surface, #ffffff);
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--border, #e2e8f0);
    box-shadow: var(--shadow-md);
    padding: 30px;
    margin-bottom: 25px;
    position: relative;
    cursor: text;
}

.typing-display-box {
    font-family: 'Plus Jakarta Sans', 'Poppins', monospace, sans-serif;
    font-size: 23px;
    line-height: 1.85;
    color: var(--text-light, #64748b);
    user-select: none;
    letter-spacing: 1.8px;
    word-spacing: 10px;
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Character States */
.char-pending {
    color: var(--text-light, #94a3b8);
    opacity: 0.75;
}

.char-correct {
    color: #10b981 !important;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 2px;
}

.char-incorrect {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.2);
    border-bottom: 2px solid #ef4444;
    border-radius: 2px;
}

.char-current {
    color: var(--text, #0f172a) !important;
    background: rgba(79, 70, 229, 0.22) !important;
    border-bottom: 3px solid var(--primary, #4f46e5);
    border-radius: 3px;
    font-weight: 700;
    animation: cursorPulse 1s infinite alternate;
}

@keyframes cursorPulse {
    0% { background: rgba(79, 70, 229, 0.22); }
    100% { background: rgba(79, 70, 229, 0.45); }
}

/* Hidden Input Focus Mask */
.typing-hidden-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    left: -9999px;
}

/* Arena Overlay Actions */
.arena-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.btn-typing-action {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-restart {
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.25);
}

.btn-restart:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn-pause {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Visual On-Screen Keyboard Container */
.keyboard-section-card {
    background: var(--surface, #ffffff);
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--border, #e2e8f0);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
}

.keyboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.keyboard-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.finger-placement-badge {
    background: var(--surface-2, #f1f5f9);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.finger-placement-badge strong {
    color: var(--primary);
}

/* Keyboard Key Rows Layout */
.visual-keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    user-select: none;
}

.kb-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    width: 100%;
}

.kb-key {
    background: var(--bg, #f8fafc);
    border: 1.5px solid var(--border, #cbd5e1);
    border-radius: 8px;
    height: 48px;
    flex: 1;
    min-width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    position: relative;
    box-shadow: 0 2px 0 var(--border, #cbd5e1);
    transition: all 0.15s ease;
}

.kb-key span {
    pointer-events: none;
}

.kb-key.homing::after {
    content: "";
    position: absolute;
    bottom: 6px;
    width: 10px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* Key Special Widths */
.key-special { background: var(--surface-2, #f1f5f9); font-size: 11.5px; font-weight: 600; color: var(--text-light); }
.key-backspace { flex: 1.8; }
.key-tab { flex: 1.4; }
.key-caps { flex: 1.7; }
.key-enter { flex: 2; }
.key-shift { flex: 2.3; }
.key-space { flex: 6.5; }
.key-ctrl, .key-alt { flex: 1.3; }

/* Target Key Highlight */
/* Full Course Distraction-Free Practice Window Overlay */
.full-course-practice-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg, #0b0f19);
    z-index: 99999;
    padding: 15px 20px;
    overflow: hidden;
    animation: fadeIn 0.25s ease;
}

.practice-window-container {
    max-width: 1240px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.practice-window-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface, #111827);
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid var(--border, #1f2937);
    margin-bottom: 14px;
    flex-shrink: 0;
}

.practice-window-grid {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.practice-side-ad-col {
    display: flex;
    flex-direction: column;
}

.course-side-ad-card {
    background: var(--surface, #111827);
    border: 1px solid var(--border, #1f2937);
    border-radius: 12px;
    padding: 18px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

@media (max-width: 900px) {
    .practice-window-grid {
        grid-template-columns: 1fr;
    }
    .practice-side-ad-col {
        display: none;
    }
}

.kb-key.target-key {
    background: var(--primary, #4f46e5) !important;
    color: #ffffff !important;
    border-color: var(--primary-hover, #4338ca) !important;
    box-shadow: 0 0 15px rgba(79, 70, 229, 0.5) !important;
    transform: translateY(-2px);
    animation: keyTargetGlow 0.8s infinite alternate;
}

@keyframes keyTargetGlow {
    0% { transform: translateY(-2px); box-shadow: 0 0 10px rgba(79, 70, 229, 0.4); }
    100% { transform: translateY(-4px); box-shadow: 0 0 20px rgba(79, 70, 229, 0.8); }
}

.kb-key.shift-required {
    background: var(--warning, #f59e0b) !important;
    color: #ffffff !important;
    border-color: #d97706 !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5) !important;
}

.kb-key.pressed {
    transform: translateY(2px) !important;
    box-shadow: none !important;
    background: var(--secondary, #0284c7) !important;
    color: #ffffff !important;
}

/* Setup Card & Start Button */
.typing-setup-card {
    background: var(--surface, #ffffff);
    padding: 28px 32px;
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--border, #e2e8f0);
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    transition: var(--transition);
}

.btn-start-test {
    background: linear-gradient(135deg, var(--primary, #4f46e5), var(--secondary, #0284c7));
    color: #ffffff;
    border: none;
    padding: 14px 34px;
    border-radius: var(--radius-pill, 9999px);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.35);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-start-test:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 35px rgba(79, 70, 229, 0.45);
}

/* Results Screen Overlay Modal Popup */
.typing-results-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 15, 25, 0.82);
    backdrop-filter: blur(8px);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.typing-results-overlay.active {
    display: flex;
}

.typing-results-card {
    background: var(--surface, #111827);
    color: var(--text, #f8fafc);
    border-radius: var(--radius-lg, 20px);
    border: 1px solid var(--border, #1f2937);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    padding: 32px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;
    position: relative;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin: 25px 0;
}

.weakness-report-box {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 25px;
}

.weakness-report-box h4 {
    margin: 0 0 8px 0;
    color: #d97706;
    font-size: 15px;
    font-weight: 700;
}

.weak-key-badge {
    display: inline-block;
    background: var(--surface, #ffffff);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #d97706;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 13px;
    margin: 3px;
}

/* Safe Advertisement Containers */
.typing-ad-slot {
    margin: 25px 0;
    padding: 14px;
    background: var(--surface-2, #f1f5f9);
    border: 1px dashed var(--border, #cbd5e1);
    border-radius: var(--radius);
    text-align: center;
    position: relative;
}

.typing-ad-label {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 8px;
}

/* 1-Hour Typing Course Accordion & Stepper */
.course-layout-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.course-sidebar-card {
    background: var(--surface, #ffffff);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    max-height: 800px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.chapter-step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg);
}

.chapter-step-item:hover {
    background: var(--surface-hover);
}

.chapter-step-item.active {
    background: rgba(79, 70, 229, 0.12);
    border-color: var(--primary);
}

.chapter-step-item.completed {
    border-color: rgba(16, 185, 129, 0.4);
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 800;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chapter-step-item.active .step-num {
    background: var(--primary);
    color: #ffffff;
}

.chapter-step-item.completed .step-num {
    background: #10b981;
    color: #ffffff;
}

/* Distinct Chapter Navigation Cards in Sidebar */
.chapter-nav-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg, rgba(255,255,255,0.03));
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chapter-nav-card:hover {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.4);
    transform: translateX(4px);
}

.chapter-nav-card.active {
    background: rgba(79, 70, 229, 0.18) !important;
    border: 1.5px solid var(--primary, #6366f1) !important;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.25) !important;
}

.chapter-nav-card.completed {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
}

.chapter-nav-card.locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.ch-badge {
    min-width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-2, rgba(255,255,255,0.12));
    color: var(--text, #ffffff);
    font-weight: 800;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.chapter-nav-card.active .ch-badge {
    background: var(--primary, #6366f1);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.chapter-nav-card.completed .ch-badge {
    background: #10b981;
    color: #ffffff;
}

.ch-info {
    flex: 1;
    min-width: 0;
}

.ch-time {
    font-size: 11px;
    font-weight: 800;
    color: var(--primary, #818cf8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 3px;
}

.ch-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text, #f8fafc);
    line-height: 1.35;
}

.ch-info p {
    margin: 0;
    font-size: 12px;
    color: var(--text-light, #94a3b8);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ch-dur {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    background: rgba(0,0,0,0.25);
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    align-self: flex-start;
    border: 1px solid rgba(255,255,255,0.08);
}

/* Research Transparency Section */
.research-transparency-card {
    background: var(--surface, #ffffff);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.research-item-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.research-item-box h4 {
    margin: 0 0 6px 0;
    color: var(--primary);
    font-size: 14.5px;
    font-weight: 700;
}

.research-item-box p {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Printable Certificate Modal & Card */
.certificate-card {
    background: #ffffff;
    color: #0f172a;
    border: 12px double #4f46e5;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    position: relative;
}

.certificate-card h1 {
    font-size: 28px;
    color: #4f46e5;
    font-weight: 800;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.certificate-card h2 {
    font-size: 18px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 25px;
}

.cert-user-name {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    border-bottom: 2px solid #cbd5e1;
    display: inline-block;
    padding: 0 30px 6px;
    margin-bottom: 20px;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
    .course-layout-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .typing-display-box {
        font-size: 18px;
    }
    .kb-key {
        height: 38px;
        font-size: 11px;
        min-width: 22px;
    }
}

/* Animated Interactive Lesson Briefing Modal Entrance & Slide Transitions */
.briefing-modal-card {
    animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(35px) scale(0.94);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.briefing-slide-content-box {
    animation: slideCardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideCardIn {
    from {
        transform: translateX(18px);
        opacity: 0.2;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
