/* === RESPONSIVE SIDEBAR RESTRUCTURE === */
/* Desktop (>=1024px): overlay glass sidebar */
@media (min-width:1024px){
    .interface:has(.home-enhanced-v2) .sidenav{flex-basis:0!important;}
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper{position:fixed!important;top:0!important;left:0!important;z-index:4!important;width:200px!important;height:100vh!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;transition:transform .3s ease!important;transform:translateX(0)!important;background:rgba(255,255,255,.12)!important;backdrop-filter:blur(30px)saturate(180%)contrast(1.2)!important;-webkit-backdrop-filter:blur(30px)saturate(180%)contrast(1.2)!important;border:none!important;}
    html.dark .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper{background:rgba(0,0,0,.12)!important;}
    .home-enhanced-v2{padding-left:220px!important;}
    /* Toggle states limited to desktop so mobile can use native behavior */
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper.closed{transform:translateX(-200px)!important;}
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper.active,
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper:not(.closed){transform:translateX(0)!important;}
    /* Desktop-only header/footer glass styling */
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper > .sidenav_header,
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper > .sidenav_footer{backdrop-filter:blur(20px)!important;-webkit-backdrop-filter:blur(20px)!important;}
}

/* Tablet (769px–1023px): inline sidebar, no overlay */
@media (min-width:769px) and (max-width:1023px){
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper{position:relative!important;background:rgba(255,255,255,.06)!important;backdrop-filter:blur(12px)!important;-webkit-backdrop-filter:blur(12px)!important;border-right:1px solid rgba(255,255,255,.1)!important;transform:none!important;}
    html.dark .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper{background:rgba(0,0,0,.08)!important;}
    .home-enhanced-v2{padding-left:200px!important;}
}

