/* HomeEnhanced Component Styles */
.home-enhanced {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Enhanced Glass Effect for Header and Footer on Home Page */
.home-enhanced .main > .main_header {
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(25px) saturate(180%) contrast(1.1) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) contrast(1.1) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1) !important;
}

.home-enhanced .main > .main_footer {
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(25px) saturate(180%) contrast(1.1) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) contrast(1.1) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 -2px 20px rgba(0,0,0,0.1) !important;
}

/* Enhanced Glass Effect for Sidebar on Home Page */
/* Use :has() to detect when Home is mounted (works in modern Safari/Chromium) */
.interface:has(.home-enhanced) .sidenav > .sidenav_wrapper {
    /* Increase translucency to ~20% for pronounced glass on Home */
    background: rgba(255, 255, 255, 0.20) !important;
    backdrop-filter: blur(28px) saturate(180%) contrast(1.18) !important;
    -webkit-backdrop-filter: blur(28px) saturate(180%) contrast(1.18) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.18) !important;
}

.interface:has(.home-enhanced) .sidenav > .sidenav_wrapper > .sidenav_header {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
}

/* Dark theme adjustments for glass effect */
html.dark .home-enhanced .main > .main_header {
    background: rgba(0, 0, 0, 0.15) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html.dark .home-enhanced .main > .main_footer {
    background: rgba(0, 0, 0, 0.15) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html.dark .interface:has(.home-enhanced) .sidenav > .sidenav_wrapper {
    /* Dark theme glass at ~20% for consistency */
    background: rgba(0, 0, 0, 0.20) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.10) !important;
}

html.dark .interface:has(.home-enhanced) .sidenav > .sidenav_wrapper > .sidenav_header {
    background: rgba(0, 0, 0, 0.08) !important;
}

/* Let the Home page background bleed beneath sidebar by removing opaque app backgrounds */
/* Important: target ancestors themselves with :has(), not descendants */
.music-app:has(.home-enhanced),
.interface:has(.home-enhanced),
.interface-content:has(.home-enhanced),
.main:has(.home-enhanced),
.main:has(.home-enhanced) > .main_content {
    background-color: transparent !important;
}

/* Loading State */
.home-enhanced.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.loading-spinner {
    text-align: center;
    color: var(--text-primary, #fff);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Background */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -10;
    overflow: hidden;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    transform: scale(1.1); /* Scale to ensure full coverage under sidebar */
}

.background-image.active {
    opacity: 1;
}

.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.6) 50%,
        rgba(0, 0, 0, 0.8) 100%
    );
}

/* Content */
.content-container {
    position: relative;
    z-index: 1;
    padding: 20px;
    color: white;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 100vh;
    padding-bottom: 120px; /* Extra padding to ensure content can scroll past footer */
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 60px;
}

.welcome-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-section p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
    font-style: italic;
}

/* Quick Access */
.quick-access {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.quick-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.quick-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.quick-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

.section-description {
    font-size: 1rem;
    opacity: 0.8;
    margin: -10px 0 20px 0;
    color: white;
}

/* Discover Preview Section */
.discover-preview-section {
    margin-bottom: 40px;
}

.discover-preview-section .section-header h2 {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    animation: gradientShift 3s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.9rem;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-mix-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 16px;
    backdrop-filter: blur(10px);
}

.skeleton-mix-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 14px;
    margin-bottom: 12px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text-small {
    height: 12px;
    width: 70%;
    border-radius: 4px;
}

.skeleton-track-card {
    flex: 0 0 160px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 12px;
    backdrop-filter: blur(10px);
}

.skeleton-track-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    margin-bottom: 8px;
}

.see-all-button,
.refresh-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.see-all-button:hover,
.refresh-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Daily Mixes */
.daily-mixes-section {
    margin-bottom: 40px;
}

.daily-mixes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 16px;
}

.mix-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.mix-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
}

.mix-image {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 12px;
    aspect-ratio: 1;
}

.mix-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mix-card:hover .play-overlay {
    opacity: 1;
}

.play-icon {
    font-size: 2rem;
    color: white;
}

.mix-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.mix-info p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin: 0;
}

.mix-hint {
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.7;
    margin: 0;
}

/* Horizontal Scrolling Sections */
.horizontal-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

.horizontal-scroll::-webkit-scrollbar {
    height: 6px;
}

