.cogop-music-library {
    --bg-primary: #0d0f14;
    --bg-card: #141720;
    --bg-elevated: #1a1e2a;
    --bg-hover: #1f2433;
    --accent: #4f8ef7;
    --accent-soft: rgba(79, 142, 247, 0.12);
    --accent-border: rgba(79, 142, 247, 0.3);
    --gold: #e8a840;
    --gold-soft: rgba(232, 168, 64, 0.12);
    --green: #3ecf8e;
    --green-soft: rgba(62, 207, 142, 0.1);
    --red: #ef6363;
    --red-soft: rgba(239, 99, 99, 0.12);
    --text-primary: #eceef5;
    --text-secondary: #8892a4;
    --text-muted: #4e5768;
    --border: #1e2535;
    --border-hover: #2a3347;
    --radius: 10px;
    --radius-lg: 14px;

    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 28px;
    border-radius: var(--radius-lg);
    font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cogop-music-library *,
.cogop-music-library *::before,
.cogop-music-library *::after {
    box-sizing: border-box;
}

.cogop-music-library a {
    color: inherit;
    text-decoration: none;
}

.cogop-music-library button,
.cogop-music-library input,
.cogop-music-library select {
    font: inherit;
}

/* =========================================================
   Header
========================================================= */

.cogop-library-header {
    margin-bottom: 26px;
}

.cogop-library-hero {
    padding: 8px 0 2px;
}

.cogop-library-hero__content {
    max-width: 760px;
}

.cogop-library-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.cogop-library-hero__icon {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--accent-border);
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent);
}

.cogop-library-hero__icon svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cogop-library-hero__title {
    max-width: 720px;
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(34px, 4vw, 48px);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: 0;
}

.cogop-library-hero__description {
    max-width: 680px;
    margin: 14px 0 0;
    color: var(--text-secondary);
    font-size: 15.5px;
    line-height: 1.68;
}

.cogop-library-hero__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.cogop-library-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 7px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.cogop-library-chip--multitracks {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
}

.cogop-library-chip--chords {
    border-color: rgba(62, 207, 142, 0.26);
    background: var(--green-soft);
    color: var(--green);
}

.cogop-library-chip--videos {
    border-color: rgba(139, 111, 247, 0.26);
    background: rgba(139, 111, 247, 0.12);
    color: #a997ff;
}

.cogop-library-chip--choir {
    border-color: rgba(232, 168, 64, 0.28);
    background: var(--gold-soft);
    color: var(--gold);
}

/* =========================================================
   Topbar: Search, Sort, Count, Quick Filters
========================================================= */

.cogop-library-topbar {
    margin-bottom: 22px;
}

.cogop-library-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.cogop-library-search {
    position: relative;
    width: 100%;
    margin: 0;
}

.cogop-library-search span {
    position: absolute;
    left: 13px;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    color: var(--text-muted);
    line-height: 1;
    pointer-events: none;
}

.cogop-library-search svg {
    display: block;
    width: 16px;
    height: 16px;
    min-width: 16px;
    max-width: 16px;
    min-height: 16px;
    max-height: 16px;
}

.cogop-library-search input {
    width: 100%;
    height: 42px;
    min-height: 42px;
    padding: 0 14px 0 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13.5px;
    outline: none;
    box-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.cogop-library-search input::placeholder {
    color: var(--text-muted);
}

.cogop-library-search input:focus {
    background: var(--bg-hover);
    border-color: var(--accent-border);
}

.cogop-library-sort {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 42px;
    min-height: 42px;
    margin: 0;
    padding: 0 38px 0 14px;
    border: 1px solid rgba(79, 142, 247, 0.14);
    border-radius: 12px;
    background-color: var(--bg-elevated);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px 14px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cogop-library-sort:hover {
    background-color: var(--bg-hover);
    border-color: rgba(79, 142, 247, 0.22);
    color: var(--text-primary);
}

.cogop-library-sort:focus {
    border-color: var(--accent-border);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.08);
}

.cogop-library-results-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.cogop-library-results-count {
    margin: 0;
    color: var(--text-muted);
    font-size: 12.5px;
    white-space: nowrap;
}

.cogop-library-results-count strong {
    color: var(--text-secondary);
    font-weight: 500;
}

.cogop-library-quick-filters {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.cogop-library-quick-filters::-webkit-scrollbar {
    display: none;
}

.cogop-library-quick-filter {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cogop-library-quick-filter:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-secondary);
}

.cogop-library-quick-filter.active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
    font-weight: 600;
}

/* =========================================================
   Layout and Sidebar
========================================================= */