/* Mobile (<=768px): native Jellyfin sidebar (hidden by default) + compact home */
@media (max-width:768px){
    /* Remove overlay assumptions */
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper{position:relative!important;top:auto!important;left:auto!important;width:100%!important;height:auto!important;transform:none!important;background:var(--theme-primary-bg,#111)!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;box-shadow:none!important;}
    /* Do NOT force transform open/closed rules on mobile */
    .home-enhanced-v2{padding:1.25rem 1rem 110px!important;margin:0!important;width:100%!important;max-width:100%!important;min-height:100vh!important;box-sizing:border-box!important;}
    /* Compact layout adjustments */
    .featured-grid{grid-template-columns:1fr!important;gap:1rem!important;}
    .three-column-sections{flex-direction:column!important;gap:1.25rem!important;}
    .vertical-track-section{min-height:auto!important;backdrop-filter:none!important;background:rgba(255,255,255,0.04)!important;}
    .quick-actions{flex-wrap:wrap!important;gap:.75rem!important;}
    .quick-action-btn{flex:1 1 48%!important;min-width:140px!important;}
    .home-header h1{font-size:2.1rem!important;line-height:1.15!important;}
    .interface:has(.home-enhanced-v2) .main{margin-left:0!important;width:100%!important;}
}

/* Header styling for overlay */
@media (min-width:1024px){
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper > .sidenav_header{background:rgba(255,255,255,.05)!important;backdrop-filter:blur(20px)!important;-webkit-backdrop-filter:blur(20px)!important;padding:12px 20px!important;min-height:auto!important;flex-shrink:0!important;}
}

/* Hide the logo in the sidebar header on home page */
.interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper > .sidenav_header > .logo {
    display: none !important;
}

/* Sidebar content should be scrollable and take available space */
@media (min-width:1024px){
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper > .sidenav_content{flex:1!important;overflow-y:auto!important;overflow-x:hidden!important;padding:8px 0!important;margin:0!important;min-height:0!important;}
}

/* Ensure nav links are properly spaced and visible */
@media (min-width:1024px){
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper > .sidenav_content a{padding:8px 20px!important;margin:2px 0!important;display:block!important;}
}

/* Sidebar footer should be visible and properly positioned */
@media (min-width:1024px){
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper > .sidenav_footer{flex-shrink:0!important;background:rgba(255,255,255,.08)!important;backdrop-filter:blur(20px)!important;-webkit-backdrop-filter:blur(20px)!important;border-top:1px solid rgba(255,255,255,.1)!important;border-left:none!important;border-right:none!important;border-bottom:none!important;padding:12px 16px 16px!important;margin:0!important;min-height:auto!important;}
}

@media (min-width:1024px){html.dark .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper > .sidenav_header{background:rgba(0,0,0,.05)!important;}}

@media (min-width:1024px){html.dark .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper > .sidenav_footer{background:rgba(0,0,0,.08)!important;border-top:1px solid rgba(255,255,255,.08)!important;border-left:none!important;border-right:none!important;border-bottom:none!important;}}

/* Main content should extend full width since sidebar is overlay */
@media (min-width:1024px){
    .interface:has(.home-enhanced-v2) .main{margin-left:0!important;width:100vw!important;max-width:100vw!important;}
}

/* Sidebar toggle states for all devices */
/* (desktop toggle rules moved earlier; removed globally to prevent mobile persistence) */

/* Let the Home page background extend under the overlay sidebar */
.music-app:has(.home-enhanced-v2),
.interface:has(.home-enhanced-v2),
.interface-content:has(.home-enhanced-v2),
.main:has(.home-enhanced-v2) {
    background: transparent !important;
}

/* Fix mini player footer positioning and visibility */
@media (min-width:1024px){
    .interface:has(.home-enhanced-v2) .main > .main_footer{position:fixed!important;bottom:0!important;left:0!important;right:0!important;width:100vw!important;max-width:100vw!important;z-index:5!important;background:rgba(255,255,255,.1)!important;backdrop-filter:blur(25px)saturate(160%)contrast(1.1)!important;-webkit-backdrop-filter:blur(25px)saturate(160%)contrast(1.1)!important;border-top:1px solid rgba(255,255,255,.15)!important;}
}

/* Dark theme footer */
@media (min-width:1024px){html.dark .interface:has(.home-enhanced-v2) .main > .main_footer{background:rgba(0,0,0,.1)!important;border-top:1px solid rgba(255,255,255,.1)!important;}}

/* Ensure footer content is properly spaced */
@media (min-width:1024px){
    .interface:has(.home-enhanced-v2) .main > .main_footer > .playback > .container{padding:.75rem 1rem!important;max-width:100vw!important;}
}

/* Ensure content can extend to full viewport width */
@media (min-width:1024px){
    .interface:has(.home-enhanced-v2) .interface-content{margin-left:0!important;width:100vw!important;max-width:100vw!important;}
}

/* Make sure the entire interface uses full width */
@media (min-width:1024px){
    .interface:has(.home-enhanced-v2){width:100vw!important;max-width:100vw!important;}
}

/* Base (mobile-first) home layout */
.home-enhanced-v2{position:relative;min-height:100vh;width:100%;max-width:100%;padding:1.25rem 1rem 110px;background:transparent;overflow-x:hidden;box-sizing:border-box;}
@media (min-width:769px){.home-enhanced-v2{padding:2rem 2rem 120px 200px;}}
@media (min-width:1024px){.home-enhanced-v2{padding:2rem 2rem 120px 220px;transition:padding-left .3s cubic-bezier(.4,0,.2,1);}}

/* When sidebar is closed, reduce left padding */
@media (min-width:1024px){.interface:has(.sidenav > .sidenav_wrapper.closed) .home-enhanced-v2{padding-left:2rem;}}

/* Background Image System */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw; /* Full viewport width */
    height: 150vh; /* Extended height to cover all content */
    z-index: -10;
    overflow: hidden;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw; /* Full viewport width */
    height: 150vh; /* Match container height */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    transform: scale(1.0); /* Remove scale to prevent quality loss */
    filter: none; /* Remove any filters that might affect quality */
    image-rendering: -webkit-optimize-contrast; /* Better image rendering */
    image-rendering: crisp-edges;
}

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

.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw; /* Full viewport width */
    height: 100vh;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.1) 20%,
        rgba(0, 0, 0, 0.05) 40%,
        rgba(0, 0, 0, 0.1) 60%,
        rgba(0, 0, 0, 0.3) 80%,
        rgba(0, 0, 0, 0.5) 100%
    );
}enhanced-v2 {
    padding: 2rem;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    min-height: 100vh;
    color: white;
}

/* Header Section */
.home-header {
    margin-bottom: 3rem;
}

.home-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.home-header p {
    font-size: 1.2rem;
    color: #888;
    margin: 0;
}

/* Featured Playlists Grid */
.featured-section {
    margin-bottom: 3rem;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.featured-playlist-card {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 1rem;
    padding: 2rem;
    min-height: 200px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.featured-playlist-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.playlist-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex: 1;
}

.playlist-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: white;
}

.playlist-info p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 1rem 0;
}

