/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.loading-content {
    text-align: center;
    padding: 40px;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-primary);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loading-overlay.hidden .loading-content {
    transform: scale(0.9);
}

.loading-overlay:not(.hidden) .loading-content {
    transform: scale(1);
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--accent-shadow);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-content p {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
}

/* Search Results */
.search-results {
    margin-bottom: 0;
    padding-bottom: 100px;
    transition: padding-bottom 0.3s ease;
}

.search-results.no-player-padding {
    padding-bottom: 0;
}

/* Results Header */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.results-count {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Results Wrapper */
.results-wrapper {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.results-nav-btn {
    position: relative;
    z-index: 10;
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: var(--accent-primary);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--accent-shadow);
    flex-shrink: 0;
}

.results-nav-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 16px var(--accent-shadow);
}

.results-nav-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.results-nav-btn:disabled {
    background: var(--bg-active);
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

.results-nav-btn svg {
    width: 24px;
    height: 24px;
}

/* Results Grid - Desktop */
.results-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: auto;
    grid-auto-flow: row;
    gap: 18px;
    flex: 1;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
    padding-bottom: 0;
    margin-bottom: 0;
    opacity: 1;
    transition: opacity 0.4s ease;
    width: 100%;
}

/* Large Desktop: 1440px and up - 6 columns with horizontal scroll */
@media (min-width: 1440px) {
    .results-grid {
        grid-template-columns: repeat(6, minmax(180px, 1fr));
        grid-template-rows: repeat(2, 1fr);
        grid-auto-flow: column;
        gap: 20px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        padding-bottom: 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .results-grid::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }
}

/* Result Card */
.result-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    opacity: 1;
    transform: translateY(0);
}

.result-card:hover {
    background: var(--bg-hover);
    transform: translateY(-4px) !important;
}

.album-art-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 0;
    padding-bottom: 100%;
    margin: 0 auto 12px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-active);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.album-art {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.result-card:hover .album-art-wrapper {
    transform: scale(1.05);
    box-shadow: 0 12px 32px var(--shadow-md);
}

.result-card:hover .album-art {
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.album-art-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
    border-radius: 50%;
    z-index: 1;
}

.result-card:hover .album-art-overlay {
    opacity: 1;
}

.artist-name-overlay {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    padding: 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.play-button {
    width: 44px;
    height: 44px;
    background: var(--accent-primary);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px var(--shadow-md);
    flex-shrink: 0;
}

.play-button:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--accent-shadow);
}

.album-title-bg {
    padding: 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: break-word;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Color variations for album title backgrounds */
.album-title-bg.color-1 { background: #FFD700; color: #000000; }
.album-title-bg.color-2 { background: #4169E1; }
.album-title-bg.color-3 { background: #FF69B4; }
.album-title-bg.color-4 { background: #9370DB; }
.album-title-bg.color-5 { background: #FF8C00; }
.album-title-bg.color-6 { background: #87CEEB; }