.cogop-library-mobile-filter-toggle {
    display: none;
    width: 100%;
    margin-bottom: 14px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cogop-library-mobile-filter-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.cogop-library-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.cogop-library-sidebar {
    position: sticky;
    top: 90px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
}

.cogop-library-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.cogop-library-sidebar-head strong {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
}

.cogop-library-reset {
    border: none;
    background: none;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Active chips */

.cogop-library-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 2px 0 14px;
}

.cogop-library-active-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 30px;
    padding: 6px 12px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cogop-library-active-chip:hover {
    background: rgba(79, 142, 247, 0.18);
    border-color: rgba(79, 142, 247, 0.42);
    color: var(--accent);
}

.cogop-library-active-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 1px;
    border-radius: 999px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

/* Filter blocks */

.cogop-library-filter-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.cogop-library-filter-block:first-of-type {
    padding-top: 0;
    border-top: none;
}

.cogop-library-filter-title {
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cogop-library-filter-block label {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 26px;
    padding: 4px 6px;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.cogop-library-filter-block label:hover {
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-primary);
}

.cogop-library-filter-block label:has(input:checked) {
    background: var(--accent-soft);
    color: var(--text-primary);
}

.cogop-library-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: auto;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(79, 142, 247, 0.08);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.cogop-library-filter-block label:has(input:checked) .cogop-library-filter-count {
    background: rgba(79, 142, 247, 0.16);
    color: var(--accent);
}

.cogop-library-filter-block input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
}

/* =========================================================
   BPM Range
========================================================= */

.cogop-library-bpm-range {
    padding: 4px 0 2px;
}

.cogop-library-bpm-labels {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 11px;
}

.cogop-library-bpm-labels span {
    display: inline-block;
    line-height: 1;
}

.cogop-library-bpm-slider {
    --bpm-progress: 100%;
    display: block;
    width: 100%;
    height: 18px;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}

.cogop-library-bpm-slider:focus-visible {
    outline: 2px solid var(--accent-border);
    outline-offset: 3px;
}

/* Chrome / Edge / Safari */
.cogop-library-bpm-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        var(--accent) 0%,
        var(--accent) var(--bpm-progress),
        var(--bg-elevated) var(--bpm-progress),
        var(--bg-elevated) 100%
    );
}

.cogop-library-bpm-slider::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border: 2px solid var(--accent);
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 142, 247, 0.16);
    -webkit-appearance: none;
}

/* Firefox */
.cogop-library-bpm-slider::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: var(--bg-elevated);
}

.cogop-library-bpm-slider::-moz-range-progress {
    height: 4px;
    border-radius: 999px;
    background: var(--accent);
}

.cogop-library-bpm-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid var(--accent);
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 142, 247, 0.16);
}

.cogop-library-bpm-value {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

.cogop-library-bpm-value span {
    color: var(--accent);
    font-weight: 600;
}

/* =========================================================
   Content and Section Header
========================================================= */

.cogop-library-content {
    position: relative;
    min-width: 0;
}

.cogop-library-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.cogop-library-section-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.cogop-library-section-count {
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 12px;
}

.cogop-music-library.is-loading .cogop-song-list,
.cogop-music-library.is-loading .cogop-library-pagination {
    opacity: 0.45;
    pointer-events: none;
}

.cogop-library-content::before {
    content: "Loading songs...";
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    display: none;
    padding: 5px 9px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--bg-elevated);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.cogop-music-library.is-loading .cogop-library-content::before {
    display: block;
}

/* =========================================================
   Song Cards: Desktop/List Layout
========================================================= */

.cogop-song-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cogop-library-song-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    overflow: hidden;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.cogop-library-song-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 2px 0 0 2px;
    background: transparent;
    transition: background 0.2s ease;
}

.cogop-library-song-card:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
}

.cogop-library-song-card:hover::before {
    background: var(--accent);
}

.cogop-music-library.has-active-filters .cogop-library-song-card::before {
    background: rgba(79, 142, 247, 0.55);
}

.cogop-music-library.has-active-filters .cogop-library-song-card:hover::before {
    background: var(--accent);
}

.cogop-library-song-cover {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(135deg, #1a2840, #2a3f6b);
}

.cogop-library-song-cover a,
.cogop-library-song-cover img {
    display: block;
    width: 100%;
    height: 100%;
}

.cogop-library-song-cover img {
    object-fit: cover;
}

.cogop-library-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.75);
    font-size: 20px;
}

.cogop-library-song-info {
    flex: 1;
    min-width: 0;
}

