/* Course-specific styles */

/* Course Home View */
.course-home-view {
    min-height: 100vh;
    background: var(--background);
    display: flex;
    flex-direction: column;
}

.course-home-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    gap: 16px; /* Adds space between elements */
}

.course-home-header > button {
    margin: 0;
}

.course-home-header .back-btn:first-of-type {
    justify-self: start;
}

.course-home-header .dark-mode-toggle {
    justify-self: end;
}

.course-home-header .reset-btn {
    justify-self: center;
}

.course-home-content {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    padding: 0 24px;
}

/* Section Selector (Duolingo-style) */
.section-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0 20px;
    gap: 20px;
}

.section-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--background-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: inherit;
}

.section-nav-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--background-alt);
}

.section-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.section-info {
    text-align: center;
    min-width: 300px;
}

.section-number {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.test-out-btn {
    padding: 8px 16px;
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.test-out-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Course Path Container */
.course-path-container {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.course-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    max-width: 600px;
    width: 100%;
}

/* Unit Groups */
.unit-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.unit-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    padding: 0 20px;
}

.unit-info {
    text-align: center;
    flex: 1;
}

.unit-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.unit-progress {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.unit-test-btn {
    padding: 6px 12px;
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.unit-test-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Lesson Nodes (Duolingo-style path) */
.lessons-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    position: relative;
}

.lesson-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
}

.lesson-row:nth-child(even) {
    justify-content: flex-end;
    padding-right: 15%;
}

.lesson-row:nth-child(odd) {
    justify-content: flex-start;
    padding-left: 15%;
}

.lesson-row:nth-child(4n+1) {
    justify-content: center;
    padding: 0;
}

.lesson-node {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    border: 4px solid;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.lesson-node.completed {
    background: #10b981;
    border-color: #059669;
    color: white;
}

.lesson-node.completed::after {
    content: '✓';
    font-size: 1.5rem;
}

.lesson-node.current {
    background: var(--primary-color);
    border-color: var(--primary-hover);
    color: white;
    animation: pulse 2s infinite;
}

.lesson-node.locked {
    background: var(--background-alt);
    border-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

.lesson-node.locked::after {
    content: '🔒';
    font-size: 1.25rem;
}

.lesson-node.unlocked {
    background: var(--background-card);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.lesson-node:hover:not(.locked) {
    transform: scale(1.1);
}

/* Path connector line */
.lessons-path::before {
    content: '';
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: calc(100% - 80px);
    background: linear-gradient(to bottom, var(--primary-color), var(--border-color));
    border-radius: 2px;
    z-index: 1;
}

/* Fullscreen Lesson View */
.lesson-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.lesson-header-bar {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-card);
    gap: 20px;
}

.lesson-back-btn {
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lesson-back-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.lesson-progress-container {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.lesson-progress-bar {
    flex: 1;
    height: 12px;
    background: var(--background-alt);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.lesson-progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

.lesson-progress-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
}

.lesson-main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.lesson-exercise-area {
    width: 100%;
    max-width: 800px;
    text-align: center;
}

.lesson-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--background-card);
}

.lesson-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 800px;
    margin: 0 auto;
}

.control-main {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* Exercise Styles */
.exercise-question {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 40px;
    line-height: 1.4;
}

.exercise-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.option-btn {
    padding: 20px 24px;
    background: var(--background-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background: var(--background-alt);
    transform: translateY(-2px);
}

.option-btn.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.option-btn.correct {
    border-color: #10b981;
    background: #10b981;
    color: white;
}

.option-btn.incorrect {
    border-color: #ef4444;
    background: #ef4444;
    color: white;
}

.sentence-builder {
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: center;
    max-width: 700px;
    margin: 0 auto;
}

.sentence-area {
    min-height: 100px;
    padding: 24px;
    background: var(--background-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    width: 100%;
    transition: all 0.2s ease;
}

.sentence-area.has-words {
    border-style: solid;
    border-color: var(--primary-color);
}

.word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    min-height: 80px;
    padding: 20px;
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%;
}

.word-chip {
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.word-chip:hover:not(.used) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.word-chip.used {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    opacity: 0.5;
}

.placed-word {
    padding: 12px 20px;
    background: var(--background-alt);
    border: 2px solid var(--primary-color);
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.placed-word:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 1.125rem;
}

.translation-hint {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 16px;
}

/* Control Buttons */
.control-btn {
    padding: 16px 32px;
    font-size: 1.125rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 140px;
}

.control-btn.primary {
    background: var(--primary-color);
    color: white;
}

.control-btn.primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.control-btn.secondary {
    background: var(--background-alt);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.control-btn.secondary:hover:not(:disabled) {
    background: var(--border-color);
    color: var(--text-primary);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Completion View */
.completion-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.completion-content {
    text-align: center;
    padding: 60px 40px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-width: 500px;
    width: 90%;
}

.completion-icon {
    font-size: 5rem;
    margin-bottom: 24px;
}

.completion-content h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.completion-content p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.completion-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Feedback Styles */
.feedback-section {
    margin-top: 32px;
    padding: 24px;
    border-radius: var(--radius);
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.feedback-section.show {
    opacity: 1;
    transform: translateY(0);
}

.feedback-section.correct {
    background: #ecfdf5;
    border: 2px solid #10b981;
    color: #065f46;
}

.feedback-section.incorrect {
    background: #fef2f2;
    border: 2px solid #ef4444;
    color: #991b1b;
}

[data-theme="dark"] .feedback-section.correct {
    background: #064e3b;
    border-color: #059669;
    color: #6ee7b7;
}

[data-theme="dark"] .feedback-section.incorrect {
    background: #7f1d1d;
    border-color: #dc2626;
    color: #fca5a5;
}

.feedback-text {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.correct-answer {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .course-home-content {
        padding: 0 16px;
    }
    
    .section-selector {
        padding: 24px 0 16px;
        gap: 16px;
    }
    
    .section-info {
        min-width: 250px;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .lesson-node {
        width: 60px;
        height: 60px;
        font-size: 1rem;
    }
    
    .exercise-question {
        font-size: 1.5rem;
        margin-bottom: 32px;
    }
    
    .exercise-options {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .option-btn {
        padding: 16px 20px;
        font-size: 1rem;
        min-height: 60px;
    }
    
    .lesson-main-content {
        padding: 24px 16px;
    }
    
    .lesson-controls {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .control-main {
        justify-content: stretch;
    }
    
    .control-btn {
        width: 100%;
        min-width: auto;
    }
    
    .completion-content {
        padding: 40px 24px;
        margin: 16px;
    }
    
    .completion-content h2 {
        font-size: 2rem;
    }
    
    .completion-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .section-nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .lesson-node {
        width: 50px;
        height: 50px;
        font-size: 0.875rem;
    }
    
    .exercise-question {
        font-size: 1.25rem;
    }
    
    .word-chip,
    .placed-word {
        font-size: 0.875rem;
        padding: 10px 16px;
    }
    
    .sentence-area {
        min-height: 80px;
        padding: 16px;
    }
    
    .word-bank {
        padding: 16px;
        min-height: 60px;
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}