/* ============================================================
   Verse Controller Bar
   Fixed bottom navigation bar for Quran reader page
   ============================================================
   Sits above the global audio player bar (56px, z-index 9999).
   Uses warm parchment/sepia palette to match the mushaf reading
   surface, with gold (#c9a84c) and emerald (#0d5c3a) accents.
   ============================================================
   Tokens:
     parchment-light  #f7f0e4
     parchment-mid    #ede4d4
     parchment-dark   #e5dbc9
     sepia-text       #5a4a3a
     sepia-muted      #8B7355
     gold             #c9a84c
     emerald          #0d5c3a
     blue             #2980B9
     border-warm      rgba(180, 160, 120, 0.4)
     border-subtle    rgba(180, 160, 120, 0.3)
   ============================================================ */


/* ============================================================
   1. BODY PADDING OFFSETS
   ============================================================ */

body.vc-active {
    padding-bottom: 52px;
}

body.vc-active.player-active {
    padding-bottom: 108px; /* 52 + 56 */
}


/* ============================================================
   2. FIXED BOTTOM BAR
   ============================================================ */

.verse-controller-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 52px;
    z-index: 9998;
    background: linear-gradient(135deg, #f7f0e4 0%, #ede4d4 60%, #e5dbc9 100%);
    border-top: 1px solid rgba(180, 160, 120, 0.4);
    box-shadow: 0 -2px 12px rgba(90, 74, 58, 0.10),
                0 -1px 3px rgba(90, 74, 58, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    /* Slide-in animation: hidden by default */
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, bottom;
}

/* Reveal state */
.verse-controller-bar.visible {
    transform: translateY(0);
}

/* Inner content wrapper — flex row matching parent */
.vc-bar-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 100%;
}

/* Shift up when audio player bar is active */
body.player-active .verse-controller-bar {
    bottom: 56px;
}


/* ============================================================
   3. VERSE REFERENCE DISPLAY
   ============================================================ */

.vc-ref-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 30px;
    padding: 0 12px;
    border: 1.5px solid #c9a84c;
    border-radius: 15px;
    background: rgba(201, 168, 76, 0.08);
    color: #5a4a3a;
    font-family: "Amiri", "Georgia", "Times New Roman", serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
}


/* ============================================================
   4. NAVIGATION BUTTONS (prev / next)
   ============================================================ */

.vc-nav-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.vc-nav-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(180, 160, 120, 0.3);
    background: transparent;
    color: #8B7355;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.72rem;
    padding: 0;
    line-height: 1;
    outline: none;
    transition: border-color 0.2s ease,
                color 0.2s ease,
                background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.vc-nav-btn:hover {
    border-color: #c9a84c;
    background: rgba(201, 168, 76, 0.08);
    color: #5a4a3a;
}

.vc-nav-btn:active {
    transform: scale(0.92);
}

.vc-nav-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.4);
}

.vc-nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}


/* ============================================================
   5. VERSE PILL (sura dropdown : aya dropdown)
   ============================================================ */

.vc-verse-pill {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(201, 168, 76, 0.08);
    border: 1.5px solid rgba(201, 168, 76, 0.35);
    border-radius: 16px;
    padding: 0 4px;
    height: 30px;
    flex-shrink: 0;
}

.vc-sura-dd-wrap {
    max-width: 180px;
    min-width: 90px;
    flex: 4;
    overflow: hidden;
}

.vc-colon {
    color: #8B7355;
    font-size: 0.8rem;
    font-weight: 700;
    user-select: none;
    flex-shrink: 0;
    line-height: 1;
}

.vc-aya-dd-wrap {
    flex: 0 0 52px;
    max-width: 52px;
}

.vc-sura-label {
    color: #8B7355;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    user-select: none;
    flex-shrink: 1;
}

/* No-audio placeholder */
.vc-no-audio {
    color: #8B7355;
    font-size: 0.72rem;
    opacity: 0.6;
}

/* Action divider (vertical line within actions) */
.vc-action-divider {
    width: 1px;
    height: 18px;
    background: rgba(180, 160, 120, 0.3);
    flex-shrink: 0;
    margin: 0 2px;
}


/* ============================================================
   6. ACTION BUTTONS (bookmark, random, explorer link)
   ============================================================ */

.vc-actions-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.vc-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(180, 160, 120, 0.3);
    background: transparent;
    color: #8B7355;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0;
    line-height: 1;
    outline: none;
    transition: border-color 0.2s ease,
                color 0.2s ease,
                background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.vc-action-btn:hover {
    border-color: #c9a84c;
    background: rgba(201, 168, 76, 0.08);
    color: #5a4a3a;
}

.vc-action-btn:active {
    transform: scale(0.92);
}

.vc-action-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.4);
}

/* Active bookmark: filled gold */
.vc-action-btn.vc-bookmarked {
    color: #c9a84c;
    border-color: #c9a84c;
    background: rgba(201, 168, 76, 0.12);
}