.cogop-library-song-title {
    margin: 0 0 4px;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cogop-library-song-title a:hover {
    color: var(--accent);
}

.cogop-library-song-artist {
    color: var(--text-secondary);
    font-size: 12.5px;
}

.cogop-library-song-themes {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11.5px;
}

.cogop-library-song-meta {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 16px;
}

.cogop-library-meta-item {
    min-width: 40px;
    text-align: center;
}

.cogop-library-meta-item span {
    display: block;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.cogop-library-meta-item strong {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.cogop-library-song-price {
    flex: 0 0 82px;
    text-align: right;
}

.library-price-main {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
}

.library-price-note {
    color: var(--green);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.library-access-main {
    color: var(--text-primary);
    font-weight: 700;
}

.cogop-library-open-song {
    display: flex;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.cogop-library-open-song:hover,
.cogop-library-song-card:hover .cogop-library-open-song {
    background: var(--accent);
    color: #fff;
}

.cogop-library-open-song svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* =========================================================
   Empty State
========================================================= */

.cogop-library-empty,
.cogop-library-error {
    display: none;
    margin-top: 12px;
    padding: 34px;
    border: 1px dashed var(--border-hover);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    color: var(--text-secondary);
    text-align: center;
}

.cogop-library-empty.is-visible,
.cogop-library-error.is-visible {
    display: block;
}

.cogop-library-empty strong,
.cogop-library-error strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.cogop-library-empty p {
    margin: 0 0 14px;
}

.cogop-library-empty button {
    min-height: 34px;
    padding: 8px 14px;
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}

.cogop-library-empty button:hover {
    background: rgba(79, 142, 247, 0.18);
}

.cogop-music-library .cogop-library-empty button[data-library-clear-empty],
.cogop-music-library .cogop-library-empty button[data-library-clear-empty]:hover,
.cogop-music-library .cogop-library-empty button[data-library-clear-empty]:focus {
    min-height: 34px !important;
    padding: 8px 14px !important;
    border: 1px solid var(--accent-border) !important;
    border-radius: 8px !important;
    background: var(--accent-soft) !important;
    color: var(--accent) !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.cogop-music-library .cogop-library-empty button[data-library-clear-empty]:hover,
.cogop-music-library .cogop-library-empty button[data-library-clear-empty]:focus {
    background: rgba(79, 142, 247, 0.18) !important;
}

.cogop-library-error {
    border-color: rgba(239, 99, 99, 0.35);
    background: var(--red-soft);
}

.cogop-library-error p {
    margin: 0 0 14px;
}

.cogop-library-error button {
    min-height: 34px;
    padding: 8px 14px;
    border: 1px solid rgba(239, 99, 99, 0.45);
    border-radius: 8px;
    background: rgba(239, 99, 99, 0.14);
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}

.cogop-library-error button:hover {
    background: rgba(239, 99, 99, 0.22);
}

.cogop-library-error button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.cogop-music-library .cogop-library-error button[data-library-retry],
.cogop-music-library .cogop-library-error button[data-library-retry]:hover,
.cogop-music-library .cogop-library-error button[data-library-retry]:focus {
    min-height: 34px !important;
    padding: 8px 14px !important;
    border: 1px solid rgba(239, 99, 99, 0.45) !important;
    border-radius: 8px !important;
    background: rgba(239, 99, 99, 0.14) !important;
    color: var(--text-primary) !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.cogop-music-library .cogop-library-error button[data-library-retry]:hover,
.cogop-music-library .cogop-library-error button[data-library-retry]:focus {
    background: rgba(239, 99, 99, 0.22) !important;
}

.cogop-music-library .cogop-library-error button[data-library-retry]:disabled {
    opacity: 0.55 !important;
    cursor: wait !important;
}

/* =========================================================
   Pagination
========================================================= */

.cogop-library-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 22px;
}

.cogop-library-pagination:empty {
    display: none;
}

.cogop-library-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cogop-library-page-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.cogop-library-page-btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.cogop-library-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.cogop-library-page-dots {
    padding: 0 2px;
    color: var(--text-muted);
    font-size: 12px;
}

/* =========================================================
   Responsive: Tablet
========================================================= */

@media (max-width: 980px) {
    .cogop-library-layout {
        grid-template-columns: 1fr;
    }

    .cogop-library-mobile-filter-toggle {
        display: block;
    }

    .cogop-library-sidebar {
        position: static;
        display: none;
    }

    .cogop-library-sidebar.is-open {
        display: block;
    }
}

@media (max-width: 780px) {
    .cogop-library-search-row {
        grid-template-columns: 1fr;
    }

    .cogop-library-results-row {
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: flex-start;
    }

    .cogop-library-quick-filters {
        justify-content: flex-start;
        width: 100%;
    }

    .cogop-library-song-card {
        display: grid;
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 12px;
    }

    .cogop-library-song-meta,
    .cogop-library-song-price,
    .cogop-library-open-song {
        grid-column: 2;
    }

    .cogop-library-song-meta {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 10px;
    }

    .cogop-library-song-price {
        text-align: left;
    }
}

/* =========================================================
   Responsive: Mobile Premium Cards
========================================================= */

@media (max-width: 640px) {
    .cogop-music-library {
        padding: 18px;
        border-radius: 12px;
    }

    .cogop-library-header {
        margin-bottom: 22px;
    }

    .cogop-library-hero {
        padding-top: 2px;
    }

    .cogop-library-hero__title {
        font-size: 30px;
        line-height: 1.08;
    }

    .cogop-library-hero__description {
        margin-top: 12px;
        font-size: 14.5px;
        line-height: 1.58;
    }

    .cogop-library-hero__chips {
        margin-top: 16px;
    }

    .cogop-song-list {
        gap: 22px;
    }

    .cogop-library-song-card {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 16px;
        align-items: start;
        padding: 18px;
        border-radius: 18px;
        border: 1px solid var(--border);
        background: var(--bg-card);
        box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
    }

    .cogop-library-song-card::before {
        display: none;
    }

    .cogop-library-song-cover {
        grid-column: 1;
        grid-row: 1;
        width: 96px;
        height: 96px;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: #1e293b;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
    }

    .cogop-library-song-cover img {
        border-radius: 13px;
    }

    .cogop-library-cover-placeholder {
        font-size: 24px;
    }

    .cogop-library-song-info {
        grid-column: 2;
        grid-row: 1;
        align-self: center;
        min-width: 0;
    }

    .cogop-library-song-title {
        margin-bottom: 5px;
        overflow: visible;
        line-height: 1.16;
        letter-spacing: -0.03em;
        text-overflow: initial;
        white-space: normal;
    }

    .cogop-library-song-artist {
        margin-bottom: 7px;
        color: var(--text-secondary);
        font-size: 14px;
        font-weight: 600;
    }

    .cogop-library-song-themes {
        margin-top: 0;
        color: var(--text-secondary);
        font-size: 12px;
    }

    .cogop-library-song-meta {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0;
        width: 100%;
        margin-top: 6px;
        padding: 14px 10px;
        border: 1px solid rgba(255, 255, 255, 0.045);
        border-radius: 14px;
        background: rgba(11, 13, 18, 0.5);
    }

    .cogop-library-meta-item {
        position: relative;
        min-width: 0;
        text-align: center;
    }

    .cogop-library-meta-item:not(:last-child)::after {
        content: "";
        position: absolute;
        top: 6px;
        right: 0;
        bottom: 6px;
        width: 1px;
        background: var(--border);
    }

    .cogop-library-meta-item span {
        margin-bottom: 4px;
        color: var(--text-secondary);
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .cogop-library-meta-item strong {
        color: var(--text-primary);
        font-size: 15px;
        font-weight: 800;
    }

    .cogop-library-song-price {
        grid-column: 1 / 2;
        align-self: center;
        margin-top: 6px;
        text-align: left;
    }

    .library-price-main {
        color: var(--text-primary);
        font-size: 22px;
        font-weight: 800;
        line-height: 1;
    }

    .library-price-note {
        display: inline-flex;
        align-items: center;
        margin-top: 8px;
        padding: 4px 8px;
        border-radius: 5px;
        background: var(--green-soft);
        color: var(--green);
        font-size: 11px;
        font-weight: 700;
        white-space: nowrap;
    }

    .cogop-library-open-song {
        grid-column: 2;
        justify-self: end;
        align-self: center;
        width: 42px;
        height: 42px;
        margin-top: 6px;
        border-radius: 13px;
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
        box-shadow: 0 12px 24px rgba(79, 142, 247, 0.22);
    }

    .cogop-library-open-song svg {
        width: 20px;
        height: 20px;
        stroke-width: 2.4;
    }

    .cogop-library-pagination {
        gap: 5px;
        margin-top: 26px;
    }

    .cogop-library-page-btn {
        min-width: 34px;
        height: 34px;
        border-radius: 9px;
    }
}

/* =========================================================
   Final Compatibility Overrides
   Keeps Elementor/theme button and input styles from overriding the Library UI.
========================================================= */

.cogop-music-library .cogop-library-results-row .cogop-library-quick-filters {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: auto !important;
    scrollbar-width: none;
}

.cogop-music-library .cogop-library-results-row .cogop-library-quick-filters::-webkit-scrollbar {
    display: none !important;
}

.cogop-music-library .cogop-library-results-row .cogop-library-quick-filter,
.cogop-music-library button.cogop-library-quick-filter {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 32px !important;
    padding: 7px 14px !important;
    border: 1px solid var(--border) !important;
    border-radius: 999px !important;
    background: var(--bg-elevated) !important;
    color: var(--text-muted) !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    box-shadow: none !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
}

.cogop-music-library .cogop-library-results-row .cogop-library-quick-filter:hover,
.cogop-music-library button.cogop-library-quick-filter:hover {
    background: var(--bg-hover) !important;
    border-color: var(--border-hover) !important;
    color: var(--text-secondary) !important;
}

.cogop-music-library .cogop-library-results-row .cogop-library-quick-filter.active,
.cogop-music-library button.cogop-library-quick-filter.active {
    background: var(--accent-soft) !important;
    border-color: var(--accent-border) !important;
    color: var(--accent) !important;
    font-weight: 600 !important;
}

.cogop-music-library .cogop-library-active-chips {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin: 2px 0 14px !important;
}

.cogop-music-library .cogop-library-active-chip,
.cogop-music-library button.cogop-library-active-chip {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-height: 30px !important;
    padding: 6px 12px !important;
    border: 1px solid var(--accent-border) !important;
    border-radius: 999px !important;
    background: var(--accent-soft) !important;
    color: var(--accent) !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
}

.cogop-music-library .cogop-library-active-chip:hover,
.cogop-music-library button.cogop-library-active-chip:hover {
    background: rgba(79, 142, 247, 0.18) !important;
    border-color: rgba(79, 142, 247, 0.42) !important;
    color: var(--accent) !important;
}

.cogop-music-library .cogop-library-active-chip span {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 14px !important;
    height: 14px !important;
    margin-left: 1px !important;
    border-radius: 999px !important;
    color: var(--accent) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.cogop-music-library input.cogop-library-bpm-slider {
    --bpm-progress: 100%;
    display: block !important;
    width: 100% !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    cursor: pointer !important;
}

.cogop-music-library input.cogop-library-bpm-slider::-webkit-slider-runnable-track {
    height: 4px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: linear-gradient(
        to right,
        var(--accent) 0%,
        var(--accent) var(--bpm-progress),
        var(--bg-elevated) var(--bpm-progress),
        var(--bg-elevated) 100%
    ) !important;
    box-shadow: none !important;
}

.cogop-music-library input.cogop-library-bpm-slider::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    width: 14px !important;
    height: 14px !important;
    margin-top: -5px !important;
    border: 2px solid var(--accent) !important;
    border-radius: 999px !important;
    background: var(--accent) !important;
    box-shadow: 0 0 0 4px rgba(79, 142, 247, 0.16) !important;
}

.cogop-music-library input.cogop-library-bpm-slider::-moz-range-track {
    height: 4px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: var(--bg-elevated) !important;
    box-shadow: none !important;
}

.cogop-music-library input.cogop-library-bpm-slider::-moz-range-progress {
    height: 4px !important;
    border-radius: 999px !important;
    background: var(--accent) !important;
}

.cogop-music-library input.cogop-library-bpm-slider::-moz-range-thumb {
    width: 14px !important;
    height: 14px !important;
    border: 2px solid var(--accent) !important;
    border-radius: 999px !important;
    background: var(--accent) !important;
    box-shadow: 0 0 0 4px rgba(79, 142, 247, 0.16) !important;
}

@media (max-width: 780px) {
    .cogop-music-library .cogop-library-results-row .cogop-library-quick-filters {
        justify-content: flex-start !important;
        width: 100% !important;
    }
}

/* =========================================================
   Sidebar Reset Button — Final Style Fix
========================================================= */

.cogop-music-library .cogop-library-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid transparent !important;
    border-radius: 999px;
    background: transparent !important;
    color: var(--accent) !important;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.cogop-music-library .cogop-library-reset:hover,
.cogop-music-library .cogop-library-reset:focus {
    background: var(--accent-soft) !important;
    border-color: var(--accent-border) !important;
    color: var(--accent) !important;
    box-shadow: none !important;
    transform: translateY(-1px);
}

.cogop-music-library .cogop-library-reset:active {
    transform: translateY(0);
}

/* Sort Select - Final Compatibility Override */

.cogop-music-library select.cogop-library-sort {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 38px 0 14px !important;
    border: 1px solid rgba(79, 142, 247, 0.14) !important;
    border-radius: 12px !important;
    background-color: var(--bg-elevated) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 14px 14px !important;
    color: var(--text-secondary) !important;
    font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025) !important;
    outline: none !important;
    cursor: pointer !important;
}
