/**
 * SoulBossaNova Course Player v3.7
 * Sidebar Hero + Clean Content
 */

/* ============================================================================
   FORCE WHITE BACKGROUND
   ============================================================================ */

body.single-sbn_course {
    background: #ffffff !important;
}

body.single-sbn_course .site-content,
body.single-sbn_course .ast-container,
body.single-sbn_course article {
    background: #ffffff !important;
}

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */

:root {
    --sbn-primary: #e85d3b;
    --sbn-primary-light: #fef3f0;
    --sbn-primary-dark: #d04a2a;
    --sbn-text: #2d2d2d;
    --sbn-text-secondary: #666;
    --sbn-text-muted: #999;
    --sbn-border: #e5e5e5;
    --sbn-bg: #ffffff;
    --sbn-bg-subtle: #fafafa;
    --sbn-transition: 0.15s ease;
}

/* ============================================================================
   MAIN CONTAINER - FIXED WIDTH & HEIGHT
   ============================================================================ */

.sbn-course-player {
    display: flex;
    background: var(--sbn-bg);
    border: none;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    height: 700px; /* FIXED height - never changes */
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--sbn-text);
    position: relative;
    overflow: hidden; /* CRITICAL: Hide overflow, force internal scrolling */
    /* Border radius clipping handled by overflow:hidden */
}

.sbn-course-player *,
.sbn-course-player *::before,
.sbn-course-player *::after {
    box-sizing: border-box;
}

/* ============================================================================
   SIDEBAR - APP-LIKE DESIGN
   ============================================================================ */

.sbn-sidebar {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    height: 700px; /* FIXED height - match main container */
    flex-shrink: 0;
    border-right: none; /* Remove border for closer spacing */
    display: flex;
    flex-direction: column;
    background: #fcfcfc; /* Style 3: Almost white */
    overflow: hidden;
}

/* Sidebar Hero - Compact Design */
.sbn-sidebar-hero {
    height: auto;
    min-height: 80px; /* Reduced from 120px */
    background: #fafafa;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px 20px 16px 20px; /* Increased top padding */
    position: relative;
    border-bottom: 2px solid #e5e5e5;
}

.sbn-hero-stars {
    color: #f39c12;
    font-size: 14px;
    margin: 0 0 2px 0 !important; /* Force no top margin, minimal bottom */
    padding: 0 !important; /* Force no padding */
    letter-spacing: 2px;
    line-height: 1 !important;
}

.sbn-hero-title {
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 10px 0 !important; /* Force no top margin */
    padding: 0 !important; /* Force no padding */
    line-height: 1.2;
    letter-spacing: -0.3px;
}

/* Override any h2 defaults from theme */
.sbn-sidebar-hero h2 {
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
}

.sbn-hero-badges {
    display: flex;
    gap: 6px; /* Reduced from 8px */
    align-items: center;
    flex-wrap: wrap;
}

.sbn-badge-count {
    padding: 4px 10px; /* Reduced padding */
    border-radius: 12px; /* Smaller radius */
    font-size: 10px; /* Smaller font */
    font-weight: 600;
    color: white;
    background: var(--sbn-primary);
}

.sbn-badge-style {
    padding: 4px 10px; /* Reduced padding */
    border-radius: 12px;
    font-size: 10px; /* Smaller font */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white !important;
    background: var(--sbn-primary);
    text-decoration: none !important; /* Remove underline */
    border-bottom: none !important; /* Remove border */
    transition: all 0.2s ease;
    display: inline-block; /* Ensure proper spacing */
}

.sbn-badge-style:hover,
.sbn-badge-style:focus,
.sbn-badge-style:active {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-decoration: none !important; /* Remove underline on hover */
    border-bottom: none !important; /* Remove border */
    color: white !important;
}

.sbn-lesson-nav {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 16px;
}

/* Section Labels - ORIGINAL DESIGN - Force override h3 defaults */
.sbn-course-player .sbn-sidebar .sbn-section-label,
.sbn-section-label {
    font-size: 9px !important; /* Override h3 default */
    font-weight: 600 !important; /* Override h3 default */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999 !important; /* Light grey */
    padding: 16px 24px 8px;
    margin: 0 !important; /* Override h3 default margin */
    line-height: 1.2 !important; /* Override h3 default */
}

