/*
 * public/css/courses/chapter.css
 * Shared by:
 *   - public/courses/chapter.php (legacy Javier/Sami course viewer)
 *   - public/courses/builder-course.php (new Course Builder viewer)
 * Contains: chapter nav, notation viewer (OSMD), drum mapping modal,
 *           and legacy chapter page scaffolding (chapter-page, chapter-header, etc.)
 */

.chapter-page { max-width: 800px; margin: 0 auto; padding: 0 24px 80px; }
.chapter-page__back-bar { padding: 32px 0; }
.chapter-page__back-link { font-size: 0.9rem; color: var(--color-text-muted); text-decoration: none; font-weight: 600; }
.chapter-page__back-link:hover { color: var(--color-primary); }

.chapter-header { margin-bottom: 48px; }
.chapter-header__meta { display: flex; gap: 16px; margin-bottom: 16px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-primary); font-weight: 700; }
.chapter-header__chapter { color: var(--color-text-faint); }
.chapter-header__title { font-size: 2.5rem; line-height: 1.1; margin-bottom: 24px; }

.chapter-video { margin-bottom: 48px; background: var(--color-surface-2); padding: 8px; border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
.chapter-video__wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius); background: #000; }
.chapter-video__wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.chapter-content { font-size: 1.1rem; line-height: 1.8; color: var(--color-text); margin-bottom: 64px; }
.chapter-content h2 { color: var(--color-text); margin-top: 48px; margin-bottom: 20px; padding-bottom: 8px; border-bottom: 2px solid var(--color-primary); font-size: 1.6rem; letter-spacing: -0.01em; display: block; }
.chapter-content p { margin-bottom: 1.5em; color: rgba(255, 255, 255, 0.85); }
.chapter-content ul { padding-left: 24px; margin-bottom: 1.5em; }
.chapter-content li { margin-bottom: 8px; color: rgba(255, 255, 255, 0.85); }
.chapter-content strong { color: var(--color-primary); }

.chapter__notation-box { background: rgba(235, 135, 15, 0.05); border-left: 4px solid var(--color-primary); padding: 24px; border-radius: 0 var(--radius) var(--radius) 0; margin: 32px 0; font-family: monospace; overflow-x: auto; font-size: 1rem; line-height: 1.6; }
.notation-x { color: var(--color-primary); font-size: 1.3em; font-weight: 800; }

/* Chapter navigation (builder-course.php) */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    border-top: 1px solid var(--color-border, var(--course-border));
    padding-top: 30px;
    margin-top: 60px;
}
.chapter-nav__btn {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
    color: var(--color-text-muted, var(--course-text-muted));
    max-width: 48%;
    transition: color 0.2s;
}
.chapter-nav__btn:hover { color: var(--color-primary); }
.chapter-nav__btn--next { text-align: right; align-items: flex-end; }
.chapter-nav__label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    opacity: 0.6;
    font-weight: 700;
}
.chapter-nav__title {
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.4;
}

@media (max-width: 768px) {
    .chapter-header__title { font-size: 1.8rem; }
    .chapter-nav { flex-direction: column; gap: 16px; }
    .chapter-nav__btn { max-width: 100%; }
    .chapter-nav__btn--next { align-items: flex-start; text-align: left; }
}

.chapter-page-content { padding: 80px 24px; text-align: center; }
.chapter-back-btn { margin-top: 24px; }
.chapter-takeaway-card { margin-top: 48px; padding: 24px; background: rgba(235, 135, 15, 0.05); border-left: 4px solid var(--color-primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; text-align: left; }
.chapter-takeaway-card h3 { margin-top: 0; margin-bottom: 12px; font-size: 1.4rem; color: var(--color-text); }
.chapter-takeaway-card p { margin: 0; font-size: 1.1rem; color: rgba(255, 255, 255, 0.85); }

/* NOTE: .course-chapter__starting-note, .course-chapter__media-btn, .cb-btn--primary
   are defined in sidebar-layout.css (public) and course-builder.css (admin).
   Do not redefine here — last-write-wins cascading would cause inconsistencies. */

/* ═══════════════════════════════════════════════════════════════════════════
   NOTATION VIEWER  (BEM block: course-notation)
   ═══════════════════════════════════════════════════════════════════════════ */
.course-notation {
    width: 100%;
    min-height: 160px;
    margin: 32px 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 10px);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.course-notation__btn {
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--color-surface-2);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    transition: all 0.2s ease;
    min-width: 56px;
}
.course-notation__btn:hover:not(:disabled) {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-surface);
}
.course-notation__btn:disabled { opacity: 0.5; cursor: not-allowed; }

.course-notation__display {
    width: 100%;
    padding: 8px 4px;
    overflow-x: auto;
}

/* Notation Toolbar layout */
.course-notation__controls {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.course-notation__controls-left, .course-notation__controls-right {
    display: flex;
    gap: 12px;
    align-items: center;
}
.course-notation__controls-right {
    font-size: 0.8rem;
    color: var(--color-text-faint);
}
.course-notation__control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--color-text);
    font-size: 0.85rem;
    font-weight: 600;
}
.course-notation__control-group input[type="range"] {
    width: 60px;
    accent-color: var(--color-primary);
}
.course-notation__control-group input[type="checkbox"] {
    accent-color: var(--color-primary);
    width: 14px;
    height: 14px;
    cursor: pointer;
}
.course-notation__control-group input[type="number"],
.course-notation__control-group select {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 0.8rem;
    outline: none;
}
.course-notation__control-group select:focus,
.course-notation__control-group input[type="number"]:focus {
    border-color: var(--color-primary);
}

/* Drum Mapping Modal */
.drum-mapping-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}

.drum-mapping-modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    transform: translateY(20px);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.drum-mapping-modal h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--color-text);
    margin-bottom: 8px;
}

.drum-mapping-modal p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.drum-mapping-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--color-surface-2);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--color-border);
}

.drum-mapping-row strong {
    font-family: monospace;
    color: var(--color-primary);
    font-size: 1.1rem;
}

.drum-map-select {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
    font-size: 0.9rem;
}

.drum-map-select:focus {
    border-color: var(--color-primary);
}

.drum-mapping-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 32px;
}

@keyframes fadeIn { to { opacity: 1; } }
@keyframes slideUp { to { transform: translateY(0); } }
