/* ============================================
   Koans Learning System Styles
   ============================================ */

.koans-layout {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.koans-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Exercise Page Layout */
.exercise-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
    height: calc(100vh - 250px);
}

.exercise-instructions {
    grid-column: 1 / -1;
    background: var(--light-gray);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.exercise-instructions h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.exercise-instructions .difficulty {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.difficulty.beginner {
    background-color: #4CAF50;
    color: white;
}

.difficulty.intermediate {
    background-color: var(--accent-color);
    color: #000;
}

.difficulty.advanced {
    background-color: #f44336;
    color: white;
}

.exercise-description {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.hints-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.hint-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.5rem;
    transition: background-color 0.3s;
}

.hint-btn:hover {
    background-color: #3a2670;
}

.hint {
    background-color: #fff3cd;
    border-left: 4px solid var(--accent-color);
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    border-radius: 4px;
    display: none;
}

.hint.show {
    display: block;
}

/* Code Editor Panel (reuse editor styles with modifications) */
.exercise-editor-panel {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.exercise-editor-header {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.exercise-editor-header h3 {
    margin: 0;
    font-size: 1rem;
}

.editor-tabs {
    display: flex;
    gap: 0.5rem;
    background-color: #3a2670;
    padding: 0.5rem;
}

.editor-tab {
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.editor-tab.active {
    background-color: var(--accent-color);
    color: #000;
}

.editor-tab:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.exercise-code-editor {
    flex: 1;
    width: 100%;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    border: none;
    resize: none;
    background-color: #1e1e1e;
    color: #d4d4d4;
    line-height: 1.5;
    min-height: 400px;
}

.exercise-code-editor:focus {
    outline: none;
}

.exercise-editor-controls {
    background-color: var(--light-gray);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.exercise-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    font-size: 0.875rem;
}

.btn-check {
    background-color: #4CAF50;
    color: white;
}

.btn-check:hover {
    background-color: #45a049;
}

.btn-check:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.btn-reset-exercise {
    background-color: #666;
    color: white;
}

.btn-reset-exercise:hover {
    background-color: #555;
}

.btn-show-solution {
    background-color: var(--accent-color);
    color: #000;
}

.btn-show-solution:hover {
    background-color: #e6a820;
}

/* Preview Panel */
.exercise-preview-panel {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.exercise-preview-header {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.exercise-preview-header h3 {
    margin: 0;
    font-size: 1rem;
}

.preview-label {
    font-size: 0.75rem;
    opacity: 0.8;
}

.exercise-preview-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background-color: white;
    min-height: 400px;
}

/* Feedback Messages */
.feedback-message {
    grid-column: 1 / -1;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    display: none;
}

.feedback-message.show {
    display: block;
}

.feedback-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.feedback-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Navigation Bar */
.exercise-nav {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s;
    font-size: 1rem;
}

.nav-btn:hover {
    background-color: #3a2670;
}

.nav-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Progress Indicator */
.progress-indicator {
    text-align: center;
    color: var(--text-color);
    font-weight: 500;
}

/* Exercise List Page */
.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.exercise-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.exercise-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.exercise-card.completed {
    border-color: #4CAF50;
    background-color: #f0f9f0;
}

.exercise-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.exercise-card-title {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin: 0;
}

.exercise-card-status {
    font-size: 1.5rem;
}

.exercise-card-status.completed {
    color: #4CAF50;
}

.exercise-card-description {
    flex: 1;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.exercise-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.exercise-card-difficulty {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Landing Page */
.koans-hero {
    text-align: center;
    padding: 3rem 0;
}

.koans-hero h1 {
    color: var(--primary-color);
    font-size: 3rem;
    margin-bottom: 1rem;
}

.koans-hero p {
    font-size: 1.25rem;
    color: var(--text-color);
    max-width: 700px;
    margin: 0 auto 2rem;
}

.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.part-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s;
}

.part-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    transform: translateY(-4px);
}

.part-card h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.part-card-description {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.part-card-features {
    list-style: none;
    margin-bottom: 1.5rem;
}

.part-card-features li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.part-card-features li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4CAF50;
    font-weight: bold;
}

.btn-primary {
    display: inline-block;
    padding: 0.75rem 2rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #3a2670;
}

/* Responsive */
@media (max-width: 968px) {
    .exercise-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .exercise-editor-panel,
    .exercise-preview-panel {
        min-height: 400px;
    }

    .parts-grid {
        grid-template-columns: 1fr;
    }
}