.artist-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.playlist-visual {
    flex-shrink: 0;
    margin-left: 1rem;
}

.artist-image, .playlist-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.playlist-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.play-button {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
}

.featured-playlist-card:hover .play-button {
    opacity: 1;
}

.play-button:hover {
    background: white;
    transform: scale(1.1);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
    z-index: 1;
    position: relative;
}

/* Quick Online Search */
.quick-search {
    display: flex;
    justify-content: center;
    margin: 0 0 1.5rem 0;
}

.quick-search-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.12);
}

.quick-search-input {
    width: min(72vw, 420px);
    background: transparent;
    color: #fff;
    border: none;
    outline: none;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
}

.quick-search-input::placeholder {
    color: rgba(255,255,255,0.6);
}

.quick-search-button {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #0b0b0b;
    font-weight: 700;
    border: none;
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .quick-search-container { width: 100%; }
    .quick-search-input { width: 100%; }
}

/* Artist Banner - Single Wide Image Rotating */
.artist-banner-single {
    margin: 2rem 0;
    overflow: hidden;
    height: 200px;
    position: relative;
    z-index: 1;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.artist-banner-wide {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 16px;
    transition: opacity 1s ease-in-out;
    position: relative;
}

.artist-banner-wide::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.3) 100%
    );
    border-radius: 16px;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-radius: 2rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.shuffle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.discover-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Three Column Layout */
.three-column-sections {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 3rem;
    width: 100%;
}

.vertical-track-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 1rem;
    backdrop-filter: blur(10px);
    flex: 1;
    min-width: 0; /* Prevents overflow */
    min-height: 400px; /* Ensure enough space for 5 tracks */
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.see-all-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    transition: color 0.2s ease;
}

.see-all-btn:hover {
    color: white;
}

.vertical-track-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Slightly more gap for better spacing */
    flex: 1; /* Take up remaining space */
    justify-content: flex-start;
}

.vertical-track-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.5rem; /* Slightly more vertical padding */
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 56px; /* Ensure consistent height */
}

.vertical-track-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.track-number {
    font-size: 0.85rem;
    color: #888;
    width: 16px;
    text-align: center;
    font-weight: 600;
    flex-shrink: 0;
}

.track-image {
    width: 40px;
    height: 40px;
    border-radius: 0.4rem;
    overflow: hidden;
    flex-shrink: 0;
}

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

.default-image {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
}

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

.track-name {
    font-weight: 600;
    color: white;
    margin-bottom: 0.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.track-artist {
    font-size: 0.8rem;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-play-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.vertical-track-item:hover .track-play-btn {
    opacity: 1;
}

.track-play-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .home-enhanced-v2 {
        padding: 1rem;
        padding-left: 1rem; /* Mobile doesn't need sidebar padding */
    }
    
    /* On mobile, let the default Jellyfin hamburger menu behavior control sidebar */
    /* Don't override the sidebar behavior - let it work normally */
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper {
        /* Remove forced positioning - let mobile behavior work naturally */
        position: static !important; /* Use default mobile positioning */
        transform: none !important; /* Let Jellyfin handle the transforms */
        width: auto !important; /* Use default mobile width */
        height: auto !important; /* Use default mobile height */
    }
    
    /* Remove glass effects on mobile for better performance */
    .interface:has(.home-enhanced-v2) .sidenav > .sidenav_wrapper {
        background: var(--theme-primary-bg) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    .home-header h1 {
        font-size: 2rem;
    }
    
    .featured-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .featured-playlist-card {
        padding: 1.5rem;
        min-height: 150px;
    }
    
    .three-column-sections {
        flex-direction: column;
        gap: 1rem;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-action-btn {
        justify-content: center;
    }
}

/* iPad-specific fixes for content visibility */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
    .home-enhanced-v2 {
        min-height: calc(100vh + 200px); /* Ensure content extends beyond viewport */
        padding-bottom: 4rem; /* Extra bottom padding for iPad */
    }
    
    .three-column-sections {
        margin-bottom: 4rem; /* Extra margin for iPad scrolling */
    }
    
    .vertical-track-section {
        min-height: 450px; /* Ensure all 5 tracks are visible on iPad */
    }
    
    /* Ensure background extends for iPad scrolling */
    .background-container {
        height: calc(100vh + 300px); /* Extended for iPad */
    }
    
    .background-image {
        height: calc(100vh + 300px); /* Match container */
    }
}

/* End of styles */