.vc-action-btn.vc-bookmarked:hover {
    background: rgba(201, 168, 76, 0.18);
}

/* Explorer link: subtle emerald tint */
.vc-action-btn.vc-explorer-link:hover {
    border-color: #0d5c3a;
    color: #0d5c3a;
    background: rgba(13, 92, 58, 0.06);
}


/* ============================================================
   7. VERTICAL DIVIDER
   ============================================================ */

.vc-divider {
    width: 1px;
    height: 24px;
    background: rgba(180, 160, 120, 0.35);
    flex-shrink: 0;
    border: none;
    margin: 0 2px;
}


/* ============================================================
   8. AUDIO BUTTONS (character audio + translation audio)
   ============================================================ */

.vc-audio-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.vc-audio-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 10px;
    border-radius: 13px;
    border: 1px solid;
    background: transparent;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    outline: none;
    line-height: 1;
    transition: background-color 0.2s ease,
                border-color 0.2s ease,
                color 0.2s ease,
                box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.vc-audio-btn:active {
    transform: scale(0.96);
}

.vc-audio-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.35);
}

.vc-audio-btn .fa,
.vc-audio-btn .fas,
.vc-audio-btn .far {
    font-size: 0.65rem;
}

/* Character audio: emerald palette */
.vc-audio-btn.vc-char-audio {
    border-color: #0d5c3a;
    color: #0d5c3a;
}

.vc-audio-btn.vc-char-audio:hover {
    background: rgba(13, 92, 58, 0.08);
    border-color: #0b7a4a;
}

.vc-audio-btn.vc-char-audio.active {
    background: #0d5c3a;
    color: #fff;
    border-color: #0d5c3a;
    box-shadow: 0 1px 6px rgba(13, 92, 58, 0.25);
}

/* Translation audio: blue palette */
.vc-audio-btn.vc-trans-audio {
    border-color: #2980B9;
    color: #2980B9;
}

.vc-audio-btn.vc-trans-audio:hover {
    background: rgba(41, 128, 185, 0.08);
    border-color: #3498DB;
}

.vc-audio-btn.vc-trans-audio.active {
    background: #2980B9;
    color: #fff;
    border-color: #2980B9;
    box-shadow: 0 1px 6px rgba(41, 128, 185, 0.25);
}

/* Disabled state for both audio buttons */
.vc-audio-btn:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}


/* ============================================================
   9. AUTOPLAY GROUP (icon + toggle switch)
   ============================================================ */

.vc-autoplay-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.vc-autoplay-icon {
    color: #8B7355;
    font-size: 0.78rem;
    flex-shrink: 0;
    line-height: 1;
}

.vc-autoplay-label {
    color: #8B7355;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    user-select: none;
    flex-shrink: 0;
}

/* Toggle switch track */
.vc-toggle {
    position: relative;
    width: 34px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.vc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.vc-toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 9px;
    background: rgba(180, 160, 120, 0.3);
    transition: background-color 0.25s ease;
}

.vc-toggle input:checked + .vc-toggle-track {
    background: #c9a84c;
}

.vc-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.vc-toggle input:checked ~ .vc-toggle-thumb {
    transform: translateX(16px);
}

.vc-toggle:focus-within .vc-toggle-track {
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.35);
}


/* Dash dbc.Switch override inside verse controller bar */
.verse-controller-bar .vc-autoplay-switch {
    margin-bottom: 0;
}

.verse-controller-bar .vc-autoplay-switch .form-check-input {
    width: 32px;
    height: 16px;
    cursor: pointer;
    border-color: rgba(180, 160, 120, 0.4);
    background-color: rgba(180, 160, 120, 0.2);
}

.verse-controller-bar .vc-autoplay-switch .form-check-input:checked {
    background-color: #c9a84c;
    border-color: #c9a84c;
}

.verse-controller-bar .vc-autoplay-switch .form-check-label {
    font-size: 0.7rem;
    color: #8B7355;
    font-weight: 500;
    line-height: 1;
    padding-top: 2px;
    user-select: none;
}


/* ============================================================
   10. LANGUAGE / TRANSLATOR DROPDOWNS
   ============================================================ */

.vc-lang-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
}


/* ============================================================
   11. DROPDOWN OVERRIDES (Dash dropdowns inside the bar)
   ============================================================ */

.verse-controller-bar .dash-dropdown {
    min-width: 0;
}

.verse-controller-bar .dash-dropdown .Select-control {
    height: 28px;
    min-height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 0.2s ease;
}

.verse-controller-bar .dash-dropdown .Select-control:hover {
    background: rgba(180, 160, 120, 0.12);
}

.verse-controller-bar .dash-dropdown .Select-placeholder,
.verse-controller-bar .dash-dropdown .Select-value-label,
.verse-controller-bar .dash-dropdown .Select-value {
    font-size: 0.75rem;
    color: #5a4a3a;
    line-height: 28px;
    padding: 0 6px;
}

.verse-controller-bar .dash-dropdown .Select-input {
    height: 28px;
}