/* Extra specificity for h3 tags used as section labels */
h3.sbn-section-label {
    font-size: 9px !important;
    font-weight: 600 !important;
    margin: 0 !important;
}

.sbn-lesson-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Lesson Item - STYLE 3: Minimalist Chic */
.sbn-lesson-item {
    border-left: 2px solid transparent; /* Thin border */
    transition: all 0.2s ease;
    position: relative;
    margin: 0;
}

.sbn-lesson-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0;
    margin: 0;
}

.sbn-lesson-header:hover {
    background: white;
    transform: translateX(4px);
}

.sbn-lesson-item.is-active {
    border-left-color: var(--sbn-primary); /* Thin red line */
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); /* Soft shadow */
}

.sbn-lesson-item.is-active > .sbn-lesson-header {
    background: white;
}

.sbn-lesson-item.is-active > .sbn-lesson-header .sbn-lesson-title {
    color: var(--sbn-primary);
    font-weight: 600;
}

.sbn-lesson-item.is-locked {
    opacity: 0.5;
}

.sbn-lesson-item.is-locked:hover {
    opacity: 0.7;
    transform: none;
}

.sbn-lesson-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.sbn-lesson-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--sbn-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Expand Icon - CSS triangle, theme-proof */
.sbn-expand-icon {
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 6px solid var(--sbn-text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.sbn-lesson-item.is-expanded .sbn-expand-icon {
    transform: rotate(90deg);
}

/* Ensure no theme overrides */
.sbn-course-player .sbn-expand-icon {
    font-size: 0;
    line-height: 0;
    background: none;
    color: transparent;
}

/* Badges */
.sbn-lock-icon {
    font-size: 12px;
    color: var(--sbn-text-muted);
    flex-shrink: 0;
}

.sbn-preview-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--sbn-primary);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* ============================================================================
   SUB-MENU - NO BORDER, JUST BACKGROUND FOR ACTIVE
   ============================================================================ */

.sbn-sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    background: var(--sbn-bg-subtle);
}

.sbn-lesson-item.is-expanded .sbn-sub-menu {
    max-height: 500px;
}

/* Sub-item - NO border, just background + shadow */
.sbn-sub-item {
    padding: 10px 24px;
    font-size: 13px;
    color: var(--sbn-text-secondary);
    cursor: pointer;
    transition: all var(--sbn-transition);
    margin: 0;
}

.sbn-sub-item:hover {
    background: #f0f0f0;
    color: var(--sbn-text);
}

.sbn-sub-item.is-active {
    background: white; /* White background */
    color: var(--sbn-primary);
    font-weight: 500;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); /* Subtle shadow */
}

/* ============================================================================
   SIDEBAR CTA & PROGRESS
   ============================================================================ */

.sbn-sidebar-cta {
    padding: 20px 24px;
    border-top: 1px solid var(--sbn-border);
    background: var(--sbn-bg-subtle);
}

.sbn-sidebar-cta .sbn-btn {
    width: 100%;
    padding: 12px 20px;
    background: var(--sbn-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: block;
    transition: background var(--sbn-transition);
}

.sbn-sidebar-cta .sbn-btn:hover {
    background: var(--sbn-primary-dark);
}

.sbn-sidebar-progress {
    display: none; /* HIDDEN - Progress bar removed */
    padding: 16px 24px;
    border-top: 1px solid var(--sbn-border);
    background: var(--sbn-bg-subtle);
}

.sbn-progress-label {
    font-size: 11px;
    color: var(--sbn-text-muted);
    margin-bottom: 8px;
}

.sbn-progress-bar {
    height: 4px;
    background: var(--sbn-border);
    border-radius: 2px;
    overflow: hidden;
}

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

/* ============================================================================
   MAIN CONTENT AREA
   ============================================================================ */

.sbn-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    position: relative;
    height: 700px; /* FIXED: Exact match to parent */
    overflow: hidden; /* Force internal scrolling only */
    isolation: isolate;
}

.sbn-lesson-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 32px 48px;
    padding-bottom: 160px; /* Space for bottom bar */
    width: 100%;
    box-sizing: border-box;
}

/* Content Body - Starts immediately, no header */
.sbn-content-body {
    max-width: 800px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-wrap: break-word; /* Break long words */
    word-wrap: break-word;
}

