/* Song Request: footer button, badge, and search panel (drawer on desktop, sheet on mobile) */

/* Footer pill that sits under "Skip This Comparison" and matches its look */
#song-request-btn {
    order: 3;
    position: relative;
    width: 200px;
    min-width: 200px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: #666;
    border: 2px solid #ddd;
    padding: 12px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    font-family: Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

#song-request-btn:hover {
    border-color: #999;
    color: #333;
}

#song-request-btn:focus-visible {
    outline: 2px solid #D4AF37;
    outline-offset: 2px;
}

#song-request-btn svg {
    flex-shrink: 0;
    pointer-events: none;
}

/* Corner bubble so the count never pushes the label onto two lines */
.song-request-badge {
    position: absolute;
    top: -8px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #000;
    color: #fff;
    border: 2px solid #fff;
    box-sizing: border-box;
    letter-spacing: 0;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
}

/* Match the 280px width the other footer buttons use on phones and tablets */
@media (max-width: 768px) {
    #song-request-btn {
        width: 280px;
        min-width: 280px;
    }
}

/* "Your requests" collapsible list above the search box */
.song-request-queue {
    flex-shrink: 0;
    margin: 0 0 1rem;
    border: 2px solid #000;
}

.song-request-queue[hidden] {
    display: none;
}

.song-request-queue-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 0.85rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
}

.song-request-queue-summary::-webkit-details-marker {
    display: none;
}

/* Chevron that flips when expanded */
.song-request-queue-summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}

.song-request-queue[open] .song-request-queue-summary::after {
    transform: rotate(-135deg) translateY(-2px);
}

.song-request-queue-summary:focus-visible {
    outline: 2px solid #D4AF37;
    outline-offset: -2px;
}

.song-request-queue-list {
    list-style: none;
    margin: 0;
    padding: 0 0.85rem;
    max-height: 32vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-top: 1px solid #e0e0e0;
}

.song-request-queue-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 52px;
    padding: 0.35rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.song-request-queue-item:last-child {
    border-bottom: none;
}

.song-request-queue-item .song-request-cover {
    width: 32px;
    height: 32px;
}

.song-request-queue-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.song-request-queue-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-request-queue-progress {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
}

.song-request-remove {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #000;
    border: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* 44px tap target without growing the row */
.song-request-remove {
    position: relative;
}

.song-request-remove::after {
    content: '';
    position: absolute;
    inset: -4px;
}

.song-request-remove:hover {
    border-color: #000;
}

.song-request-remove:focus-visible {
    outline: 2px solid #D4AF37;
    outline-offset: 2px;
}

/* Inline confirmation shown in the drawer (phones use a toast since the sheet closes) */
.song-request-status {
    flex-shrink: 0;
    margin: 0 0 0.75rem;
    padding: 0.6rem 0.85rem;
    border-left: 4px solid #1DB954;
    background: #f3f3f3;
    color: #000;
    font-size: 0.9rem;
    font-weight: 700;
}

.song-request-status[data-tone="warn"] {
    border-left-color: #FFA500;
}

.song-request-status[hidden] {
    display: none;
}

.song-request-badge[hidden] {
    display: none;
}

/* Hide the fixed back button (z-index 10000) while the modal is open */
body.song-request-open {
    overflow: hidden;
}

body.song-request-open #back-button {
    visibility: hidden !important;
}

/* Modal overlay */
.song-request-modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.song-request-modal.show {
    opacity: 1;
    visibility: visible;
    /* Flip visibility instantly on open so the search input can take focus */
    transition: opacity 0.3s ease, visibility 0s;
}

.song-request-content {
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #000;
    border-radius: 0;
    padding: 2rem 2rem 0;
    max-width: 600px;
    width: 90%;
    height: 85vh;
    max-height: 760px;
    box-shadow: 0 0 0 2px #000, 0 10px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    margin: 0 auto;
    overflow: hidden;
}

.song-request-modal.show .song-request-content {
    animation: songRequestSlideUp 0.3s ease;
}

@keyframes songRequestSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.song-request-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.song-request-heading {
    margin: 0;
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #000;
}

.song-request-close {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #000;
    border: 2px solid #000;
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.song-request-close:hover {
    background: #000;
    color: #fff;
}

.song-request-subtitle {
    color: #666;
    font-size: 1rem;
    font-weight: 300;
    margin: 0 0 1.25rem;
}

.song-request-search-wrap {
    flex-shrink: 0;
    padding-bottom: 0.75rem;
}

.song-request-search {
    width: 100%;
    padding: 0.85rem 1.1rem;
    border: 2px solid #000;
    border-radius: 0;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    background: #fff;
    color: #000;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.song-request-search::placeholder {
    color: #999;
    font-weight: 400;
}

.song-request-search:focus {
    outline: none;
    border-color: #000;
    background: #f8f8f8;
    box-shadow: 0 4px 0 #000;
}

/* Scrolling list */
.song-request-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    margin: 0 -2rem;
    padding: 0 2rem 1.5rem;
}

.song-request-group[hidden],
.song-request-row[hidden],
.song-request-empty[hidden] {
    display: none !important;
}

.song-request-group-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0 0.6rem;
    background: #fff;
    border-bottom: 2px solid #000;
}

.song-request-cover {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    object-fit: cover;
    border: 1px solid #000;
    background: #f0f0f0;
}

