@layer legacy.base, legacy.explorer, legacy.document_viewer;
@import url("explorer.css") layer(legacy.explorer);
@import url("document_viewer.css?v=11") layer(legacy.document_viewer);

@layer legacy.base {
:root {
    --bg-dark: #0b1018;
    --card-bg: #111a27;
    --panel-bg: #151f2e;
    --border-color: #202c3c;
    --text-primary: #e7edf5;
    --text-secondary: #a0aec0;
    --text-muted: #738197;
    --accent-blue: #6da9ff;
    --btn-primary: #438af2;
    --btn-primary-hover: #5a99f7;
    --btn-secondary: #1a2636;
    --btn-secondary-hover: #243348;
    --btn-success: #328565;
    --btn-success-hover: #3a9873;
    --btn-warning: #a87832;
    --btn-warning-hover: #bd8a40;
    --btn-danger: #b84d55;
    --btn-danger-hover: #cc5b63;
}

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100vw;
    overflow-x: hidden;
    /* overflow-x: hidden turns html/body into scroll containers,
       which silently breaks position: sticky (the mobile top bar).
       clip prevents horizontal overflow the same way without
       creating a scroll container; unsupported browsers keep the
       hidden fallback above. */
    overflow-x: clip;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Button UI Components */
button,
.btn {
    background: var(--btn-primary);
    color: #ffffff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    display: inline-block;
    transition: background 0.2s ease, transform 0.1s ease;
}

button:hover,
.btn:hover {
    background: var(--btn-primary-hover);
}

button:active,
.btn:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--btn-secondary);
}

.btn-secondary:hover {
    background: var(--btn-secondary-hover);
}

.btn-success {
    background: var(--btn-success);
}

.btn-success:hover {
    background: var(--btn-success-hover);
}

.btn-warning {
    background: var(--btn-warning);
}

.btn-warning:hover {
    background: var(--btn-warning-hover);
}

.btn-danger {
    background: var(--btn-danger);
}

.btn-danger:hover {
    background: var(--btn-danger-hover);
}

.back-btn {
    background: var(--panel-bg);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-block;
    text-align: center;
    font-weight: 600;
    transition: background 0.2s ease;
}

.back-btn:hover {
    background: var(--border-color);
}

/* Layout & Sidebar Navigation */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 260px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.25s ease-in-out;
}

.sidebar-header {
    padding: 20px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header img {
    width: 32px;
    height: 32px;
}

.sidebar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.sidebar-menu {
    list-style: none;
    padding: 16px 12px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.now-playing-panel {
    margin: 0 12px 18px;
    padding: 13px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--panel-bg);
}

.now-playing-panel h3 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 10px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.autopull-nav-button {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.autopull-nav-button:hover:not(:disabled) {
    background: #151f2e;
}

.autopull-nav-button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.autopull-status {
    display: block;
    padding: 0 12px 4px 44px;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.35;
}

.autopull-status[data-state="success"],
.autopull-status[data-state="current"] {
    color: #86efac;
}

.autopull-status[data-state="skipped"],
.autopull-status[data-state="error"] {
    color: #fca5a5;
}

.shabad-update-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.shabad-update-action [data-autopull-status] {
    max-width: 210px;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.3;
    text-align: center;
}

.shabad-update-action [data-autopull-status][data-state="success"],
.shabad-update-action [data-autopull-status][data-state="current"] {
    color: #86efac;
}

.shabad-update-action [data-autopull-status][data-state="skipped"],
.shabad-update-action [data-autopull-status][data-state="error"] {
    color: #fca5a5;
}

.other-listeners-empty,
.other-listener-track {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
}

.other-listener-track:not(:disabled):hover strong,
.other-listener-track:not(:disabled):focus-visible strong {
    color: var(--accent-blue);
}

.other-listener-track:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 3px;
}

.other-listener-track:disabled {
    cursor: default;
}

.other-listener-track + .other-listener-track {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid var(--border-color);
}

.other-listener-track strong,
.other-listener-track span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.other-listener-track strong {
    color: var(--text-primary);
    font-weight: 550;
}

.other-listener-track .other-listener-device {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--panel-bg);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--btn-primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.nav-link .icon {
    font-size: 1.2rem;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sidebar-version {
    padding: 0 12px 10px;
    color: var(--text-muted);
    font-size: 0.65rem;
    opacity: 0.55;
    text-align: center;
}

.sidebar-version-header {
    margin-top: 3px;
    padding: 0;
    text-align: left;
    font-size: 0.72rem;
    opacity: 0.7;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 20px;
    min-width: 0;
    transition: margin-left 0.25s ease-in-out;
}

.container {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    max-width: 950px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.mobile-topbar {
    display: none;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 900;
    align-items: center;
    justify-content: space-between;
}

.hamburger-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
}

.hamburger-btn:hover {
    background: var(--panel-bg);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 995;
    opacity: 0;
    transition: opacity 0.25s ease;
}

@media (max-width: 899px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 25px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop.active {
        display: block;
        opacity: 1;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .mobile-topbar {
        display: flex;
    }
}

/* Floating Mini Player (SoundCloud-Style) */
.mini-player-bar {
    position: fixed;
    bottom: 3%;
    left: calc(260px + 3%);
    right: 3%;
    height: 72px;
    background: rgba(30, 41, 59, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), 0 0 20px rgba(14, 165, 233, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1050;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, left 0.25s ease-in-out;
}

.mini-player-bar.hidden {
    transform: translateY(180%);
    opacity: 0;
    pointer-events: none;
}

.mini-player-progress-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: height 0.15s ease;
}

.mini-player-progress-container:hover {
    height: 7px;
}

.mini-player-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
    width: 0%;
    border-radius: 0 2px 2px 0;
    transition: width 0.1s linear;
}

.mini-player-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
    cursor: pointer;
}

.mini-player-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.mini-player-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.mini-player-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 2px 0 0 0;
}