/* Prevent any child elements from breaking out */
.sbn-content-body > * {
    max-width: 100%;
    box-sizing: border-box;
}

.sbn-content-body p {
    margin: 0 0 16px 0;
}

.sbn-content-body h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--sbn-text);
    margin: 32px 0 16px 0;
    padding-top: 16px;
}

.sbn-content-body h2:first-child {
    margin-top: 0;
    padding-top: 0;
}

.sbn-content-body ul,
.sbn-content-body ol {
    margin: 0 0 16px 24px;
}

.sbn-content-body li {
    margin-bottom: 8px;
}

/* ============================================================================
   SUBSECTION CONTENT CHUNKS
   ============================================================================ */

.sbn-subsection-chunk {
    display: none;
}

.sbn-subsection-chunk.is-active {
    display: block;
}

/* ============================================================================
   NAVIGATION FOOTER
   ============================================================================ */

.sbn-nav-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--sbn-border);
}

.sbn-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--sbn-bg-subtle);
    border: 1px solid var(--sbn-border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--sbn-text);
    cursor: pointer;
    transition: all var(--sbn-transition);
    text-decoration: none;
}

.sbn-nav-btn:hover {
    background: var(--sbn-bg);
    border-color: var(--sbn-primary);
    color: var(--sbn-primary);
}

.sbn-nav-btn.is-primary {
    background: var(--sbn-primary);
    border-color: var(--sbn-primary);
    color: white;
}

.sbn-nav-btn.is-primary:hover {
    background: var(--sbn-primary-dark);
    border-color: var(--sbn-primary-dark);
}

.sbn-nav-btn.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sbn-nav-btn.is-disabled:hover {
    background: var(--sbn-bg-subtle);
    border-color: var(--sbn-border);
    color: var(--sbn-text);
}

/* ============================================================================
   LOCK OVERLAY
   ============================================================================ */

.sbn-lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.sbn-lock-overlay.is-visible {
    display: flex;
}

.sbn-lock-content {
    text-align: center;
    padding: 48px;
}

.sbn-lock-icon-large {
    font-size: 48px;
    margin-bottom: 16px;
}

.sbn-lock-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.sbn-lock-text {
    color: var(--sbn-text-secondary);
    margin-bottom: 24px;
}

/* ============================================================================
   BOTTOM BAR - OVERLAY STYLE
   ============================================================================ */

.sbn-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--sbn-border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 100;
    /* Force new stacking context for proper positioning */
    transform: translateZ(0);
    will-change: transform;
}

.sbn-bar-tabs {
    display: flex;
    background: var(--sbn-bg-subtle);
}

.sbn-bar-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--sbn-border);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--sbn-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--sbn-transition);
    font-family: inherit;
}

.sbn-bar-tab:last-child {
    border-right: none;
}

.sbn-bar-tab:hover {
    background: white;
    color: var(--sbn-text);
}

.sbn-bar-tab.is-active {
    background: white;
    color: var(--sbn-primary);
}

.sbn-bar-tab .sbn-tab-icon {
    font-size: 16px;
}

.sbn-bar-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
}

.sbn-bar-panel.is-open {
    max-height: 300px;
    overflow-y: auto;
}

.sbn-bar-panel-inner {
    padding: 20px 24px;
    border-top: 1px solid var(--sbn-border);
}

.sbn-panel-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sbn-text-muted);
    margin-bottom: 16px;
}

/* ============================================================================
   CHORD GRID - DETAILED STYLE (No chord type)
   ============================================================================ */

.sbn-chords-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.sbn-chord {
    text-align: center;
    /* NO background, NO border, NO padding - clean display */
}

.sbn-chord-name {
    font-size: 15px; /* Increased from 14px */
    font-weight: 700;
    margin-bottom: 10px; /* Increased from 8px */
    color: var(--sbn-text);
}

.sbn-chord-svg {
    width: 110px; /* Increased from 95px */
    height: auto;
}

/* Chord placeholder */
.sbn-chord-placeholder {
    width: 110px; /* Increased from 95px */
    height: 130px; /* Increased from 115px */
    background: var(--sbn-bg-subtle);
    border: 1px dashed var(--sbn-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sbn-text-muted);
    font-size: 12px;
}

/* ============================================================================
   RHYTHM GRID - Styles moved to RHYTHM PATTERN STYLES section below
   ============================================================================ */