.song-request-album-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.song-request-album-name {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-request-album-year {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
}

.song-request-rows {
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
}

.song-request-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 52px;
    padding: 0.4rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.song-request-row:last-child {
    border-bottom: none;
}

.song-request-title {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #000;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.song-request-action {
    flex-shrink: 0;
    min-width: 108px;
    min-height: 38px;
    padding: 0 1rem;
    background: #000;
    color: #fff;
    border: 2px solid #000;
    border-radius: 0;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.song-request-action:hover:not(:disabled) {
    background: #222;
    transform: translateY(-2px);
    box-shadow: 0 4px 0 #666;
}

.song-request-action:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.song-request-action:disabled {
    cursor: default;
    transform: none;
    box-shadow: none;
}

.song-request-action.is-queued {
    background: #fff;
    color: #000;
    border-color: #000;
}

.song-request-action.is-full {
    background: #fff;
    color: #999;
    border-color: #ccc;
}

.song-request-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #666;
    font-size: 1rem;
    font-weight: 300;
}

/* Phones: near full-screen sheet */
@media (max-width: 540px) {
    .song-request-modal {
        align-items: stretch;
        padding: 12px;
    }

    .song-request-content {
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: none;
        padding: 1.25rem 1rem 0;
    }

    .song-request-heading {
        font-size: 1.5rem;
    }

    .song-request-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    /* 16px prevents iOS zoom on focus */
    .song-request-search {
        font-size: 16px;
        min-height: 48px;
    }

    .song-request-list {
        margin: 0 -1rem;
        padding: 0 1rem 1.5rem;
    }

    .song-request-row {
        min-height: 56px;
    }

    .song-request-action {
        min-height: 44px;
        min-width: 104px;
        padding: 0 0.85rem;
    }
}

/* Tablets and desktop: right-side drawer over a lighter backdrop so the matchup stays in view */
@media (min-width: 541px) {
    .song-request-modal {
        justify-content: flex-end;
        align-items: stretch;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .song-request-content {
        width: min(440px, 78vw);
        height: 100%;
        max-height: none;
        margin: 0;
        box-shadow: -2px 0 0 #000, -12px 0 40px rgba(0, 0, 0, 0.3);
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .song-request-modal.show .song-request-content {
        transform: translateX(0);
        animation: none;
    }

    .song-request-heading {
        font-size: 1.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .song-request-modal,
    .song-request-content,
    #song-request-btn,
    .song-request-action {
        transition: none;
    }

    .song-request-modal.show .song-request-content {
        animation: none;
    }
}

/* Dark mode */
.dark-mode #song-request-btn {
    border-color: #666;
    color: #b0b0b0;
}

.dark-mode #song-request-btn:hover {
    border-color: #888;
    color: #e0e0e0;
}

.dark-mode .song-request-badge {
    background: #fff;
    color: #000;
    border-color: #1a1a1a;
}

.dark-mode .song-request-status {
    background: #151515;
    color: #fff;
}

.dark-mode .song-request-content {
    background: #000;
    color: #fff;
    box-shadow: 0 0 0 2px #fff, 0 10px 50px rgba(255, 255, 255, 0.1);
}

@media (min-width: 541px) {
    .dark-mode .song-request-content {
        box-shadow: -2px 0 0 #fff, -12px 0 40px rgba(0, 0, 0, 0.6);
    }
}

.dark-mode .song-request-heading {
    color: #fff;
}

.dark-mode .song-request-close {
    background: #000;
    color: #fff;
    border-color: #fff;
}

.dark-mode .song-request-close:hover {
    background: #fff;
    color: #000;
}

.dark-mode .song-request-subtitle {
    color: #999;
}

.dark-mode .song-request-search {
    background: #000;
    color: #fff;
    border-color: #fff;
}

.dark-mode .song-request-search::placeholder {
    color: #777;
}

.dark-mode .song-request-search:focus {
    background: #111;
    border-color: #fff;
    box-shadow: 0 4px 0 #fff;
}

.dark-mode .song-request-group-header {
    background: #000;
    border-bottom-color: #fff;
}

.dark-mode .song-request-cover {
    border-color: #444;
    background: #2a2a2a;
}

.dark-mode .song-request-album-name {
    color: #fff;
}

.dark-mode .song-request-album-year {
    color: #999;
}

.dark-mode .song-request-row {
    border-bottom-color: #333;
}

.dark-mode .song-request-title {
    color: #e0e0e0;
}

.dark-mode .song-request-action {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.dark-mode .song-request-action:hover:not(:disabled) {
    background: #f0f0f0;
    box-shadow: 0 4px 0 #999;
}

.dark-mode .song-request-action.is-queued {
    background: #000;
    color: #fff;
    border-color: #fff;
}

.dark-mode .song-request-action.is-full {
    background: #000;
    color: #666;
    border-color: #444;
}

.dark-mode .song-request-empty {
    color: #999;
}

.dark-mode .song-request-queue {
    border-color: #fff;
}

.dark-mode .song-request-queue-summary {
    color: #fff;
}

.dark-mode .song-request-queue-list {
    border-top-color: #333;
}

.dark-mode .song-request-queue-item {
    border-bottom-color: #333;
}

.dark-mode .song-request-queue-title {
    color: #fff;
}

.dark-mode .song-request-queue-progress {
    color: #999;
}

.dark-mode .song-request-remove {
    color: #fff;
}

.dark-mode .song-request-remove:hover {
    border-color: #fff;
}
