/* Frontend Styles for Noor Audio Ultimate - Spotify Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto+Mono:wght@400;500&family=Lora:wght@400;500;600&display=swap');

.noor-library-wrapper.noor-dark-theme {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    background-color: #121212 !important;
    color: #b3b3b3 !important;
    border-radius: 8px !important;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 80vh;
    min-height: 600px;
    max-height: 900px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Fullscreen native overrides */
.noor-library-wrapper.noor-dark-theme:fullscreen,
.noor-library-wrapper.noor-dark-theme:-webkit-full-screen,
.noor-library-wrapper.noor-dark-theme:-moz-full-screen,
.noor-library-wrapper.noor-dark-theme:-ms-fullscreen {
    max-width: none !important;
    max-height: none !important;
    height: 100vh !important;
    width: 100vw !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.noor-library-wrapper.noor-dark-theme * {
    box-sizing: border-box;
}

/* === Series Section === */
.noor-library-wrapper .noor-series-section {
    padding: 24px 24px 0;
    border-bottom: 1px solid #282828;
    flex-shrink: 0;
    width: 100%;
    min-width: 0; /* Critical for flex child overflow tracking */
}

/* === Live Stream State === */
.noor-library-wrapper .noor-live-card {
    border-color: rgba(255, 75, 75, 0.3) !important;
    background: linear-gradient(135deg, #1A1D24 0%, #2D1414 100%) !important;
}

.noor-library-wrapper .noor-live-image {
    background: #2D1414 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
    border-radius: 50% !important; /* Rounded artwork per request */
}

.noor-library-wrapper .noor-live-image img {
    border-radius: 50% !important;
}

.noor-library-wrapper .noor-live-status-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ff4b4b;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 7px;
    font-weight: 900;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 3;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.noor-live-card .noor-series-title {
    color: #fff !important;
    font-weight: 800 !important;
    text-transform: uppercase;
}

.noor-library-wrapper .noor-pulse-dot {
    width: 6px;
    height: 6px;
    background-color: #fff;
    border-radius: 50%;
    display: block;
    animation: noor-pulse 1.2s infinite ease-in-out;
}

@keyframes noor-pulse {
    0% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.6; }
}

.noor-library-wrapper .noor-live-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 20px;
}

.noor-library-wrapper .noor-live-visualizer .bar {
    width: 3px;
    height: 100%;
    background: #fff;
    animation: noor-visualizer 0.6s ease-in-out infinite alternate;
}

.noor-library-wrapper .noor-live-visualizer .bar:nth-child(2) { animation-delay: 0.1s; animation-duration: 0.4s; }
.noor-library-wrapper .noor-live-visualizer .bar:nth-child(3) { animation-delay: 0.2s; animation-duration: 0.7s; }
.noor-library-wrapper .noor-live-visualizer .bar:nth-child(4) { animation-delay: 0.3s; animation-duration: 0.5s; }

@keyframes noor-visualizer {
    0% { height: 20%; }
    100% { height: 100%; }
}

/* Player Live Mode */
.noor-player-bar.is-live #noor-progress-bar {
    pointer-events: none !important;
    opacity: 0.4;
}

.noor-player-bar.is-live .noor-progress-filled {
    background: #ff4b4b !important;
    width: 100% !important;
}

.noor-player-bar.is-live #noor-time-current {
    color: #ff4b4b;
    font-weight: bold;
}

.noor-player-bar.is-live #noor-time-total {
    font-size: 0;
}

.noor-player-bar.is-live #noor-time-total::after {
    content: "LIVE";
    font-size: 11px;
    color: #ff4b4b;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.noor-immersive-view.is-live #noor-immersive-pdf-btn,
.noor-immersive-view.is-live #noor-immersive-translate-btn {
    display: none !important;
}

.noor-immersive-view.is-live .noor-immersive-progress-container {
    opacity: 0.5;
    pointer-events: none;
}

.noor-library-wrapper .noor-series-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.noor-library-wrapper .noor-series-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.noor-library-wrapper #noor-view-all-series-btn {
    background: transparent;
    color: #b3b3b3;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.noor-library-wrapper #noor-view-all-series-btn:hover {
    color: #fff;
}

.noor-library-wrapper .noor-series-horizontal-scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
}