.sbn-rhythms-row {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

/* Main rhythm styles are defined in RHYTHM PATTERN STYLES section */

/* Rhythm placeholder */
.sbn-rhythm-placeholder {
    width: 250px;
    height: 80px;
    background: var(--sbn-bg-subtle);
    border: 1px dashed var(--sbn-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sbn-text-muted);
    font-size: 12px;
}

/* ============================================================================
   SHEET PLAYER
   ============================================================================ */

.sbn-sheet-player {
    margin: 24px 0;
    border: 1px solid var(--sbn-border);
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
}

.sbn-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--sbn-border);
}

.sbn-sheet-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--sbn-text);
}

.sbn-sheet-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sbn-sheet-btn {
    padding: 6px 12px;
    background: var(--sbn-bg-subtle);
    border: 1px solid var(--sbn-border);
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--sbn-transition);
}

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

.sbn-sheet-btn.is-active {
    background: var(--sbn-primary);
    border-color: var(--sbn-primary);
    color: white;
}

.sbn-speed-control {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--sbn-text-secondary);
}

.sbn-speed-control input[type="range"] {
    width: 80px;
    cursor: pointer;
}

.sbn-sheet-content {
    min-height: 200px;
    padding: 16px;
}

.sbn-sheet-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--sbn-text-muted);
}

/* YouTube Container */
.sbn-youtube-container {
    border-top: 1px solid var(--sbn-border);
    background: #000;
}

.sbn-youtube-container iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
}

/* ============================================================================
   INLINE CHORD/RHYTHM SHORTCODES
   ============================================================================ */

.sbn-inline-chord {
    display: inline-block;
    margin: 16px 8px 16px 0;
    vertical-align: top;
}

.sbn-inline-rhythm {
    display: block;
    margin: 24px 0;
}

/* ============================================================================
   LOADING & STATES
   ============================================================================ */

.sbn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--sbn-text-muted);
}

.sbn-loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--sbn-border);
    border-top-color: var(--sbn-primary);
    border-radius: 50%;
    animation: sbn-spin 0.8s linear infinite;
    margin-left: 12px;
}

@keyframes sbn-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   CHORD DIAGRAM STYLES
   ============================================================================ */

.sbn-inline-chord {
    display: inline-block;
    vertical-align: top;
    margin: 8px 12px 8px 0;
}

.sbn-chord {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* REMOVED: background, border, border-radius, padding */
    /* Clean display with no box */
    min-width: 90px;
}

.sbn-chord-name {
    font-size: 15px; /* Match the main definition */
    font-weight: 700; /* Match the main definition */
    color: var(--sbn-text);
    margin-bottom: 10px; /* Match the main definition */
}

.sbn-chord-svg {
    width: 110px; /* Match the main definition */
    height: auto;
}

/* Multiple chords in a row */
.sbn-chord-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

/* ============================================================================
   RHYTHM PATTERN STYLES - Complete Overhaul
   ============================================================================ */

.sbn-inline-rhythm {
    display: block;
    margin: 20px 0;
}

.sbn-rhythm {
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 16px 20px;
    display: inline-block;
    max-width: 100%;
}

/* Header with Name and Play Button */
.sbn-rhythm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
}

.sbn-rhythm-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--sbn-text);
    margin: 0;
}

/* Play Button - RED/ORANGE with WHITE icon */
.sbn-rhythm-play-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--sbn-primary, #f39c12);
    color: white !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    position: relative;
}

/* CSS Triangle Play Icon - NO Unicode */
.sbn-rhythm-play-btn .play-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent white;
    margin-left: 3px; /* Visual centering */
    /* Hide any text content */
    font-size: 0;
    line-height: 0;
}