.horizontal-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.horizontal-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.track-card,
.recommendation-card {
    flex: 0 0 180px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Fallback for browsers without backdrop-filter support */
    background-color: rgba(0, 0, 0, 0.3);
}

/* Modern browsers with backdrop-filter support */
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
    .track-card,
    .recommendation-card {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

.track-card:hover,
.recommendation-card:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.track-card:hover .track-info h4,
.recommendation-card:hover .track-info h4 {
    color: rgba(255, 255, 255, 1);
}

.track-card:hover .track-info p,
.recommendation-card:hover .track-info p {
    opacity: 0.95;
}

.track-image {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    aspect-ratio: 1;
}

.track-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
}

.track-info p {
    font-size: 0.85rem;
    opacity: 0.85;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
}

.track-info .reason {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 6px;
    display: block;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    font-style: italic;
}

/* Mix Queue Overlay */
.mix-queue-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.mix-queue-modal {
    background: var(--bg-secondary, #2a2a2a);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    color: white;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.queue-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.close-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.queue-tracks {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.queue-track {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.queue-track:last-child {
    border-bottom: none;
}

.track-number {
    font-size: 0.9rem;
    opacity: 0.6;
    min-width: 20px;
}

.queue-track img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
}

.track-details {
    flex: 1;
    min-width: 0;
}

.track-name {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-more {
    text-align: center;
    padding: 16px;
    opacity: 0.6;
    font-size: 0.9rem;
}

.queue-actions {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.play-queue-button {
    width: 100%;
    background: var(--accent-color, #007bff);
    border: none;
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
    position: relative;
}

.play-queue-button:hover:not(:disabled) {
    background: var(--accent-hover, #0056b3);
}

.play-queue-button:disabled {
    background: var(--accent-disabled, #6c757d);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Responsive Design */
/* iPad specific optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .quick-access {
        grid-template-columns: repeat(4, 1fr);
        max-width: 800px;
        gap: 20px;
    }
    
    .quick-button {
        padding: 18px 14px;
    }
    
    .daily-mixes {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

@media (max-width: 768px) {
    .content-container {
        padding: 16px;
    }
    
    .welcome-section {
        padding-top: 40px;
        margin-bottom: 30px;
    }
    
    .welcome-section h1 {
        font-size: 2rem;
    }
    
    .quick-access {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .quick-button {
        padding: 16px 12px;
    }
    
    .daily-mixes {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .track-card,
    .recommendation-card {
        flex: 0 0 160px;
    }
    
    .track-info h4 {
        font-size: 0.9rem;
    }
    
    .track-info p {
        font-size: 0.8rem;
    }
    
    .mix-queue-modal {
        margin: 0;
        max-height: 90vh;
    }
}

/* iOS Scroll Fix */
.horizontal-scroll {
    -webkit-overflow-scrolling: touch;
    transform: translate3d(0, 0, 0);
}

/* Smooth scrolling for the entire component */
.home-enhanced {
    -webkit-overflow-scrolling: touch;
    transform: translate3d(0, 0, 0);
    /* Prevent layout shifts during scroll */
    contain: layout style;
    overscroll-behavior: none;
}

/* Remove snap scrolling and improve momentum */
* {
    scroll-snap-type: none !important;
}

.content-container {
    overscroll-behavior: none;
}

/* Themed Mixes Section */
.themed-mixes-section {
    margin-bottom: 48px;
}

.themed-mixes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 16px;
}

.themed-mix-card {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.themed-mix-card:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.themed-mix-card .mix-image {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 14px;
    aspect-ratio: 1;
}

.theme-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

.themed-mix-card .mix-info h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--text-primary, #fff);
}

.themed-mix-card .mix-info p {
    font-size: 0.85rem;
    opacity: 0.85;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.track-count {
    font-size: 0.75rem;
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.no-themed-mixes {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.no-themed-mixes p {
    margin: 0 0 16px 0;
    opacity: 0.8;
}

.retry-button {
    background: var(--brand-color, #1db954);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.retry-button:hover {
    background: var(--brand-color-hover, #1ed760);
}

.mix-indicator {
    font-size: 0.85rem;
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
}

/* Mobile responsive for themed mixes */
@media (max-width: 768px) {
    .themed-mixes {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
    }
    
    .themed-mix-card {
        padding: 16px;
    }
    
    .themed-mix-card .mix-info h3 {
        font-size: 1.05rem;
    }
}