.noor-library-wrapper .noor-series-horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.noor-library-wrapper .noor-series-card {
    display: flex;
    flex-direction: row;
    gap: 12px;
    background: #1C212B;
    padding: 10px;
    border-radius: 12px;
    flex: 0 0 280px;
    max-width: none;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s, border-color 0.2s;
    border: 1px solid transparent;
}

@media (max-width: 768px) {
    .noor-library-wrapper .noor-series-section {
        padding: 16px 16px 0;
    }

    .noor-library-wrapper .noor-series-header {
        margin-bottom: 12px;
    }

    .noor-library-wrapper .noor-series-header h2 {
        font-size: 1.1rem;
    }

    .noor-library-wrapper .noor-series-horizontal-scroll {
        padding-bottom: 12px;
        gap: 12px;
    }

    .noor-library-wrapper .noor-series-card {
        padding: 8px;
        gap: 10px;
        flex: 0 0 220px;
        border-radius: 10px;
    }

    .noor-library-wrapper .noor-series-image-wrapper {
        width: 56px;
        height: 56px;
    }

    .noor-library-wrapper .noor-series-title {
        font-size: 13px;
        margin-bottom: 2px;
    }

    .noor-library-wrapper .noor-series-speaker {
        font-size: 11px;
        margin-bottom: 4px;
    }

    .noor-library-wrapper .noor-series-meta {
        gap: 4px;
    }

    .noor-library-wrapper .noor-series-lesson-count {
        font-size: 10px;
    }
}

.noor-library-wrapper .noor-series-card:hover {
    transform: translateY(-2px);
    background: #252A36;
}

.noor-library-wrapper .noor-series-card.active-series {
    background: #252A36;
    border-color: #1ed760;
    opacity: 1;
}

.noor-library-wrapper .noor-series-image-wrapper {
    position: relative;
    width: 76px;
    height: 76px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #282828;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.noor-library-wrapper .noor-series-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.noor-library-wrapper .noor-series-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b3b3b3;
}

.noor-library-wrapper .noor-series-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    min-width: 0;
    padding: 0;
}

.noor-library-wrapper .noor-series-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 2px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.noor-library-wrapper .noor-series-speaker {
    font-size: 12px;
    color: #9A9FA6;
    margin: 0 0 6px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.noor-library-wrapper .noor-series-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
}

.noor-library-wrapper .noor-series-lesson-count {
    font-size: 11px;
    color: #9A9FA6;
    line-height: 1;
}

.noor-library-wrapper .noor-series-progress {
    width: 100%;
    height: 4px;
    background: #373E47;
    border-radius: 2px;
    overflow: hidden;
}

.noor-library-wrapper .noor-series-progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 25%; /* Mockup default */
}

.noor-library-wrapper .noor-series-grid-modal.open {
    display: flex;
}

.noor-library-wrapper .noor-series-grid-modal .noor-modal-content {
    background: #121212;
    border-radius: 12px;
    max-height: 90vh;
    overflow-y: auto;
    width: 95%;
    max-width: 900px;
    padding: 30px;
}

.noor-library-wrapper .noor-series-grid-modal h2 {
    color: #fff;
    font-size: 24px;
    margin-top: 0;
    margin-bottom: 24px;
}

.noor-library-wrapper .noor-series-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
}

.noor-library-wrapper .noor-series-grid .noor-series-card {
    flex: unset;
    width: 100%;
}

@media (min-width: 640px) {
    .noor-library-wrapper .noor-series-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .noor-library-wrapper .noor-series-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Header & Filters */
.noor-library-wrapper .noor-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
    padding: 24px 24px 0 24px;
    flex-shrink: 0;
}

.noor-library-wrapper .noor-search-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 16px !important;
    flex-grow: 1 !important;
    justify-content: flex-end !important;
}

.noor-library-wrapper .noor-search-container {
    flex-grow: 1 !important;
    max-width: 350px !important;
}

@media (min-width: 768px) {
    .noor-library-wrapper .noor-header-actions {
        flex-wrap: nowrap !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
    }
    .noor-library-wrapper .noor-category-pills {
        flex-shrink: 0 !important;
        max-width: 50% !important;
        margin-bottom: 0 !important;
    }
    .noor-library-wrapper .noor-search-row {
        flex-grow: 1 !important;
        margin-left: 24px !important;
    }
    .noor-library-wrapper .noor-search-container {
        max-width: none !important;
    }
}

