/*
    =====================================================
    |   FINAL: 'Practice' Page CSS (Full Light Theme)   |
    =====================================================
*/

/* --- Main containers updated for Light Theme --- */
#practice-section, #article-section {
    background-color: #FFFFFF; border: 1px solid #E5E7EB;
    border-radius: 1rem; padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
#article-section { margin-top: 2rem; }

/* --- Dynamic Lesson Heading --- */
#lesson-heading h1 {
    font-size: 1.875rem; font-weight: 700; color: #1F2937;
    line-height: 1.2; text-align: center;
}
#lesson-heading h2 {
    font-size: 1rem; font-weight: 500; color: #6B7280;
    margin-top: 4px; text-align: center;
}

/* --- Navigation Bar Styles --- */
#lesson-navigation, #exercise-navigation {
    background-color: #E5E7EB; border-radius: 9999px; padding: 6px;
    display: inline-flex; align-items: center; border: 1px solid #D1D5DB;
}
.nav-arrow-btn {
    background-color: #4F46E5; color: white; border-radius: 50%;
    width: 38px; height: 38px; font-size: 1.5rem; font-weight: bold;
    line-height: 1; transition: all 0.2s ease-in-out;
    border: 2px solid transparent; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex; align-items: center; justify-content: center;
}
.nav-arrow-btn:hover { background-color: #4338CA; }
.nav-display {
    color: #111827; font-weight: 600; text-align: center;
    min-width: 140px; padding: 0 12px;
}

/* --- Control Buttons --- */
.change-level-btn, .start-btn {
    color: white; font-size: 14px; font-weight: 600; padding: 10px 24px;
    border-radius: 9999px;
    transition: background-color 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-width: 120px;
    text-align: center;
}
.change-level-btn { background-color: #4F46E5; }
.change-level-btn:hover { background-color: #4338CA; }
.start-btn { background-color: #16A34A; }
.start-btn:hover { background-color: #15803D; }

#timer {
    color: #111827; font-weight: 700;
}

/* --- Level Selection Modal (Light Theme) --- */
#level-modal-content {
    background-color: white;
    color: #1f2937;
    max-height: 80vh; 
    overflow-y: auto;
}
#level-modal-content h2 {
    color: #4f46e5;
}
#level-modal-close-btn {
    color: #6b7280;
}
#level-modal-close-btn:hover {
    color: #111827;
}
.level-accordion-btn {
    width: 100%;
    background-color: #f9fafb;
    color: #374151;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: background-color 0.2s;
}
.level-accordion-btn:hover {
    background-color: #f3f4f6;
}
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    padding: 12px;
    background-color: #FFFFFF;
    border-radius: 8px;
    margin-top: 4px;
    border-top: 1px solid #e5e7eb;
}
.exercise-btn {
    background-color: #FFFFFF;
    color: #4f46e5;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #d1d5db;
    transition: all 0.2s;
}
.exercise-btn:hover {
    background-color: #eef2ff;
    border-color: #a5b4fc;
}
.exercise-btn.active {
    background-color: #4f46e5;
    color: white;
    font-weight: bold;
    border-color: #4f46e5;
}

/* --- Practice Area Styles --- */
.project-wrapper { width: 100%; max-width: 950px; margin: 0 auto; }
.text-area {
    height: 150px; overflow-y: hidden; position: relative; cursor: text;
    background-color: #FFFFFF !important; border: 1px solid #E5E7EB;
    border-radius: 0.5rem; padding: 1rem;
}
#target-text {
    position: absolute; top: 0; left: 0; right: 0;
    transition: top 0.2s ease-out; white-space: pre-wrap;
    display: flex; flex-wrap: wrap; align-items: center;
}
.char-box {
    display: inline-flex; justify-content: center; align-items: center;
    width: 28px; height: 45px;
    border: 1px solid #D1D5DB; background-color: #FFFFFF;
    border-radius: 6px; margin: 2px;
    font-size: 25px; font-weight: 500; color: #4B5563; position: relative;
}
.char-box.correct { 
    color: #15803D !important; background-color: #DCFCE7 !important; border-color: #16A34A !important;
}
.char-box.incorrect { 
    color: #B91C1C !important; background-color: #FEE2E2 !important; border-color: #DC2626 !important;
}

/* --- Blinking Cursor Style (Underline) --- */
@keyframes blink-opacity { 50% { opacity: 0; } }
.blinking-cursor::after {
    content: ''; position: absolute; bottom: 4px; left: 2px;
    right: 2px; height: 3px; background-color: #3B82F6;
    animation: blink-opacity 1s step-end infinite; border-radius: 2px;
}

/* --- Virtual Keyboard Styles --- */
.keyboard-base-container { user-select: none; margin-top: 1rem; }
.keyboard-layout-wrapper { display: flex; justify-content: center; align-items: flex-start; gap: 4px; }
.keyboard-main, .keyboard-numpad-area {
    background-color: #F3F4F6; padding: 5px; border-radius: 8px; border: 1px solid #E5E7EB;
}
.keyboard-row { display: flex; justify-content: center; margin-bottom: 3px; }
.key {
    height: 40px; min-width: 40px; background-color: #FFFFFF; color: #1F2937;
    border-radius: 6px; padding: 5px; margin: 1.5px; font-size: 12.5px;
    font-weight: 600; text-align: center; transition: all 0.1s;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid #9CA3AF; border-bottom: 3px solid #9CA3AF;
}
.key.space { flex-grow: 1; }
.keyboard-numpad {
    display: grid; grid-template-columns: repeat(4, 40px); grid-template-rows: repeat(5, 40px); gap: 6.9px;
}
.keyboard-numpad .key { height: 100%; margin: 0; }
.numpad-plus { grid-row: span 2; }
.numpad-enter { grid-row: span 2; }
.numpad-zero { grid-column: span 2; }
.key.pressed { background-color: #E5E7EB; transform: translateY(2px); }
.key.wrong { background-color: #DC2626; color: white; }
.key.next-to-press { transform: scale(1.1); background-color: #60A5FA; }

/* --- Article Section Content Styles --- */
#article-section pre {
    background-color: #F3F4F6; border: 1px solid #E5E7EB;
    color: #374151; padding: 1rem; border-radius: 0.5rem;
    white-space: pre-wrap; word-break: break-all; font-family: monospace;
}
.progress-bar-track {
    background-color: #E5E7EB; width: 100%;
    border-radius: 9999px; height: 0.625rem;
}
.tip-box {
    background-color: #DCFCE7; border-left: 4px solid #16A34A;
    padding: 1rem; border-radius: 0 0.5rem 0.5rem 0; margin-top: 1.5rem;
}
.tip-box p { color: #15803D; font-weight: 500; }

/* --- Modal and Results Bar Styles for Light Theme --- */
#modal-content {
    background-color: #FFFFFF;
    color: #1F2937;
}
#results-container {
    background-color: #F9FAFB;
    border-top: 1px solid #E5E7EB;
}
#results-container p {
    color: #E5E7EB;
}

/* For the new sticky layout */
#sticky-practice-area {
    position: sticky;
    top: 80px;
    z-index: 20;
    background-color: #111827;
    padding: 1rem 0;
}
.toc-sticky-container {
    position: sticky;
    top: 550px;
    z-index: 15;
}

.next-lesson-btn {
    display: inline-block;
    margin-top: 2rem;
    padding: 0.5rem 1.5rem;
    background-color: #4f46e5;
    color: white;
    font-weight: bold;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.next-lesson-btn:hover {
    background-color: #4338CA;
}