.mini-player-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: 16px;
}

.mini-ctrl-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    transition: background 0.15s ease, transform 0.1s ease;
}

.mini-ctrl-btn:hover {
    background: var(--panel-bg);
    transform: scale(1.08);
}

.mini-ctrl-btn.play-btn {
    background: var(--btn-primary);
    color: #ffffff;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.mini-ctrl-btn.play-btn:hover {
    background: var(--btn-primary-hover);
}

.mini-time-display {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    margin-right: 8px;
}

body.has-mini-player .main-content {
    padding-bottom: 120px !important;
}

@media (max-width: 899px) {
    .mini-player-bar {
        left: 3%;
        right: 3%;
        bottom: 3%;
        height: 66px;
        padding: 0 14px;
    }

    .mini-player-title {
        font-size: 0.88rem;
    }

    .mini-player-subtitle {
        font-size: 0.75rem;
    }

    .mini-time-display {
        display: none;
    }

    .mini-ctrl-btn {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
        padding: 6px;
    }

    body.has-mini-player .main-content {
        padding-bottom: 125px !important;
    }
}

/* Full Player Modal Overlay */
.full-player-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.full-player-modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.full-player-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.full-player-content {
    position: relative;
    z-index: 2001;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    background: var(--card-bg);
    border-radius: 24px 24px 0 0;
    border: 1px solid var(--border-color);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
    overflow-y: auto;
    padding: 24px 20px 32px 20px;
    transform: translateY(0);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.full-player-modal.hidden .full-player-content {
    transform: translateY(100%);
}

.full-player-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 16px;
}

.full-player-header > span {
    grid-column: 2;
    grid-row: 1;
    text-align: center;
}

.full-player-close-btn {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
}

.full-player-header-actions {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-self: end;
}

.full-player-header-action {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--panel-bg);
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.full-player-header-action:hover {
    background: var(--border-color);
}

.full-player-close-btn {
    background: var(--panel-bg);
    color: var(--text-primary);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.full-player-close-btn:hover {
    background: var(--border-color);
}

.full-player-card {
    text-align: center;
}

.full-player-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.full-player-card p {
    margin: 2px 0;
}

.full-player-scrubber-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.full-player-scrubber-container input[type="range"] {
    flex: 1;
    accent-color: var(--btn-primary);
    cursor: pointer;
    height: 6px;
}

.full-player-secondary-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 12px 0 4px 0;
}

.full-player-secondary-controls .ctrl-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.full-player-secondary-controls .ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05);
}

.full-player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0 20px 0;
}

.full-player-controls .ctrl-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.full-player-controls .ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05);
}

.full-player-controls .play-main-btn {
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
    border-radius: 50%;
    background: var(--btn-primary);
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    border: none;
    cursor: pointer;
}

.full-player-controls .play-main-btn:hover {
    background: var(--btn-primary-hover);
}