.noor-library-wrapper .noor-search-container input {
    padding: 10px 60px 10px 16px !important;
    border: none !important;
    border-radius: 30px !important;
    font-size: 14px !important;
    width: 100% !important;
    background: #242424 !important;
    color: #fff !important;
    transition: all 0.2s;
    font-family: inherit !important;
    box-shadow: none !important;
}

.noor-library-wrapper button#noor-play-all.noor-play-all-btn {
    background-color: #1ed760 !important;
    background: #1ed760 !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 500px !important;
    padding: 10px 24px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    transition: transform 0.2s, background-color 0.2s !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    min-height: 40px !important;
    box-shadow: none !important;
    outline: none !important;
}

.noor-library-wrapper button#noor-play-all.noor-play-all-btn:hover {
    background-color: #1fdf64 !important;
    background: #1fdf64 !important;
    transform: scale(1.04) !important;
    color: #000000 !important;
}

.noor-library-wrapper button#noor-play-all.noor-play-all-btn svg {
    width: 18px;
    height: 18px;
}

.noor-library-wrapper .noor-search-container input:focus {
    outline: none !important;
    background: #2a2a2a !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2) !important;
}

.noor-library-wrapper .noor-category-pills {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    cursor: grab;
    user-select: none;
}

.noor-library-wrapper .noor-category-pills.active-drag {
    cursor: grabbing;
}

.noor-library-wrapper .noor-category-pills::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.noor-library-wrapper .noor-pill {
    flex-shrink: 0;
    background: #242424 !important;
    border: none !important;
    padding: 6px 16px !important;
    border-radius: 30px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #fff !important;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit !important;
    text-transform: none !important;
}

.noor-library-wrapper .noor-pill:hover {
    background: #2a2a2a !important;
}

.noor-library-wrapper .noor-pill.active {
    background: #fff !important;
    color: #000 !important;
}

/* List Header & Rows */
.noor-library-wrapper .noor-list-header,
.noor-library-wrapper .noor-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 3fr) minmax(0, 1fr) 40px;
    gap: 16px;
    padding: 8px 16px;
    align-items: center;
}

.noor-library-wrapper .noor-list-header {
    border-bottom: 1px solid #282828;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: #b3b3b3;
    padding-bottom: 12px;
    padding-left: 24px;
    padding-right: 24px;
    flex-shrink: 0;
}

.noor-library-wrapper .noor-list {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 24px 24px 24px;
}

/* Custom scrollbar for the list */
.noor-library-wrapper .noor-list::-webkit-scrollbar {
    width: 8px;
}
.noor-library-wrapper .noor-list::-webkit-scrollbar-track {
    background: transparent;
}
.noor-library-wrapper .noor-list::-webkit-scrollbar-thumb {
    background: #4d4d4d;
    border-radius: 4px;
}
.noor-library-wrapper .noor-list::-webkit-scrollbar-thumb:hover {
    background: #b3b3b3;
}

.noor-library-wrapper .noor-loading {
    color: #b3b3b3;
    font-size: 14px;
    padding: 20px 16px;
}

.noor-library-wrapper .noor-row {
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    background: transparent !important;
}

.noor-library-wrapper .noor-row:hover {
    background-color: #2a2a2a !important;
}

.noor-library-wrapper .noor-row.active-playing-row .noor-title-text {
    color: #1ed760 !important;
}

.noor-library-wrapper .col-num {
    text-align: center;
    font-size: 14px;
    color: #b3b3b3;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.noor-library-wrapper .col-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.noor-library-wrapper .noor-title-text {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
}

.noor-library-wrapper .noor-speaker-text {
    font-size: 13px;
    color: #b3b3b3;
}

.noor-library-wrapper .col-album {
    font-size: 14px;
    color: #b3b3b3;
}

.noor-library-wrapper .col-action {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    color: #b3b3b3;
}

.noor-library-wrapper .noor-row .col-action svg {
    opacity: 1;
    color: #b3b3b3;
    transition: color 0.2s, transform 0.2s;
}