.sbn-rhythm-play-btn:hover {
    background: var(--sbn-primary-dark, #e67e22);
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.sbn-rhythm-play-btn.playing {
    background: #333;
}

/* CSS Stop Icon (Square) when playing */
.sbn-rhythm-play-btn.playing .play-icon {
    width: 12px;
    height: 12px;
    border: none;
    background: white;
    border-radius: 2px;
    margin-left: 0;
}

/* Rhythm Grid Container */
.sbn-rhythm-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Rhythm Section (for multi-line patterns) */
.sbn-rhythm-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Add visual separator between sections for 16-beat patterns */
.sbn-rhythm-section.sbn-rhythm-line-2 {
    padding-top: 12px;
    border-top: 1px dashed #ddd;
    margin-top: 4px;
}

/* Rhythm Row */
.sbn-rhythm-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Labels */
.sbn-rhythm-label {
    width: 50px;
    min-width: 50px;
    font-size: 11px;
    color: var(--sbn-text-secondary, #666);
    text-align: right;
    padding-right: 8px;
    flex-shrink: 0;
}

/* Beat cells */
.sbn-rhythm-beat {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    color: transparent;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

/* Beat numbers row */
.sbn-rhythm-beat.sbn-rhythm-beat-num {
    background: transparent;
    border: none;
    font-size: 11px;
    font-weight: 600;
    color: var(--sbn-text-muted, #999);
    height: 20px;
    min-height: 20px;
}

.sbn-rhythm-beat.sbn-rhythm-beat-num.is-playing {
    color: var(--sbn-primary, #f39c12);
    font-weight: 700;
}

/* Active beats (hits) */
.sbn-rhythm-beat.is-active {
    background: var(--sbn-primary, #f39c12);
    border-color: var(--sbn-primary, #f39c12);
    color: white;
}

/* Accent beats */
.sbn-rhythm-beat.is-accent {
    background: var(--sbn-text, #2c3e50);
    border-color: var(--sbn-text, #2c3e50);
    color: white;
    font-weight: bold;
}

/* Playing state - highlight current beat */
.sbn-rhythm-beat.is-playing:not(.sbn-rhythm-beat-num) {
    border-color: var(--sbn-primary, #f39c12);
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.3);
}

/* Responsive: smaller beats on narrow screens */
@media (max-width: 500px) {
    .sbn-rhythm-beat {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        font-size: 12px;
    }
    
    .sbn-rhythm-label {
        width: 45px;
        min-width: 45px;
        font-size: 10px;
    }
    
    .sbn-rhythm-beat.sbn-rhythm-beat-num {
        font-size: 10px;
    }
}

/* ============================================================================
   RHYTHM ONE-LINE DISPLAY (for 16-beat patterns on wide screens)
   ============================================================================ */

/* Force one-line: always show all beats on one line */
.sbn-inline-rhythm.sbn-rhythm-oneline .sbn-rhythm-grid {
    display: flex;
    flex-direction: column;
}

.sbn-inline-rhythm.sbn-rhythm-oneline .sbn-rhythm-section {
    display: contents;
}

.sbn-inline-rhythm.sbn-rhythm-oneline .sbn-rhythm-row {
    flex-wrap: nowrap;
}

.sbn-inline-rhythm.sbn-rhythm-oneline .sbn-rhythm-section + .sbn-rhythm-section {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

/* Auto one-line: show on one line on wide screens (> 900px) */
@media (min-width: 900px) {
    .sbn-inline-rhythm.sbn-rhythm-oneline-auto .sbn-rhythm-grid {
        display: flex;
        flex-direction: column;
    }
    
    .sbn-inline-rhythm.sbn-rhythm-oneline-auto .sbn-rhythm-section {
        display: contents;
    }
    
    .sbn-inline-rhythm.sbn-rhythm-oneline-auto .sbn-rhythm-row {
        flex-wrap: nowrap;
    }
    
    .sbn-inline-rhythm.sbn-rhythm-oneline-auto .sbn-rhythm-section + .sbn-rhythm-section {
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }
}

/* ============================================================================
   RHYTHM BLEND SLIDER (Synth / Music)
   ============================================================================ */

.sbn-rhythm-blend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 20px;
}

.sbn-blend-label {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sbn-text-muted, #999);
    transition: all 0.2s ease;
}

.sbn-blend-label.is-active {
    color: var(--sbn-primary, #e85d3b);
}

.sbn-blend-label svg {
    width: 14px;
    height: 14px;
}

.sbn-blend-slider {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--sbn-primary, #e85d3b), #666);
    border-radius: 2px;
    cursor: pointer;
    outline: none;
}

.sbn-blend-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid var(--sbn-primary, #e85d3b);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease;
}

.sbn-blend-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.sbn-blend-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid var(--sbn-primary, #e85d3b);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Adjust header layout when blend slider is present */
.sbn-rhythm-header:has(.sbn-rhythm-blend) {
    justify-content: flex-start;
}

.sbn-rhythm-header:has(.sbn-rhythm-blend) .sbn-rhythm-name {
    margin-right: 12px;
}

/* Loading State for MP3 */
.sbn-rhythm.is-loading .sbn-rhythm-play-btn {
    opacity: 0.6;
    pointer-events: none;
}

.sbn-rhythm.is-loading .sbn-rhythm-play-btn .play-icon {
    /* Hide the triangle */
    border: none;
    width: 16px;
    height: 16px;
    margin-left: 0;
    /* Show spinner */
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: sbn-rhythm-spin 0.7s linear infinite;
}

@keyframes sbn-rhythm-spin {
    to { transform: rotate(360deg); }
}

/* Responsive: smaller blend slider on narrow screens */
@media (max-width: 500px) {
    .sbn-rhythm-blend {
        padding: 3px 6px;
        gap: 4px;
    }
    
    .sbn-blend-slider {
        width: 50px;
    }
    
    .sbn-blend-label svg {
        width: 12px;
        height: 12px;
    }
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

/* Tablet Landscape & Desktop - Full viewport app mode */
@media (min-width: 769px) {
    /* Full viewport container - account for header */
    body.single-sbn_course,
    body.sbn-course-page {
        overflow-x: hidden !important;
    }
    
    body.single-sbn_course .site-content,
    body.sbn-course-page .site-content,
    body.single-sbn_course .ast-container,
    body.sbn-course-page .ast-container,
    body.single-sbn_course .entry-content,
    body.sbn-course-page .entry-content,
    body.single-sbn_course article,
    body.sbn-course-page article,
    body.sbn-course-page .sbn-course-page-integration,
    body.sbn-course-page .sbn-course-page-integration .site-main {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    
    /* Course Player - Full Width App Mode for ALL screen sizes */
    .sbn-course-player {
        position: fixed !important;
        top: 104px !important; /* Below header with margin */
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: calc(100vh - 90px) !important;
        height: calc(100dvh - 90px) !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        z-index: 999;
        border-top: 2px solid var(--sbn-border); /* Visible separator line */
    }
    
    /* Bottom bar - fixed to bottom of viewport */
    .sbn-bottom-bar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000;
    }
    
    /* Main content needs padding for bottom bar */
    .sbn-main {
        height: calc(100% - 48px) !important; /* Account for bottom bar tabs */
    }
}

/* ============================================================================
   TABLET & LAPTOP APP MODE - Sidebar Specifics
   Additional styles for tablet/laptop range
   ============================================================================ */

@media (min-width: 769px) and (max-width: 1440px) {
    /* Sidebar - Slide from left, stops at bottom bar tabs */
    .sbn-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 48px !important; /* Stop exactly at bottom bar tabs height */
        width: 320px;
        min-width: 320px;
        max-width: 320px;
        height: auto !important; /* Let top/bottom determine height */
        z-index: 100;
        transform: translateX(0);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        box-shadow: none; /* Clean connection - no shadow */
        border-right: 1px solid var(--sbn-border); /* Subtle border instead */
        border-radius: 0;
        /* Prevent touch scrolling from moving the sidebar */
        touch-action: pan-y;
        overscroll-behavior: contain;
    }
    
    /* Sidebar collapsed state */
    .sbn-course-player.sidebar-collapsed .sbn-sidebar {
        transform: translateX(-280px);
        box-shadow: none;
    }
    
    .sbn-course-player.sidebar-collapsed .sbn-sidebar:hover {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }
    
    /* Sidebar toggle tab - visible when collapsed */
    .sbn-sidebar::after {
        content: '☰';
        position: absolute;
        right: -40px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 60px;
        background: white;
        border-radius: 0 8px 8px 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        color: var(--sbn-text-muted);
        box-shadow: 4px 0 10px rgba(0,0,0,0.1);
        cursor: pointer;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sbn-course-player.sidebar-collapsed .sbn-sidebar::after {
        opacity: 1;
    }
    
    /* Lesson nav - prevent menu items from being draggable */
    .sbn-lesson-nav {
        touch-action: pan-y;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    
    .sbn-lesson-nav .sbn-lesson-item,
    .sbn-lesson-nav .sbn-lesson-header,
    .sbn-lesson-nav .sbn-sub-item {
        touch-action: pan-y;
        user-select: none;
        -webkit-user-drag: none;
    }
    
    /* Main content - full width with left margin for sidebar */
    .sbn-main {
        position: absolute;
        left: 320px;
        top: 0;
        right: 0;
        bottom: 0;
        width: auto !important;
        height: 100% !important;
        transition: left 0.3s ease;
        /* Prevent content from shifting during swipe */
        touch-action: pan-y pinch-zoom;
        overscroll-behavior: contain;
    }
    
    .sbn-course-player.sidebar-collapsed .sbn-main {
        left: 40px;
    }
    
    /* Bottom bar - Mirrors header design: tabs bar + panels that expand over content */
    .sbn-bottom-bar {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        border-radius: 0 !important;
        z-index: 1001 !important; /* Same level as header, below sidebar when expanded */
        box-shadow: none !important; /* No shadow - clean connection to sidebar */
        border-top: 1px solid var(--sbn-border) !important;
        background: white !important;
    }
    
    /* Tabs row - clean, no shadow */
    .sbn-bottom-bar .sbn-bar-tabs {
        background: #fafafa;
        border-top: none;
    }
    
    /* Panels expand UPWARD over the content (like mega menu from header) */
    .sbn-bottom-bar .sbn-bar-panel {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 100% !important; /* Position above tabs */
        max-height: 0;
        overflow: hidden;
        background: white;
        border-top: 1px solid var(--sbn-border);
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
        transition: max-height 0.3s ease;
        z-index: 1002 !important; /* Above bottom bar tabs */
    }
    
    .sbn-bottom-bar .sbn-bar-panel.is-open {
        max-height: 400px;
        overflow-y: auto;
    }
    
    /* Lesson content - adjust padding for fixed bottom bar */
    .sbn-lesson-content {
        padding-bottom: 80px !important; /* Less padding needed now */
        touch-action: pan-y;
        overscroll-behavior: contain;
    }
}

/* iPad Portrait - Narrower sidebar */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
    .sbn-sidebar {
        width: 260px;
        min-width: 260px;
        max-width: 260px;
        bottom: 48px !important; /* Stop at bottom bar tabs */
    }
    
    .sbn-main {
        left: 260px;
    }
    
    .sbn-course-player.sidebar-collapsed .sbn-main {
        left: 40px;
    }
    
    /* Padding for bottom bar */
    .sbn-lesson-content {
        padding-bottom: 100px !important;
    }
}

/* Landscape mode - wider sidebar, optimized layout */
@media (min-width: 769px) and (max-width: 1440px) and (orientation: landscape) {
    .sbn-sidebar {
        width: 300px;
        min-width: 300px;
        max-width: 300px;
        bottom: 48px !important; /* Stop at bottom bar tabs */
    }
    
    .sbn-main {
        left: 300px;
    }
    
    .sbn-course-player.sidebar-collapsed .sbn-main {
        left: 40px;
    }
}

/* Mobile & Small Tablet Portrait - Stack layout */
@media (max-width: 768px) {
    .sbn-course-player {
        flex-direction: column;
        height: auto;
        max-height: none;
        width: 100%;
        max-width: 100%;
        position: relative;
    }

    .sbn-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--sbn-border);
        height: auto;
    }

    .sbn-lesson-nav {
        max-height: 300px;
    }

    .sbn-lesson-content {
        padding: 24px;
        padding-bottom: 140px;
    }

    /* Mobile bottom bar - fixed at bottom */
    .sbn-bottom-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        z-index: 10000;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }
}

/* ============================================================================
   PROFESSIONAL LEAD SHEET CHORD TYPOGRAPHY
   LaTeX-style rendering for chord symbols
   ============================================================================ */

/* Container for inline chord diagrams */
.sbn-inline-chord {
    display: inline-block;
    vertical-align: top;
    margin: 8px 12px 8px 0;
}

/* Chord diagram container */
.sbn-chord {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #eee;
}

/* Chord name - Professional Lead Sheet Style */
.sbn-chord-name {
    font-family: 'Crimson Text', 'Times New Roman', 'Georgia', 'Palatino', serif;
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
    line-height: 1.1;
    white-space: nowrap;
}

/* Root note - largest, boldest */
.sbn-chord-root {
    font-size: 1em;
    font-weight: 700;
}

/* Accidentals (♯ ♭) - superscript style */
.sbn-chord-accidental {
    font-size: 0.65em;
    vertical-align: super;
    margin-left: -0.05em;
    margin-right: 0.02em;
    line-height: 0;
}

/* Quality indicator (m for minor) - italic, baseline */
.sbn-chord-quality {
    font-size: 0.8em;
    font-weight: 400;
    font-style: italic;
}

/* Extensions in superscript (7, 9, maj7, etc.) */
.sbn-chord-ext {
    font-size: 0.6em;
    font-weight: 400;
    vertical-align: baseline;
    line-height: 0;
}

/* Bass note for slash chords */
.sbn-chord-bass {
    font-size: 0.85em;
    font-weight: 600;
}

/* Chord SVG diagram */
.sbn-chord-svg {
    width: 100px;
    height: auto;
    display: block;
}

/* ============================================================================
   INLINE CHORD SYMBOLS (in text)
   ============================================================================ */

.sbn-chord-symbol {
    font-family: 'Crimson Text', 'Times New Roman', 'Georgia', 'Palatino', serif;
    font-size: 1.15em;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.sbn-chord-symbol .sbn-chord-root {
    font-size: 1em;
}

.sbn-chord-symbol .sbn-chord-accidental {
    font-size: 0.7em;
}

.sbn-chord-symbol .sbn-chord-quality {
    font-size: 0.85em;
}

.sbn-chord-symbol .sbn-chord-ext {
    font-size: 0.65em;
}

/* ============================================================================
   CHORD CHART / PROGRESSION STYLING (auto-formatted <pre> blocks)
   ============================================================================ */

pre.sbn-chord-chart {
    font-family: 'Crimson Text', 'Times New Roman', 'Georgia', 'Palatino', serif;
    font-size: 18px;
    line-height: 2.2;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px 24px;
    margin: 20px 0;
    overflow-x: auto;
    white-space: pre;
    color: #666;
}

/* Individual chord in chart */
.sbn-chart-chord {
    font-weight: 600;
    color: #1a1a1a;
}

.sbn-chart-chord .sbn-chord-root {
    font-size: 1em;
    font-weight: 700;
}

.sbn-chart-chord .sbn-chord-accidental {
    font-size: 0.7em;
    vertical-align: super;
    line-height: 0;
}

.sbn-chart-chord .sbn-chord-quality {
    font-size: 0.85em;
    font-style: italic;
}

.sbn-chart-chord .sbn-chord-ext {
    font-size: 0.6em;
    vertical-align: super;
    line-height: 0;
}

/* Section labels in charts (VERSE, CHORUS, etc.) */
.sbn-chart-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #999;
}

/* ============================================================================
   CHORD PROGRESSION ROW (multiple chords inline)
   ============================================================================ */

.sbn-chord-progression {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    margin: 20px 0;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* ============================================================================
   RESPONSIVE CHORD STYLES
   ============================================================================ */

@media (max-width: 768px) {
    .sbn-chord-name {
        font-size: 18px;
    }
    
    pre.sbn-chord-chart {
        font-size: 15px;
        padding: 16px;
        line-height: 2;
    }
    
    .sbn-inline-chord {
        margin: 6px 8px 6px 0;
    }
}

@media (max-width: 480px) {
    .sbn-chord-name {
        font-size: 16px;
    }
    
    pre.sbn-chord-chart {
        font-size: 14px;
        padding: 12px;
    }
}

/* ============================================================================
   PRINT STYLES FOR CHORDS
   ============================================================================ */

@media print {
    .sbn-chord {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    pre.sbn-chord-chart {
        background: white;
        border: 1px solid #ccc;
    }
    
    .sbn-chord-name,
    .sbn-chord-symbol,
    .sbn-chart-chord {
        color: black;
    }
}

/* ============================================================================
   FIX: FULL HEIGHT SIDEBAR
   Forces the menu to stretch 100% vertically to match the player height
   ============================================================================ */

@media (min-width: 769px) {
    .sbn-sidebar {
        height: 100% !important;
        min-height: 100% !important;
        max-height: none !important;
        bottom: 0 !important; /* Ensures it hits the very bottom */
    }
}