.mini-speed-select {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.mini-speed-select:hover, .mini-speed-select:focus {
    background: rgba(255, 255, 255, 0.16);
    border-color: var(--accent-blue);
}

.mini-speed-select option {
    background: #1e293b;
    color: #ffffff;
}

.modal-sleep-container, .modal-options-row {
    margin: 14px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.modal-option-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-sleep-container select, .modal-option-item select {
    background: var(--panel-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
}

.modal-sleep-container select:hover, .modal-sleep-container select:focus,
.modal-option-item select:hover, .modal-option-item select:focus {
    border-color: var(--accent-blue);
}

.modal-sleep-container select option, .modal-option-item select option {
    background: #1e293b;
    color: #ffffff;
}

.modal-playlist-card {
    background: var(--panel-bg);
    border-radius: 12px;
    padding: 12px;
    margin-top: 16px;
    text-align: left;
    max-height: 220px;
    overflow-y: auto;
}

.modal-playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.modal-playlist-item {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s ease;
}

.modal-playlist-item[draggable="true"] {
    cursor: grab;
}

.modal-playlist-item.dragging {
    opacity: 0.45;
}

.modal-playlist-drag-handle {
    flex: 0 0 auto;
    color: var(--text-muted);
    cursor: grab;
    font-size: 1.1rem;
    line-height: 1;
}

.modal-playlist-details {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.modal-playlist-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-playlist-artist {
    flex: 0 0 auto;
    max-width: 35%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    opacity: 0.75;
    font-weight: 400;
}

.modal-playlist-remove {
    flex: 0 0 auto;
    padding: 2px 6px;
    border: 0;
    background: none;
    color: #ef4444;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.85rem;
}

.modal-playlist-empty {
    padding: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.modal-playlist-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.modal-playlist-item.active {
    background: var(--card-bg);
    color: var(--accent-blue);
    font-weight: 600;
}

/* Shabad Pop-Up Modal */
.shabad-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.shabad-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.shabad-modal-card {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(251, 191, 36, 0.1);
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.shabad-modal-backdrop.active .shabad-modal-card {
    transform: scale(1) translateY(0);
}

.shabad-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.shabad-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.shabad-header-icon {
    font-size: 1.5rem;
    color: #fbbf24;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.shabad-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.shabad-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.shabad-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

.shabad-modal-body {
    padding: 24px 20px;
    overflow-y: auto;
    flex: 1;
    line-height: 1.8;
}

.shabad-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.shabad-line-gurmukhi {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fef08a;
    line-height: 1.6;
    letter-spacing: 0.3px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.shabad-line-english {
    font-size: 0.95rem;
    color: #cbd5e1;
    font-style: italic;
    margin-bottom: 8px;
    opacity: 0.9;
}

.shabad-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 30px;
    color: var(--text-muted);
}

.shabad-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(251, 191, 36, 0.2);
    border-top-color: #fbbf24;
    border-radius: 50%;
    animation: shabad-spin 0.8s linear infinite;
}

@keyframes shabad-spin {
    to {
        transform: rotate(360deg);
    }
}

.shabad-error {
    text-align: center;
    color: var(--btn-danger);
    font-weight: 500;
}

.shabad-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}


/* Title Containers for Marquee */
.mini-player-title-container,
.player-modal-title-container {
    overflow: hidden;
    width: 100%;
    white-space: nowrap;
    position: relative;
}

.player-modal-title-container {
    max-width: 380px;
    margin: 0 auto 6px auto;
}

.mini-player-title,
.full-player-card h2 {
    white-space: nowrap;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.mini-player-title.is-marquee,
.full-player-card h2.is-marquee {
    display: inline-block !important;
    overflow: visible !important;
    text-overflow: clip !important;
    animation: marquee-alternate 15s linear infinite alternate !important;
}

@keyframes marquee-alternate {

    0%,
    15% {
        transform: translateX(0);
    }

    85%,
    100% {
        transform: translateX(var(--scroll-dist, 0px));
    }
}

/* Global Folder Navigation Loading Symbol & Bar */
#globalPageProgressBar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #0ea5e9, #38bdf8, #818cf8);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
    z-index: 99999;
    transition: width 0.2s ease, opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

#globalPageProgressBar.active {
    opacity: 1;
    animation: bar-loading-pulse 2s ease-in-out infinite;
}

@keyframes bar-loading-pulse {
    0% {
        width: 15%;
    }

    50% {
        width: 70%;
    }

    100% {
        width: 92%;
    }
}

#folderLoadingToast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(14, 165, 233, 0.2);
    border-radius: 30px;
    padding: 10px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 99998;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}

#folderLoadingToast.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.global-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(56, 189, 248, 0.25);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: global-spin 0.6s linear infinite;
}

@keyframes global-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Refined dark interface */
body {
    background: var(--bg-dark);
    color: var(--text-primary);
}

button,
.btn {
    border-radius: 7px;
    font-weight: 550;
    box-shadow: none;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.btn-secondary,
.back-btn {
    background: var(--panel-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover,
.back-btn:hover {
    background: #1b2939;
    color: var(--text-primary);
}

.btn-primary {
    background: var(--btn-primary);
    color: #fff;
}

.btn-success {
    background: var(--btn-success);
    color: #fff;
}

.btn-warning {
    background: var(--btn-warning);
    color: #fff;
}

.btn-danger {
    background: var(--btn-danger);
    color: #fff;
}

.sidebar {
    width: 244px;
    background: #0e1520;
    border-right-color: var(--border-color);
}

.sidebar-header {
    padding: 22px 18px;
    border-bottom-color: var(--border-color);
}

.sidebar-title {
    font-size: 0.96rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.sidebar-menu {
    gap: 3px;
    padding: 14px 12px;
}

.nav-link {
    gap: 11px;
    padding: 10px 12px;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.nav-link:hover {
    background: #151f2e;
}

.nav-link.active {
    background: rgba(76, 143, 245, 0.13);
    color: #a9ceff;
    box-shadow: none;
}

.main-content {
    margin-left: 244px;
    padding: 28px;
}

.container,
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: none;
}

.container {
    max-width: 1110px;
    padding: 24px;
}

.card {
    padding: 22px;
}

h1,
h2,
.modal-header h3 {
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.mobile-topbar {
    background: #0e1520;
    border-bottom-color: var(--border-color);
}

.mini-player-bar {
    left: calc(244px + 3%);
    right: 3%;
    bottom: 18px;
    min-height: 68px;
    height: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(14, 21, 32, 0.97);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
}

.mini-player-progress-container {
    height: 3px;
    background: #263346;
}

.mini-player-progress-fill {
    background: var(--accent-blue);
}

.mini-ctrl-btn:hover {
    background: var(--panel-bg);
}

.mini-ctrl-btn.play-btn {
    background: var(--btn-primary);
    box-shadow: none;
}

.full-player-backdrop {
    background: rgba(5, 9, 15, 0.78);
}

.full-player-content {
    max-width: 560px;
    max-height: 92vh;
    padding: 22px 22px 26px;
    border-color: var(--border-color);
    border-radius: 14px 14px 0 0;
    background: var(--card-bg);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.48);
}

.full-player-header {
    margin-bottom: 20px;
}

.full-player-header-action,
.full-player-close-btn {
    border: 1px solid var(--border-color);
    background: var(--panel-bg);
    color: var(--text-secondary);
}

.full-player-header-action:hover,
.full-player-close-btn:hover {
    background: #1b2939;
    color: var(--text-primary);
}

.full-player-card h2 {
    font-size: 1.35rem;
    font-weight: 600;
}

.full-player-scrubber-container input[type="range"] {
    accent-color: var(--accent-blue);
}

.full-player-secondary-controls .ctrl-btn,
.full-player-controls .ctrl-btn {
    border-color: var(--border-color);
    border-radius: 7px;
    background: var(--panel-bg);
    color: var(--text-secondary);
}

.full-player-secondary-controls .ctrl-btn:hover,
.full-player-controls .ctrl-btn:hover {
    background: #1d2a3b;
    color: var(--text-primary);
    transform: none;
}

.full-player-controls .play-main-btn {
    background: var(--btn-primary);
    box-shadow: none;
}

.mini-speed-select,
.modal-sleep-container select,
.modal-option-item select {
    border-color: var(--border-color);
    border-radius: 6px;
    background: var(--panel-bg);
}

.modal-playlist-card {
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #0e1520;
}

.modal-playlist-item:hover {
    background: #172333;
}

.modal-playlist-item.active {
    background: rgba(76, 143, 245, 0.12);
    color: #a9ceff;
}

.shabad-modal-backdrop {
    background: rgba(5, 9, 15, 0.82);
}

.shabad-modal-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.48);
}

.shabad-modal-header {
    border-bottom-color: var(--border-color);
}

.shabad-header-icon,
.shabad-spinner {
    color: var(--accent-blue);
    border-top-color: var(--accent-blue);
    text-shadow: none;
}

.shabad-line-gurmukhi {
    color: #dbe8fb;
    text-shadow: none;
}

.shabad-modal-footer {
    border-top-color: var(--border-color);
    background: #0e1520;
}

#globalPageProgressBar {
    background: linear-gradient(90deg, #438af2, #8cbcff);
    box-shadow: 0 0 10px rgba(109, 169, 255, 0.45);
}

#folderLoadingToast {
    border-color: var(--border-color);
    border-radius: 9px;
    background: rgba(17, 26, 39, 0.97);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.global-spinner {
    border-color: rgba(109, 169, 255, 0.2);
}

@media (max-width: 899px) {
    .main-content {
        margin-left: 0;
    }

    .mini-player-bar {
        left: 3%;
        right: 3%;
        bottom: 14px;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 16px;
    }

    .container,
    .card {
        padding: 17px;
        border-radius: 9px;
    }

    .mini-player-bar {
        bottom: 10px;
        padding: 0 11px;
        border-radius: 9px;
    }

    .full-player-content {
        padding: 18px 16px 22px;
        border-radius: 12px 12px 0 0;
    }

}
}

:root {
    --bg-dark: #0b1018;
    --card-bg: #111a27;
    --panel-bg: #151f2e;
    --border-color: #202c3c;
    --text-primary: #e7edf5;
    --text-secondary: #a0aec0;
    --text-muted: #738197;
    --accent-blue: #6da9ff;
    --btn-primary: #438af2;
    --btn-primary-hover: #5a99f7;
    --btn-secondary: #1a2636;
    --btn-secondary-hover: #243348;
    --btn-success: #328565;
    --btn-success-hover: #3a9873;
    --btn-warning: #a87832;
    --btn-warning-hover: #bd8a40;
    --btn-danger: #b84d55;
    --btn-danger-hover: #cc5b63;
}

body {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.ui-icon-library {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.ui-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.16em;
}

.ui-icon-spinner {
    animation: ui-icon-spin 1s linear infinite;
}

@keyframes ui-icon-spin {
    to {
        transform: rotate(360deg);
    }
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
    display: block;
    width: 18px;
    height: 1.5px;
    background: currentColor;
    border-radius: 2px;
}

.menu-icon {
    position: relative;
}

.menu-icon::before,
.menu-icon::after {
    position: absolute;
    left: 0;
    content: "";
}

.menu-icon::before {
    top: -6px;
}

.menu-icon::after {
    top: 6px;
}

button,
.btn {
    border-radius: 7px;
    font-weight: 550;
    box-shadow: none;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.btn-secondary,
.back-btn {
    border: 1px solid var(--border-color);
    background: var(--panel-bg);
    color: var(--text-secondary);
}

.btn-secondary:hover,
.back-btn:hover {
    background: #1b2939;
    color: var(--text-primary);
}

/* Favorited heart: red on every page. This rule must stay UNLAYERED:
   inside @layer legacy.base it lost to the unlayered .btn-secondary
   color above (unlayered styles beat layered ones at any
   specificity), which is why explorer hearts never turned red while
   the favorites page -- favorites.css is unlayered too -- was fine. */
.favorite-toggle.is-favorite {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.45);
}

.btn-success {
    background: var(--btn-success);
    color: #fff;
}

.btn-warning {
    background: var(--btn-warning);
    color: #fff;
}

.btn-danger {
    background: var(--btn-danger);
    color: #fff;
}

.sidebar {
    width: 244px;
    background: #0e1520;
    border-right-color: var(--border-color);
}

.sidebar-header {
    padding: 22px 18px;
    border-bottom-color: var(--border-color);
}

.sidebar-title {
    font-size: 0.96rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.sidebar-menu {
    gap: 3px;
    padding: 14px 12px;
}

.nav-link {
    gap: 11px;
    padding: 10px 12px;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.nav-link:hover {
    background: #151f2e;
}

.nav-link.active {
    background: rgba(76, 143, 245, 0.13);
    color: #a9ceff;
    box-shadow: none;
}

.main-content {
    margin-left: 244px;
    padding: 28px 34px 36px;
}

.container {
    width: min(100%, 1110px);
    max-width: 1110px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.mobile-topbar {
    background: #0e1520;
    border-bottom-color: var(--border-color);
}

h1,
h2,
.modal-header h3 {
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.breadcrumb {
    min-height: 44px;
    align-items: center;
    margin-bottom: 16px;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #111a27;
}

.breadcrumb code {
    padding: 3px 7px;
    border: 1px solid #2a3a50;
    border-radius: 5px;
    background: #0b1018;
    color: #b7c5d7;
}

.storage-badge {
    border-color: #2a3a50 !important;
    border-radius: 6px !important;
    background: #151f2e !important;
}

.sticky-controls-container {
    margin-bottom: 12px;
    padding: 9px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #101824;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.controls-panel,
.actions-bar {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #151f2e;
}

.controls-panel {
    padding: 11px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* One tidy row: select-all checkbox, sort dropdown, order toggle —
   all the same height, edges aligned with the search box below. */
.controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls-row .form-control {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    padding: 8px 10px;
    font-size: 0.95rem;
    cursor: pointer;
}

.controls-row .btn {
    flex: 0 0 auto;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-wrap {
    position: relative;
    width: 100%;
}

.search-wrap .search-input {
    width: 100%;
}

/* Select all is a custom checkbox icon, not the browser's checkbox:
   the real input stays (invisible) so toggling works as before. */
.select-all-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 6px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.select-all-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.select-all-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 2px solid #3b4c63;
    border-radius: 6px;
    background: transparent;
    color: #fff;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.select-all-box .ui-icon {
    width: 14px;
    height: 14px;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.select-all-toggle:hover .select-all-box {
    border-color: var(--accent-blue);
}

.select-all-input:checked + .select-all-box,
.select-all-input:indeterminate + .select-all-box {
    background: var(--btn-primary);
    border-color: var(--btn-primary);
}

.select-all-input:checked + .select-all-box .ui-icon {
    opacity: 1;
    transform: scale(1);
}

.select-all-input:indeterminate + .select-all-box::after {
    content: '';
    width: 10px;
    height: 2.5px;
    border-radius: 2px;
    background: #fff;
}

.select-all-input:focus-visible + .select-all-box {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.actions-bar {
    margin-top: 9px;
    padding: 10px 11px;
    background: #111a27;
}

.search-input,
.form-group input,
textarea,
input[type="text"],
select.form-control {
    border: 1px solid #2a3a50;
    border-radius: 7px;
    background: #0b1018;
    color: var(--text-primary);
}

/* Textareas had no width or height anywhere, so they rendered at the
   browser default (about 20 columns x 2 rows) -- the tiny box on the
   Add Shabads page and the link box on Add Download. */
/* Start/End time boxes on Add Download are bare text inputs with no
   class and no width rule anywhere, so they rendered at the browser
   default like the textareas did. Scoped to that form so the search
   box and other inputs keep their own sizing. */
#urlForm input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #2a3a50;
    border-radius: 7px;
    background: #0b1018;
    color: var(--text-primary);
    font-size: 0.95rem;
    box-sizing: border-box;
}

#urlForm input[type="text"]:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(109, 169, 255, 0.12);
    outline: none;
}

textarea {
    width: 100%;
    min-height: 140px;
    padding: 10px 12px;
    box-sizing: border-box;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
}

.search-input {
    min-height: 40px;
}

.search-input:focus,
.form-group input:focus,
textarea:focus,
input[type="text"]:focus,
select.form-control:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(109, 169, 255, 0.12);
}

ul#itemList,
ul#searchResultsList {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #111a27;
}

li.item-row {
    min-height: 58px;
    margin: 0;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid rgba(32, 44, 60, 0.9);
    border-radius: 0;
    background: transparent;
    transition: background-color 0.15s ease;
}

li.item-row:last-child {
    border-bottom: 0;
}

li.item-row:hover {
    border-color: transparent;
    border-bottom-color: rgba(32, 44, 60, 0.9);
    background: #141f2d;
}

li.item-row.special-folder-row,
li.item-row.special-folder-row:hover {
    background: rgba(67, 138, 242, 0.09) !important;
}

li.item-row.special-folder-row {
    box-shadow: inset 3px 0 0 rgba(109, 169, 255, 0.55);
}

.file-main-info {
    gap: 11px;
}

a.item-link {
    font-weight: 550;
}

.metadata-grid {
    padding: 9px 11px;
    border: 1px solid #243247;
    border-radius: 7px;
    background: #0e1520;
}

.tag-pill {
    min-width: 27px;
    padding: 4px 8px;
    border-color: var(--border-color);
    border-radius: 6px;
    background: #0e1520;
    font-weight: 550;
}

.tag-pill:hover {
    border-color: rgba(109, 169, 255, 0.55);
    transform: none;
}

.tag-pill-a.active {
    background: #347be0;
}

.tag-pill-d.active {
    background: #287b91;
}

.special-badge,
.folder-path-badge {
    border: 1px solid rgba(109, 169, 255, 0.2);
    border-radius: 5px;
    background: rgba(109, 169, 255, 0.1);
    color: #9fc5ff;
}

.modal-overlay {
    background: rgba(5, 9, 15, 0.78);
}

.modal-card {
    border: 1px solid #2a3a50;
    border-radius: 10px;
    background: #111a27;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.48);
}

.modal-header {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--text-primary);
}

.fab-main-btn {
    background: var(--btn-primary);
    box-shadow: 0 6px 20px rgba(67, 138, 242, 0.32);
}

.fab-main-btn:hover {
    background: var(--btn-primary-hover);
    box-shadow: 0 8px 25px rgba(67, 138, 242, 0.4);
}

.container > .card,
.card,
.stat-card,
.history-card,
.shabad-form-card,
.shabad-card,
.logs-container,
.document-viewer-container {
    border: 1px solid #263449;
    border-radius: 9px;
    background: #111a27;
    box-shadow: none;
}

.card {
    padding: 22px;
}

.card h2 {
    color: var(--text-primary);
    font-size: 1.12rem;
    font-weight: 600;
}

.download-help {
    color: var(--text-muted);
}

.task-card {
    border: 1px solid #29384d;
    border-radius: 8px;
    background: #0d141e;
}

.task-card:hover {
    border-color: #344862;
    background: #101a27;
}

.progress-bar-bg {
    height: 5px;
    background: #253247;
}

.progress-bar-fill,
#progressBarFill,
#explorerProgressBarFill {
    background: var(--btn-primary) !important;
}

.history-container {
    width: min(100%, 1110px);
    max-width: 1110px;
    padding: 0;
}

.history-header {
    border-bottom-color: var(--border-color);
}

.history-title {
    color: var(--text-primary);
    font-size: 1.45rem;
    font-weight: 620;
    letter-spacing: -0.025em;
}

.stats-grid {
    gap: 12px;
}

.stat-card {
    padding: 16px 18px;
}

.stat-label {
    font-size: 0.75rem;
    letter-spacing: 0.07em;
}

.stat-value {
    color: var(--text-primary);
    font-size: 1.55rem;
    font-weight: 600;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.history-card {
    padding: 15px 17px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.history-card:hover,
.stat-card:hover,
.shabad-card:hover {
    border-color: #344862;
    background: #131e2c;
    box-shadow: none;
    transform: none;
}

.history-track-title {
    font-size: 0.98rem;
    font-weight: 560;
}

.history-progress-bar {
    height: 4px;
    background: #263346;
}

.history-progress-fill {
    background: var(--accent-blue);
}

.empty-history {
    border: 1px dashed #2a3a50;
    border-radius: 9px;
    background: #101824;
}

#uploadForm {
    padding: 22px;
    border: 1px solid #263449;
    border-radius: 9px;
    background: #111a27;
}

#uploadForm .form-group input[type="file"] {
    padding: 10px;
    border: 1px dashed #344862;
    border-radius: 7px;
    background: #0e1520;
}

.shabad-form-card {
    padding: 22px;
}

.shabad-textarea {
    border-color: #2a3a50;
    border-radius: 7px;
    background: #0b1018;
    width: 100%;
    min-height: 180px;
}

.shabad-textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(109, 169, 255, 0.12);
}

.preview-box {
    border: 1px solid #29384d;
    border-radius: 8px;
    background: #0e1520;
}

.preview-title {
    color: var(--accent-blue);
}

.shabad-card {
    padding: 18px;
}

.shabad-badge {
    border-color: rgba(109, 169, 255, 0.22);
    border-radius: 5px;
    background: rgba(109, 169, 255, 0.1);
    color: #9fc5ff;
}

.shabad-line-gurmukhi {
    color: #dbe8fb;
    text-shadow: none;
}

.shabad-line-english {
    color: var(--text-secondary);
}

.main-content > .container:not(.document-viewer-container),
.history-container,
.favorites-container {
    width: min(100%, 1110px);
    max-width: 1110px;
    margin: 0 auto;
    box-sizing: border-box;
}

.main-content > .container:not(.document-viewer-container) {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
    color: var(--text-primary);
    font-size: 1.45rem;
    font-weight: 620;
    letter-spacing: -0.025em;
}

.page-header p {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.page-header .page-heading-copy {
    min-width: 0;
}

.pdf-reading-progress {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
}

.history-header {
    margin-bottom: 22px;
    padding-bottom: 15px;
}

.logs-container {
    width: 100%;
    max-width: none;
    margin: 0;
}

.favorites-header {
    margin-bottom: 22px;
}

@media (max-width: 600px) {
    .main-content > .container:not(.document-viewer-container) {
        padding: 0;
    }
}

.logs-container {
    min-height: 75vh;
    padding: 18px;
}

.logs-header {
    border-bottom-color: var(--border-color);
}

.logs-header h1 {
    color: var(--text-primary) !important;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.log-box {
    border: 1px solid #263449;
    border-radius: 8px;
    background: #0b1018;
    font-size: 0.82rem;
}

.log-line.log-flask,
#logStatus {
    color: var(--accent-blue);
}

.log-line.log-info {
    color: #79c7a4;
}

.document-viewer-container {
    padding: 22px;
}

.reader-toolbar {
    border: 1px solid #29384d;
    border-radius: 8px;
    background: #111a27;
}

#pageNumberInput {
    border-color: #2a3a50;
    border-radius: 6px;
    background: #0e1520;
}

.document-stage-shell {
    border: 1px solid #29384d;
    border-radius: 9px;
    background:
        radial-gradient(circle at 1px 1px, rgba(115, 129, 151, 0.1) 1px, transparent 0) 0 0 / 18px 18px,
        #0b1018;
    box-shadow: inset 0 10px 24px rgba(0, 0, 0, 0.18);
}

.selection-box {
    border-color: var(--accent-blue);
    background: rgba(67, 138, 242, 0.16);
}

.mini-player-bar {
    left: 244px;
    right: 0;
    bottom: 0;
    min-height: 68px;
    height: auto;
    border: 0;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    background: rgba(14, 21, 32, 0.97);
    box-shadow: none;
}

.mini-player-progress-container {
    height: 3px;
    background: #263346;
}

.mini-player-progress-fill {
    background: var(--accent-blue);
}

.mini-player-info {
    gap: 0;
}

.mini-ctrl-btn:hover {
    background: var(--panel-bg);
}

.mini-ctrl-btn.play-btn {
    background: var(--btn-primary);
    box-shadow: none;
}

.full-player-backdrop {
    background: rgba(5, 9, 15, 0.82);
}

.full-player-content {
    width: min(100%, 560px);
    max-height: 92vh;
    padding: 22px 22px 26px;
    border: 1px solid #2a3a50;
    border-radius: 14px 14px 0 0;
    background: #111a27;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.48);
}

.full-player-header {
    margin-bottom: 20px;
}

.full-player-header-action,
.full-player-close-btn {
    border: 1px solid var(--border-color);
    background: var(--panel-bg);
    color: var(--text-secondary);
}

.full-player-header-action:hover,
.full-player-close-btn:hover {
    background: #1b2939;
    color: var(--text-primary);
}

.full-player-card h2 {
    font-size: 1.35rem;
    font-weight: 600;
}

.full-player-scrubber-container input[type="range"] {
    accent-color: var(--accent-blue);
}

.full-player-secondary-controls .ctrl-btn,
.full-player-controls .ctrl-btn {
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--panel-bg);
    color: var(--text-secondary);
}

.full-player-secondary-controls .ctrl-btn:hover,
.full-player-controls .ctrl-btn:hover {
    background: #1d2a3b;
    color: var(--text-primary);
    transform: none;
}

.full-player-controls .play-main-btn {
    background: var(--btn-primary);
    box-shadow: none;
}

.modal-playlist-card {
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #0e1520;
}

.modal-playlist-item:hover {
    background: #172333;
}

.modal-playlist-item.active {
    background: rgba(76, 143, 245, 0.12);
    color: #a9ceff;
}

.shabad-modal-backdrop {
    background: rgba(5, 9, 15, 0.82);
}

.shabad-modal-card {
    border: 1px solid #2a3a50;
    border-radius: 12px;
    background: #111a27;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.48);
}

.shabad-modal-header {
    border-bottom-color: var(--border-color);
}

.shabad-header-icon {
    color: var(--accent-blue);
    text-shadow: none;
}

.shabad-spinner {
    border-color: rgba(109, 169, 255, 0.2);
    border-top-color: var(--accent-blue);
}

.shabad-modal-footer {
    border-top-color: var(--border-color);
    background: #0e1520;
}

#globalPageProgressBar {
    background: linear-gradient(90deg, #438af2, #8cbcff);
    box-shadow: 0 0 10px rgba(109, 169, 255, 0.45);
}

#folderLoadingToast {
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: rgba(17, 26, 39, 0.97);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

@media (max-width: 899px) {
    .main-content {
        margin-left: 0;
        padding: 20px 22px 32px;
    }

    .mini-player-bar {
        left: 0;
        right: 0;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 16px;
    }

    .container {
        padding: 0;
    }

    .card,
    #uploadForm,
    .shabad-form-card {
        padding: 17px;
    }

    .breadcrumb {
        align-items: flex-start !important;
        padding: 9px;
    }

    .controls-panel {
        align-items: stretch;
        padding: 9px;
    }

    .controls-panel > label {
        margin-bottom: 4px;
    }

    li.item-row {
        padding: 11px;
    }

    .row-actions {
        gap: 4px;
    }

    .row-actions .btn {
        padding: 7px 9px;
    }

    .history-container {
        padding: 0;
    }

    .history-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-actions,
    .history-actions .btn {
        width: 100%;
    }

    .mini-player-bar {
        bottom: 0;
        padding: 0 11px;
    }

    .full-player-content {
        padding: 18px 16px 22px;
        border-radius: 12px 12px 0 0;
    }

}

/* Expanded player layout to match the approved now-playing preview */
.full-player-modal {
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.full-player-backdrop {
    background: rgba(5, 9, 15, 0.84);
}

.full-player-content {
    width: 100%;
    max-width: 1040px;
    max-height: calc(100vh - 48px);
    padding: 18px;
    border: 1px solid #2a3a50;
    border-radius: 12px;
    background: #0e1520;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52);
}

.full-player-header {
    margin: 0 0 15px;
    padding: 0 2px 13px;
    border-bottom: 1px solid var(--border-color);
}

.full-player-header > span {
    font-size: 0.9rem;
    font-weight: 550 !important;
}

.full-player-header-action,
.full-player-close-btn {
    width: 34px;
    height: 34px;
    border: 1px solid #2a3a50;
    border-radius: 7px;
    background: #151f2e;
    color: var(--text-secondary);
}

.full-player-close-btn {
    padding: 0;
}

.full-player-header-action:hover,
.full-player-close-btn:hover {
    background: #1a2636;
    color: var(--text-primary);
}

.full-player-card {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto auto auto 54px auto auto;
    column-gap: 7px;
    row-gap: 4px;
    align-items: center;
    padding: 25px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: linear-gradient(140deg, #131d2b, #101823 72%);
    text-align: left;
}

.player-modal-title-container {
    grid-column: 1 / -1;
    grid-row: 1;
    max-width: none;
    margin: 0;
    text-align: center;
}

.full-player-card h2 {
    color: var(--text-primary);
    font-size: clamp(1.35rem, 2.5vw, 1.9rem);
    font-weight: 620;
    letter-spacing: -0.035em;
}

#playerModalArtist {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 0 !important;
    color: var(--text-secondary) !important;
    font-size: 0.88rem !important;
    text-align: center;
}

#playerModalAlbum {
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 0 !important;
    color: var(--text-muted) !important;
    font-size: 0.78rem !important;
    text-align: center;
}

.full-player-scrubber-container {
    grid-column: 1 / -1;
    grid-row: 4;
    width: 100%;
    gap: 10px;
    margin: 8px 0 4px;
}

.full-player-scrubber-container input[type="range"] {
    height: 4px;
    accent-color: var(--accent-blue);
}

.full-player-secondary-controls {
    display: contents;
}

.full-player-controls {
    display: contents;
}

.full-player-secondary-controls .ctrl-btn,
.full-player-controls .ctrl-btn,
.full-player-controls .play-main-btn {
    display: grid;
    width: 100%;
    min-width: 0;
    height: 42px;
    place-items: center;
    padding: 0 3px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    color: var(--text-secondary);
    font-size: 0.78rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.full-player-secondary-controls .ctrl-btn:hover,
.full-player-controls .ctrl-btn:hover {
    transform: none;
    background: #1a2636;
    color: var(--text-primary);
}

#playerModalShuffleBtn {
    grid-column: 2 / 4;
    grid-row: 5;
}

#playerModalPrevBtn {
    grid-column: 4 / 5;
    grid-row: 5;
}

#playerModalSeekBackBtn {
    grid-column: 5 / 6;
    grid-row: 5;
}

#playerModalPlayBtn {
    grid-column: 6 / 8;
    grid-row: 5;
    width: 48px;
    height: 48px;
    justify-self: center;
    border-radius: 50%;
    background: #dbe9fb;
    color: #0c1624;
    font-size: 1.25rem;
}

#playerModalPlayBtn:hover {
    background: #fff;
}

#playerModalSeekForwardBtn {
    grid-column: 8 / 9;
    grid-row: 5;
}

