/* Typing Course Stylesheet - Premium & Dynamic */

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --success-color: #10b981;
    --error-color: #ef4444;
    --kb-bg: #e2e8f0;
    --kb-key-bg: #ffffff;
    --kb-key-border: #cbd5e1;
    --kb-key-active: #c7d2fe;
    --kb-key-text: #334155;
    --kb-key-highlight: #818cf8;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-target: #94a3b8;
    --text-typed: #1e293b;
    --text-error: #ef4444;
    --text-error-bg: #fee2e2;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.shadow-inner {
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

.btn-glow {
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
}

.btn-glow:hover {
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.6);
    transform: translateY(-2px);
}

/* Base structural styles */
.typing-workspace {
    background: linear-gradient(135deg, #f0fdf4 0%, #e0e7ff 100%);
}

/* Course List / Index Page */
.chapter-card {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.chapter-card:hover {
    box-shadow: 0 14px 28px rgba(0,0,0,0.05), 0 10px 10px rgba(0,0,0,0.02);
}
.chapter-header {
    background-color: #fff;
    border-bottom: 2px solid #f1f5f9;
}
.chapter-badge {
    background: #e0e7ff;
    color: var(--primary-dark);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: middle;
}
.lesson-list .list-group-item {
    border-left: none;
    border-right: none;
    border-top: 1px solid #f1f5f9;
}
.lesson-list .list-group-item:first-child { border-top: none; }
.lesson-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.locked-lesson {
    background-color: #f8fafc !important;
    opacity: 0.8;
}

/* Lesson Intro Header */
.floating-blobs {
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.2), transparent 40%),
                radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1), transparent 30%);
    animation: rotateBlobs 20s linear infinite;
    z-index: 0;
}
@keyframes rotateBlobs {
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); }
}
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
}

/* Tutor Interface & Typing Area */
.typing-target-area {
    font-family: 'Inter', 'Roboto', sans-serif;
    letter-spacing: 0.05em;
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.target-text span {
    transition: all 0.1s ease;
    border-radius: 2px;
    padding: 0 1px;
}

/* Character states */
span.char-pending { color: #64748b; font-weight: 500; font-size: 1.1em; }
span.char-typed { color: #0f172a; font-weight: 600; font-size: 1.1em; }
span.char-error { color: #ffffff; background-color: #ef4444; border-radius: 4px; padding: 0 1px; font-weight: 600; font-size: 1.1em; }
span.char-active {
    color: #ffffff;
    background-color: var(--primary-color);
    border-radius: 4px;
    font-weight: 700;
    padding: 0 4px;
    font-size: 1.1em;
}
span.char-space { padding: 0 6px; }
span.char-space.char-error { background-color: #fca5a5; }
span.char-space.char-active { 
    background-color: rgba(99, 102, 241, 0.3);
    border-bottom: 3px solid var(--primary-color); 
}

/* Virtual Keyboard */
.virtual-keyboard-container {
    background: var(--kb-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: inset 0 4px 6px rgba(0,0,0,0.05);
}

.keyboard-base {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 800px;
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.key {
    width: 50px;
    height: 50px;
    background: var(--kb-key-bg);
    border: 1px solid var(--kb-key-border);
    border-bottom-width: 3px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--kb-key-text);
    font-size: 1rem;
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    user-select: none;
    position: relative;
}

/* Finger Layout Coloring (Subtle) */
.finger-l-pinky, .finger-r-pinky { border-top-color: #fca5a5; }
.finger-l-ring, .finger-r-ring { border-top-color: #fdba74; }
.finger-l-middle, .finger-r-middle { border-top-color: #fcd34d; }
.finger-l-index, .finger-r-index { border-top-color: #86efac; }
.finger-thumb { border-top-color: #93c5fd; }

/* Key Bumps */
.key.bump::after {
    content: '';
    position: absolute;
    bottom: 8px;
    width: 12px;
    height: 2px;
    background: #94a3b8;
    border-radius: 1px;
}

/* Key Modifiers */
.k-func { background: #f1f5f9; color: #64748b; font-size: 0.85rem; }
.wide { width: 75px; }
.x-wide { width: 110px; }
.k-spacebar { width: 350px; }

/* Active State Triggered by JS */
.key.active-target {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
    transform: translateY(2px);
    border-bottom-width: 1px;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}
.key.pressed {
    transform: translateY(2px);
    border-bottom-width: 1px;
    background: #e2e8f0;
}

/* Hands Guide */
.hands-guide-container {
    height: 150px;
    margin-top: 20px;
}

.hand-silhouette {
    width: 180px;
    height: 180px;
    /* Constructing hands via CSS shapes for immediate use without image dependencies */
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path fill="%23cbd5e1" d="M30,90 Q30,60 20,40 Q15,30 25,25 Q35,20 40,40 Q40,30 45,20 Q55,10 60,30 Q60,25 70,25 Q80,25 75,45 Q75,35 85,35 Q95,35 85,55 Q80,80 70,90 Z"/></svg>') no-repeat center center;
    background-size: contain;
    opacity: 0.8;
}

.hand-silhouette.right-hand {
    transform: scaleX(-1);
}

/* Finger Indicators Overlay */
.finger-indicator {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid white;
    box-shadow: 0 0 8px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Approximate positions on the SVG hand */
.l-pinky { top: 38%; left: 20%; }
.l-ring { top: 22%; left: 42%; }
.l-middle { top: 12%; left: 60%; }
.l-index { top: 25%; left: 75%; }
.l-thumb { top: 55%; left: 88%; }

.r-pinky { top: 38%; left: 20%; }
.r-ring { top: 22%; left: 42%; }
.r-middle { top: 12%; left: 60%; }
.r-index { top: 25%; left: 75%; }
.r-thumb { top: 55%; left: 88%; }

.finger-indicator.active {
    opacity: 1;
    transform: scale(1.5);
    background: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color);
}

/* Animations */
.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