.verse-controller-bar .dash-dropdown .Select-input > input {
    font-size: 0.75rem;
    color: #5a4a3a;
    padding: 0;
    line-height: 28px;
}

.verse-controller-bar .dash-dropdown .Select-arrow-zone {
    width: 20px;
    padding: 0;
}

.verse-controller-bar .dash-dropdown .Select-arrow {
    border-color: #8B7355 transparent transparent;
}

.verse-controller-bar .dash-dropdown .Select-clear-zone {
    display: none;
}

/* Dropdown menu panel (open state) */
.verse-controller-bar .dash-dropdown .Select-menu-outer {
    border: 1px solid rgba(180, 160, 120, 0.35);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(90, 74, 58, 0.15);
    background: #fdf8f0;
    margin-top: 4px;
    overflow: hidden;
    z-index: 10000;
}

.verse-controller-bar .dash-dropdown .Select-option {
    font-size: 0.75rem;
    color: #5a4a3a;
    padding: 6px 10px;
    background: transparent;
}

.verse-controller-bar .dash-dropdown .Select-option.is-focused {
    background: rgba(201, 168, 76, 0.12);
    color: #5a4a3a;
}

.verse-controller-bar .dash-dropdown .Select-option.is-selected {
    background: rgba(201, 168, 76, 0.2);
    color: #5a4a3a;
    font-weight: 600;
}

.verse-controller-bar .dash-dropdown .Select-noresults {
    font-size: 0.72rem;
    color: #8B7355;
    padding: 8px 10px;
}

/* Focused ring for dropdown */
.verse-controller-bar .dash-dropdown.is-focused .Select-control {
    background: rgba(180, 160, 120, 0.1);
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.3);
}


/* ============================================================
   12. RESPONSIVE -- BELOW 992px
   Hide language/translator dropdowns and verse-explorer link.
   ============================================================ */

@media (max-width: 992px) {
    .vc-lang-group {
        display: none;
    }

    .vc-action-btn.vc-explorer-link {
        display: none;
    }

    .verse-controller-bar {
        gap: 10px;
    }
}


/* ============================================================
   13. RESPONSIVE -- BELOW 768px
   Hide audio button labels (icons only), hide autoplay label,
   tighten gaps.
   ============================================================ */

@media (max-width: 768px) {
    .verse-controller-bar {
        padding: 0 10px;
        gap: 8px;
    }

    /* Audio buttons: icon-only mode */
    .vc-audio-btn .vc-btn-label {
        display: none;
    }

    .vc-audio-btn {
        padding: 0 7px;
        min-width: 26px;
        justify-content: center;
    }

    /* Hide autoplay text label, keep icon and switch */
    .vc-autoplay-label {
        display: none;
    }

    /* Tighter selector */
    .vc-sura-dd-wrap {
        max-width: 140px;
        min-width: 80px;
    }

    /* Slightly smaller ref pill */
    .vc-ref-pill {
        font-size: 0.78rem;
        padding: 0 10px;
        height: 28px;
        min-width: 56px;
    }

    /* Slightly smaller nav buttons */
    .vc-nav-btn {
        width: 28px;
        height: 28px;
        font-size: 0.68rem;
    }
}


/* ============================================================
   14. RESPONSIVE -- BELOW 576px
   Minimal layout: nav + verse ref + audio icons only.
   Hide random btn, dividers, autoplay group, selector group,
   actions group.
   ============================================================ */

@media (max-width: 576px) {
    .verse-controller-bar {
        padding: 0 8px;
        gap: 6px;
        height: 48px;
    }

    /* Body offset adjusts to shorter bar */
    body.vc-active {
        padding-bottom: 48px;
    }

    body.vc-active.player-active {
        padding-bottom: 104px; /* 48 + 56 */
    }

    /* Hide non-essential groups */
    .vc-verse-pill {
        display: none;
    }

    .vc-actions-group .vc-action-btn.vc-random-btn {
        display: none;
    }

    .vc-divider {
        display: none;
    }

    .vc-autoplay-group {
        display: none;
    }

    /* Keep only bookmark in actions (if present) */
    .vc-actions-group {
        gap: 4px;
    }

    /* Compact ref pill */
    .vc-ref-pill {
        font-size: 0.75rem;
        padding: 0 8px;
        height: 26px;
        min-width: 50px;
        border-width: 1px;
    }

    /* Compact nav */
    .vc-nav-btn {
        width: 26px;
        height: 26px;
        font-size: 0.65rem;
    }

    /* Compact audio buttons */
    .vc-audio-btn {
        height: 24px;
        padding: 0 6px;
        font-size: 0.65rem;
    }

    .vc-audio-btn .fa,
    .vc-audio-btn .fas,
    .vc-audio-btn .far {
        font-size: 0.6rem;
    }
}


/* ============================================================
   15. PRINT: HIDE THE BAR ENTIRELY
   ============================================================ */

@media print {
    .verse-controller-bar {
        display: none !important;
    }

    body.vc-active {
        padding-bottom: 0 !important;
    }
}