#playerModalNextBtn {
    grid-column: 9 / 10;
    grid-row: 5;
}

#playerModalLoopBtn {
    grid-column: 10 / 12;
    grid-row: 5;
}

.modal-options-row {
    grid-column: 1 / -1;
    grid-row: 6;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding-top: 11px;
    border-top: 1px solid var(--border-color);
    font-size: 0.76rem;
}

.modal-option-item {
    gap: 7px;
}

.modal-option-item select {
    padding: 5px 7px;
    border: 1px solid #2a3a50;
    border-radius: 5px;
    background: #111a27;
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.modal-option-item select:focus {
    border-color: var(--accent-blue);
}

.modal-playlist-card {
    grid-column: 1 / -1;
    grid-row: 7;
    width: 100%;
    max-height: 230px;
    margin-top: 12px;
    padding: 0;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #111a27;
}

.modal-playlist-header {
    position: sticky;
    top: 0;
    z-index: 1;
    min-height: 49px;
    margin: 0;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-color);
    background: #111a27;
}

#playerModalClearQueueBtn {
    border-color: rgba(223, 133, 133, 0.25) !important;
    border-radius: 5px !important;
    background: rgba(223, 133, 133, 0.1) !important;
    color: #df8585 !important;
}

#playerModalPlaylistItems {
    padding: 3px 7px 7px;
}