.noor-library-wrapper .noor-row:hover .col-action svg {
    color: #fff;
}

.noor-library-wrapper .noor-row .col-action svg:hover {
    color: #1ed760;
    transform: scale(1.1);
}

.noor-library-wrapper .noor-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sticky Player Bar */
.noor-library-wrapper .noor-player-bar {
    position: relative !important;
    flex-shrink: 0;
    width: 100% !important;
    height: 90px !important;
    background: #181818 !important;
    border-top: 1px solid #282828 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 32px !important;
    z-index: 10 !important;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5) !important;
}

.noor-library-wrapper .noor-player-left {
    width: 30%;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.noor-library-wrapper .noor-player-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    width: 100%;
}

.noor-library-wrapper .noor-player-title-wrapper {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.noor-library-wrapper .noor-is-overflowing {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
}

.noor-library-wrapper .noor-marquee-inner {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    will-change: transform;
}

.noor-library-wrapper .noor-title-part {
    font-weight: 500 !important;
    font-size: 14px !important;
    color: #fff !important;
}

.noor-library-wrapper .noor-title-spacer {
    color: #b3b3b3;
    font-size: 10px;
}

.noor-library-wrapper .noor-player-category {
    font-size: 12px !important;
    color: #b3b3b3 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.noor-library-wrapper .noor-player-center {
    width: 40%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.noor-library-wrapper .noor-player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.noor-library-wrapper .noor-controls-left,
.noor-library-wrapper .noor-controls-right {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 24px;
}

.noor-library-wrapper .noor-controls-left {
    justify-content: flex-end;
}

.noor-library-wrapper .noor-controls-right {
    justify-content: flex-start;
}

.noor-library-wrapper .noor-play-circle {
    margin: 0 24px;
    flex-shrink: 0;
}

.noor-library-wrapper .noor-control-btn {
    background: none !important;
    border: none !important;
    font-size: 16px !important;
    color: #b3b3b3 !important;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.noor-library-wrapper .noor-control-btn:hover {
    color: #fff !important;
    transform: scale(1.1);
}

.noor-library-wrapper .noor-btn-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.noor-library-wrapper .noor-play-circle {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: #fff !important;
    color: #000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    padding: 0 !important;
    transition: transform 0.2s !important;
}

.noor-library-wrapper .noor-play-circle:hover {
    transform: scale(1.05) !important;
    background: #fff !important;
    color: #000 !important;
}

/* Share Modal Styles */
.noor-library-wrapper .noor-share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.noor-library-wrapper .noor-share-modal.open {
    opacity: 1;
    visibility: visible;
}

.noor-library-wrapper .noor-share-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.noor-library-wrapper .noor-share-modal-content {
    position: relative;
    background: #1e1e1e;
    width: 90%;
    max-width: 400px;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.noor-library-wrapper .noor-share-modal.open .noor-share-modal-content {
    transform: translateY(0);
}

.noor-library-wrapper .noor-share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.noor-library-wrapper .noor-share-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.noor-library-wrapper .noor-share-options {
    display: flex;
    justify-content: space-around;
    margin-bottom: 24px;
}

.noor-library-wrapper .noor-share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #b3b3b3;
    font-size: 12px;
    transition: color 0.2s;
}

.noor-library-wrapper .noor-share-option:hover {
    color: #fff;
}

.noor-library-wrapper .noor-share-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.noor-library-wrapper .noor-share-icon.whatsapp { background: #25D366; }
.noor-library-wrapper .noor-share-icon.facebook { background: #1877F2; }
.noor-library-wrapper .noor-share-icon.twitter { background: #000000; }

.noor-library-wrapper .noor-share-copy {
    display: flex;
    gap: 8px;
    background: #121212;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #333;
}

.noor-library-wrapper .noor-share-copy input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px;
    font-size: 13px;
    outline: none;
}

.noor-library-wrapper .noor-btn-copy-link {
    background: #1ed760;
    color: #000;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.noor-library-wrapper .noor-btn-copy-link:hover {
    background: #1fdf64;
}

/* Transcript Block Active Centering */
.noor-library-wrapper .noor-transcript-block.active-block {
    background-color: rgba(30, 215, 96, 0.1);
    border-left: 3px solid #1ed760;
    padding-left: 9px; /* Adjust for border */
}

.noor-library-wrapper .noor-progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 600px;
}

.noor-library-wrapper .noor-time {
    font-size: 11px !important;
    color: #a7a7a7 !important;
    min-width: 40px;
    text-align: center;
}

.noor-library-wrapper .noor-progress-bar {
    flex-grow: 1;
    height: 4px !important;
    background: #4d4d4d !important;
    border-radius: 2px !important;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
}

.noor-library-wrapper .noor-progress-bar:hover .noor-progress-filled {
    background: #1ed760 !important;
}

.noor-library-wrapper .noor-progress-filled {
    height: 100% !important;
    background: #fff !important;
    border-radius: 2px !important;
    width: 0%;
}

.noor-library-wrapper .noor-player-right {
    width: 30%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    z-index: 60;
}

.noor-library-wrapper #noor-btn-transcript {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1ed760 !important;
    color: #000 !important;
    padding: 6px 14px !important;
    border: none !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    white-space: nowrap;
    z-index: 60;
}

.noor-library-wrapper #noor-btn-transcript svg {
    stroke: #000 !important;
}

.noor-library-wrapper #noor-btn-transcript:hover {
    background: #1fdf64 !important;
    color: #000 !important;
}