.modal-playlist-item {
    min-height: 43px;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
}

.modal-playlist-item:hover {
    background: #141f2d;
}

.modal-playlist-item.active {
    border-color: rgba(109, 169, 255, 0.18);
    background: rgba(76, 143, 245, 0.1);
    color: #a9ceff;
}

@media (max-width: 700px) {
    .full-player-modal {
        align-items: flex-end;
        padding: 0;
    }

    .full-player-content {
        width: 100%;
        max-height: 94vh;
        padding: 16px 14px 20px;
        border-radius: 12px 12px 0 0;
    }

    .full-player-header {
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    .full-player-card {
        display: flex;
        flex-direction: column;
        gap: 0;
        align-items: stretch;
        padding: 17px;
        text-align: center;
    }

    .player-modal-title-container,
    #playerModalArtist,
    #playerModalAlbum,
    .full-player-scrubber-container,
    .modal-options-row,
    .modal-playlist-card {
        width: 100%;
    }

    .player-modal-title-container,
    #playerModalArtist,
    #playerModalAlbum {
        text-align: center;
    }

    .full-player-card h2 {
        font-size: 1.3rem;
    }

    .full-player-scrubber-container {
        margin: 18px 0 8px;
    }

    .full-player-secondary-controls {
        display: flex;
        justify-content: center;
        gap: 9px;
        margin: 4px 0 8px;
    }

    .full-player-secondary-controls .ctrl-btn {
        width: auto;
        min-height: 34px;
        padding: 0 10px;
        border: 1px solid var(--border-color);
        background: #151f2e;
    }

    .full-player-controls {
        display: flex;
        justify-content: center;
        gap: clamp(3px, 2vw, 14px);
        margin: 6px 0 12px;
    }

    .full-player-controls .ctrl-btn {
        width: auto;
        min-width: 38px;
        padding: 0 5px;
    }

    .full-player-controls .play-main-btn {
        width: 48px;
        min-width: 48px;
        height: 48px;
    }

    .modal-options-row {
        justify-content: center;
        flex-wrap: wrap;
        gap: 9px 15px;
        padding-top: 11px;
    }

    .modal-playlist-card {
        max-height: 200px;
        margin-top: 15px;
    }
}