.noor-library-wrapper .noor-icon-btn {
    background: none !important;
    border: none !important;
    font-size: 13px !important;
    color: #b3b3b3 !important;
    cursor: pointer;
    font-weight: 500 !important;
    display: flex;
    align-items: center;
    gap: 6px;
}

.noor-library-wrapper .noor-icon-btn:hover {
    color: #fff !important;
}

.noor-library-wrapper .noor-volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.noor-library-wrapper .noor-volume-container input[type="range"] {
    width: 90px !important;
    height: 4px !important;
    -webkit-appearance: none !important;
    background: linear-gradient(to right, #fff var(--vol-fill, 100%), #4d4d4d var(--vol-fill, 100%)) !important;
    border-radius: 2px !important;
    outline: none !important;
    box-shadow: none !important;
}

.noor-library-wrapper .noor-volume-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    background: #fff !important;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5) !important;
}

.noor-library-wrapper .noor-volume-container:hover input[type="range"]::-webkit-slider-thumb {
    opacity: 1;
}

.noor-library-wrapper .noor-volume-container:hover input[type="range"] {
    background: linear-gradient(to right, #1ed760 var(--vol-fill, 100%), #4d4d4d var(--vol-fill, 100%)) !important;
}

/* Immersive View */
html.noor-lock-scroll, body.noor-lock-scroll {
    overflow: hidden !important;
    height: 100% !important;
    position: fixed !important;
    width: 100% !important;
}

.noor-library-wrapper.noor-fullscreen-takeover {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    z-index: 2147483647 !important;
    box-shadow: none !important;
}

.noor-library-wrapper .noor-immersive-view {
    background: #000000 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    z-index: 2147483647 !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s;
    opacity: 0;
    visibility: hidden;
    scroll-behavior: smooth;
}

.noor-library-wrapper .noor-immersive-view.open {
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.noor-library-wrapper .noor-immersive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    padding-top: calc(8px + env(safe-area-inset-top, 12px));
    border-bottom: 1px solid #282828;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: #000000;
    z-index: 40;
}

.noor-library-wrapper .noor-immersive-header .noor-icon-btn,
.noor-library-wrapper .noor-immersive-header .noor-btn {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.noor-library-wrapper .noor-immersive-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.noor-library-wrapper .noor-immersive-content {
    padding: 32px;
    flex-grow: 1;
}

.noor-library-wrapper .noor-immersive-controls-container {
    background: #000000;
    border-top: 1px solid #282828;
    position: sticky;
    bottom: 0;
    z-index: 50;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

.noor-library-wrapper .noor-immersive-queue {
    padding: 40px 32px 120px;
    background: #000000;
    border-top: 1px solid #282828;
    display: none;
    flex-grow: 1;
}

.noor-library-wrapper .noor-immersive-queue h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.noor-library-wrapper .noor-queue-meta {
    font-size: 14px;
    color: #b3b3b3;
    margin-bottom: 24px;
}

#noor-immersive-queue-now-playing {
    position: -webkit-sticky;
    position: sticky;
    top: calc(76px + env(safe-area-inset-top, 0px));
    z-index: 30;
}

.noor-library-wrapper .noor-queue-now-playing {
    background: #181818;
    border: 1px solid #1ed760;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
}

.noor-library-wrapper .noor-queue-now-playing::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 4px;
    background: #1ed760;
}

.noor-library-wrapper .np-label {
    font-size: 11px;
    font-weight: 700;
    color: #1ed760;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.noor-library-wrapper .np-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.noor-library-wrapper .np-meta {
    font-size: 13px;
    color: #b3b3b3;
}

.noor-library-wrapper .np-eq {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
}

.noor-library-wrapper .np-bar {
    width: 3px;
    background: #1ed760;
    border-radius: 2px;
    animation: noor-eq 1s ease-in-out infinite alternate;
}

.noor-library-wrapper .np-bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.noor-library-wrapper .np-bar:nth-child(2) { height: 100%; animation-delay: 0.2s; }
.noor-library-wrapper .np-bar:nth-child(3) { height: 60%; animation-delay: 0.4s; }

@keyframes noor-eq {
    0% { height: 20%; }
    100% { height: 100%; }
}

.noor-library-wrapper .noor-immersive-queue-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    color: #b3b3b3;
    transition: color 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.noor-library-wrapper .noor-immersive-queue-item.noor-sortable-drag {
    background-color: #000000 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    z-index: 9999;
    touch-action: none;
}

.noor-library-wrapper .noor-immersive-queue-item.noor-sortable-ghost {
    opacity: 0.4;
    background-color: #181818;
}

.noor-library-wrapper .noor-immersive-queue-item:hover {
    color: #fff;
}

.noor-library-wrapper .noor-immersive-queue-item .noor-queue-drag-handle {
    cursor: grab;
    margin-right: 16px;
    color: #b3b3b3;
    display: flex;
    align-items: center;
    touch-action: none;
}

.noor-library-wrapper .noor-immersive-queue-item .noor-queue-title {
    flex-grow: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.noor-library-wrapper .noor-add-to-queue:hover {
    color: #1ed760 !important;
    transform: scale(1.1);
    transition: all 0.2s;
}

/* Transcript Modal */
.noor-library-wrapper .noor-modal-backdrop {
    position: absolute !important;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.noor-library-wrapper .noor-modal {
    position: absolute !important;
    top: 20px;
    bottom: 110px; /* 90px player + 20px gap */
    left: 50%;
    transform: translateX(-50%) scale(0.98);
    width: 90%;
    max-width: 800px;
    height: auto;
    max-height: calc(100% - 130px);
    background: #181818 !important;
    border: 1px solid #282828 !important;
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.5);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.noor-library-wrapper .noor-modal.open,
.noor-library-wrapper .noor-modal-backdrop.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

.noor-library-wrapper .noor-modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid #282828;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.noor-library-wrapper .noor-modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    font-family: inherit !important;
    color: #fff !important;
}

.noor-library-wrapper .noor-modal-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.noor-library-wrapper .noor-copy-btn {
    background: transparent !important;
    color: #b3b3b3 !important;
    border: 1px solid #b3b3b3 !important;
    padding: 6px 16px !important;
    border-radius: 30px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: all 0.2s;
}

.noor-library-wrapper .noor-copy-btn:hover {
    color: #fff !important;
    border-color: #fff !important;
    transform: scale(1.02);
}

.noor-library-wrapper .noor-modal-content {
    padding: 32px;
    overflow-y: auto;
    flex-grow: 1;
    position: relative;
}

.noor-library-wrapper .noor-transcript-text {
    margin-bottom: 32px;
}

.noor-library-wrapper .noor-transcript-block {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 32px;
    margin-bottom: 32px;
    align-items: stretch;
    cursor: pointer;
    border-radius: 8px;
    padding: 12px;
    margin-left: -12px;
    margin-right: -12px;
    transition: background-color 0.2s ease;
}

.noor-library-wrapper .noor-transcript-block:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.noor-library-wrapper .noor-ts {
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    color: #555;
    border-right: 2px solid #282828;
    padding-right: 24px;
    text-align: right;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding-top: 4px;
}

.noor-library-wrapper .noor-transcript-block:hover .noor-ts {
    color: #1ed760;
    border-color: #1ed760;
}

.noor-library-wrapper .noor-text {
    font-family: 'Lora', serif;
    font-size: 18px;
    line-height: 1.8;
    color: #888;
    transition: color 0.3s ease;
    text-align: left;
}

.noor-library-wrapper .noor-transcript-block:hover .noor-text {
    color: #ccc;
}

.noor-library-wrapper .noor-text p {
    margin-bottom: 20px;
}

.noor-library-wrapper .noor-text p:last-child {
    margin-bottom: 0;
}

.noor-library-wrapper .noor-transcript-block.active-block .noor-ts {
    color: #1ed760;
    border-color: #1ed760;
}

.noor-library-wrapper .noor-transcript-block.active-block .noor-text {
    color: #fff;
}

.noor-library-wrapper .noor-download-btn {
    width: 100%;
    background: #fff !important;
    color: #000 !important;
    border: none !important;
    padding: 12px !important;
    border-radius: 30px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: transform 0.2s;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-family: inherit !important;
}

.noor-library-wrapper .noor-download-btn:hover {
    transform: scale(1.02);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .noor-library-wrapper.noor-dark-theme {
        height: 90vh;
        min-height: 500px;
    }
    
    .noor-library-wrapper .noor-header-actions {
        padding: 12px 12px 0 12px;
        margin-bottom: 8px;
        gap: 8px;
    }

    .noor-library-wrapper .noor-list {
        padding: 0 12px 12px 12px;
    }

    .noor-library-wrapper .noor-list-header {
        display: none !important;
    }

    .noor-library-wrapper .noor-row {
        grid-template-columns: minmax(0, 1fr) 40px;
        padding: 10px 12px; /* Decreased vertical spacing to show more tracks */
        gap: 8px;
    }

    .noor-library-wrapper .col-num,
    .noor-library-wrapper .col-album {
        display: none !important;
    }

    .noor-library-wrapper .noor-mobile-category {
        display: inline !important;
    }

    .noor-library-wrapper .noor-col-title-artist .noor-title {
        font-size: 14px;
        margin-bottom: 2px;
    }

    .noor-library-wrapper .noor-col-title-artist .noor-artist {
        font-size: 12px;
    }

    /* Sticky Player Bar Mobile */
    .noor-library-wrapper .noor-player-bar {
        height: auto !important;
        padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px)) 12px !important;
        flex-direction: column !important;
        gap: 8px !important;
        align-items: center !important;
    }

    .noor-library-wrapper .noor-player-left {
        width: 100%;
        justify-content: center;
        text-align: center;
        margin-bottom: 0px;
    }

    .noor-library-wrapper .noor-player-info {
        align-items: center;
    }

    .noor-library-wrapper .noor-player-center {
        width: 100%;
        display: flex;
        flex-direction: column; /* Controls on top, progress on bottom */
        gap: 8px;
    }

    .noor-library-wrapper .noor-player-controls {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
    }

    .noor-library-wrapper .noor-controls-left,
    .noor-library-wrapper .noor-controls-right {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 24px;
    }

    .noor-library-wrapper .noor-controls-left {
        justify-content: flex-end;
    }

    .noor-library-wrapper .noor-controls-right {
        justify-content: flex-start;
    }

    .noor-library-wrapper .noor-play-circle {
        margin: 0 24px;
    }

    .noor-library-wrapper .noor-progress-container {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 0; /* Increase hit area for touch */
    }

    .noor-library-wrapper .noor-time {
        display: block !important;
        font-size: 11px !important;
        color: #b3b3b3 !important;
        min-width: 38px;
        text-align: center;
    }

    .noor-library-wrapper .noor-progress-bar {
        flex: 1;
        height: 4px !important;
        background: #4d4d4d !important;
        border-radius: 2px !important;
        position: relative;
    }
    
    /* Invisible hit area expansion for the progress bar */
    .noor-library-wrapper .noor-progress-bar::after {
        content: '';
        position: absolute;
        top: -15px;
        bottom: -15px;
        left: 0;
        right: 0;
    }

    .noor-library-wrapper .noor-player-right {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        justify-content: center;
    }

    .noor-library-wrapper .noor-volume-container {
        display: none !important; /* Hide volume on mobile */
    }

    /* Transcript Modal Mobile */
    .noor-library-wrapper .noor-modal {
        width: 100%;
        height: 100%;
        max-width: 100%;
        top: 100%;
        left: 0;
        transform: none;
        border-radius: 0;
        border: none !important;
        transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .noor-library-wrapper .noor-modal.open {
        top: 0;
        transform: none;
    }
    
    .noor-library-wrapper .noor-modal-header {
        padding: 16px;
    }
    
    .noor-library-wrapper .noor-modal-content {
        padding: 16px;
    }

    .noor-library-wrapper .noor-transcript-block {
        grid-template-columns: 45px 1fr;
        gap: 12px;
        margin-bottom: 24px;
    }

    .noor-library-wrapper .noor-ts {
        padding-right: 8px;
        font-size: 12px;
    }

    .noor-library-wrapper .noor-text {
        font-size: 14px;
        line-height: 1.6;
    }
    
    .noor-library-wrapper .noor-text p {
        margin-bottom: 16px;
    }

    .noor-library-wrapper .noor-immersive-header {
        padding: 8px 16px !important;
        padding-top: calc(4px + env(safe-area-inset-top, 10px)) !important;
    }

    .noor-library-wrapper .noor-immersive-content {
        padding: 16px !important;
    }

    .noor-library-wrapper .noor-transcript-audio-title {
        font-size: 18px !important;
        margin-bottom: 16px !important;
        padding-bottom: 12px !important;
    }
}

/* Helper to prevent body scroll when immersive is open */
body.noor-immersive-open {
    overflow: hidden !important;
    width: 100vw !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
}

/* Multi-Device Architecture Overrides */
body.is-safari .noor-library-wrapper .noor-immersive-header {
    padding-top: calc(12px + env(safe-area-inset-top, 20px)) !important;
}

body.is-safari .noor-library-wrapper .noor-transcript-audio-title {
    font-size: 1.4rem !important;
}

body.is-samsung .noor-library-wrapper .noor-immersive-header {
    padding-top: calc(env(safe-area-inset-top, 24px) + 20px) !important;
}

body.is-samsung .noor-library-wrapper .noor-series-section {
    padding-top: calc(env(safe-area-inset-top, 24px) + 24px) !important;
}

body.is-safari .noor-library-wrapper .noor-series-section {
    padding-top: calc(env(safe-area-inset-top, 20px) + 16px) !important;
}

@media (max-width: 768px) {
    body.is-samsung .noor-library-wrapper .noor-series-section {
        padding-top: calc(env(safe-area-inset-top, 24px) + 16px) !important;
    }
    
    body.is-safari .noor-library-wrapper .noor-series-section {
        padding-top: calc(env(safe-area-inset-top, 20px) + 12px) !important;
    }
}

body.is-samsung .noor-library-wrapper .noor-immersive-controls-container {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 20px)) !important;
}

body.is-samsung .noor-library-wrapper .noor-immersive-queue {
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 20px)) !important;
}

/* === AI Knowledge Engine === */
.noor-ask-ai-btn:hover {
    box-shadow: 0 6px 14px rgba(30, 215, 96, 0.4) !important;
    transform: translateY(-50%) scale(1.02) !important;
}

#noor-ai-answer-content p {
    margin: 0 0 12px;
}

#noor-ai-answer-content p:last-child {
    margin-bottom: 0;
}

#noor-ai-answer-content ul, #noor-ai-answer-content ol {
    margin: 0 0 16px 20px;
    padding: 0;
}

#noor-ai-answer-content li {
    margin-bottom: 8px;
}

#noor-ai-answer-content b, #noor-ai-answer-content strong {
    color: #1ed760;
}

/* AI UI Enchancements */
.noor-search-container input {
    overflow-x: auto;
    white-space: nowrap;
}

@media (max-width: 768px) {
    #noor-ai-immersive-question {
        font-size: 24px !important;
    }
    .noor-ai-source-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }
    .noor-ai-source-card > div:first-child {
        width: 100%;
    }
    .noor-ai-source-card .noor-ai-immersive-jump-btn {
        width: 100% !important;
    }
}