@media (max-width: 899px) {
    .sidebar-backdrop {
        z-index: 1051;
    }

    .sidebar {
        z-index: 1052;
    }
}

/* Phone button bars: single line, icon-only, scroll if needed.
   Applies to every horizontal button bar, not just fullscreen. */
@media (max-width: 640px) {
    .row-actions,
    .actions-bar,
    .zoom-controls,
    .page-controls,
    .reader-toolbar,
    .document-header,
    .breadcrumb-actions {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .row-actions::-webkit-scrollbar,
    .actions-bar::-webkit-scrollbar,
    .zoom-controls::-webkit-scrollbar,
    .page-controls::-webkit-scrollbar,
    .reader-toolbar::-webkit-scrollbar,
    .document-header::-webkit-scrollbar,
    .breadcrumb-actions::-webkit-scrollbar {
        display: none;
    }

    .row-actions .btn,
    .actions-bar .btn,
    .zoom-controls .btn,
    .page-controls .btn,
    .reader-toolbar .btn,
    .document-header .btn,
    .breadcrumb-actions .btn,
    .breadcrumb-actions .back-btn {
        flex: 0 0 auto;
        min-width: 36px;
        padding: 8px 9px;
        white-space: nowrap;
    }

    .row-actions .control-label,
    .actions-bar .control-label,
    .zoom-controls .control-label,
    .page-controls .control-label,
    .reader-toolbar .control-label,
    .document-header .control-label,
    .breadcrumb-actions .control-label {
        display: none;
    }
}
