:root {
    --bg-base: #041c1d;    /* Darker shade of #08383a for main background */
    --bg-surface: #08383a; /* The requested base color, used for surfaces/panels */
    --bg-elevated: #0a4a4d;
    --bg-highlight: #0d5e62;
    
    --text-primary: #ffffff;
    --text-secondary: #b0c9ca;
    
    --accent: #1ef0e8; /* Electric bright cyan for progress bars and active states */
    
    --sidebar-width: 240px;
    --player-height: 90px;
    
    --font-family: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden; /* App-like feel */
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 1fr var(--player-height);
    height: 100vh;
    height: 100dvh; /* Support for iOS Safari dynamic height */
    width: 100vw;
}

/* Sidebar */
.sidebar {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    background-color: #000000; /* Very deep dark for Spotify feel */
    display: flex;
    flex-direction: column;
    padding: 24px 12px;
    height: calc(100vh - var(--player-height));
    height: calc(100dvh - var(--player-height));
    z-index: 10;
}

.logo-container {
    padding: 0 12px 24px;
}

.brand-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.sidebar-nav {
    margin-bottom: 24px;
}

.nav-links {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.nav-item ion-icon {
    font-size: 24px;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
}

.divider {
    height: 1px;
    background-color: #282828;
    margin: 8px 12px;
}

.playlists {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.playlists h3 {
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    margin-top: 8px;
}

.playlist-list {
    list-style: none;
}

.playlist-list li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.playlist-list li:not(.text-muted):hover {
    color: var(--text-primary);
}

.text-muted {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Content Area */
.main-view {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    background: linear-gradient(to bottom, var(--bg-surface) 0%, var(--bg-base) 100%);
    position: relative;
    height: calc(100vh - var(--player-height));
    height: calc(100dvh - var(--player-height));
    overflow: hidden;
}

.top-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: transparent; /* Becomes solid on scroll via JS ideally */
    z-index: 20;
}

.nav-arrows {
    display: flex;
    gap: 16px;
}

.nav-btn {
    background-color: rgba(0,0,0,0.5);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-btn:hover {
    background-color: rgba(0,0,0,0.8);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(0,0,0,0.5);
    padding: 4px 16px 4px 4px;
    border-radius: 32px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-profile ion-icon {
    font-size: 28px;
}

.user-profile:hover {
    background-color: rgba(0,0,0,0.8);
}

.content-scrollable {
    height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.content-scrollable::-webkit-scrollbar {
    width: 12px;
}
.content-scrollable::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.3);
}

/* Album Hero Section */
.album-hero {
    padding: 84px 32px 24px;
    display: flex;
    align-items: flex-end;
    gap: 24px;
    background: linear-gradient(transparent 0%, rgba(0,0,0,0.3) 100%);
}

.album-cover-container {
    width: 232px;
    height: 232px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

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

.album-info {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.album-info .type {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.album-title {
    font-size: 80px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 16px;
    letter-spacing: -2px;
}

.album-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.album-meta {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.album-meta .brand-name {
    font-weight: 700;
}

/* Action Bar */
.action-bar {
    padding: 24px 32px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.btn-play-large {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--accent);
    color: #000;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s ease;
    box-shadow: 0 8px 8px rgba(0,0,0,0.3);
}

.btn-play-large:hover {
    transform: scale(1.05);
    background-color: #3ef2eb; /* slightly lighter */
}

.btn-play-large:active {
    transform: scale(1);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--text-primary);
}

/* Track List */
.track-list-container {
    padding: 0 32px 32px;
}

.track-list-header {
    display: grid;
    grid-template-columns: 48px minmax(200px, 1fr) minmax(150px, 0.8fr) minmax(60px, 0.2fr);
    padding: 0 16px;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.divider-line {
    height: 1px;
    background-color: rgba(255,255,255,0.1);
    margin-bottom: 16px;
}

.track-row {
    display: grid;
    grid-template-columns: 48px minmax(200px, 1fr) minmax(150px, 0.8fr) minmax(60px, 0.2fr);
    padding: 12px 16px;
    border-radius: 4px;
    align-items: center;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.track-row:hover {
    background-color: rgba(255,255,255,0.1);
}

.track-row:hover .index-number {
    display: none;
}

.track-row:hover .index-play-icon {
    display: block;
}

.col-index {
    position: relative;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.index-play-icon {
    display: none;
    color: var(--text-primary);
    font-size: 16px;
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
}

.playing-gif {
    display: none;
    height: 14px;
    width: 14px;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    align-items: flex-end;
    gap: 2px;
}

.playing-gif .bar {
    width: 3px;
    background-color: var(--accent);
    animation: bounce 1.2s infinite ease-in-out;
}
.playing-gif .bar:nth-child(1) { height: 60%; animation-delay: -0.2s; }
.playing-gif .bar:nth-child(2) { height: 100%; animation-delay: -0.4s; }
.playing-gif .bar:nth-child(3) { height: 80%; animation-delay: -0.6s; }

@keyframes bounce {
    0%, 100% { height: 2px; }
    50% { height: 14px; }
}

.track-row.playing .index-number, .track-row.playing .index-play-icon {
    display: none !important;
}

.track-row.playing .playing-gif {
    display: flex;
}

.track-row.playing .track-name {
    color: var(--accent);
}

.track-title-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.track-name {
    font-weight: 500;
    font-size: 16px;
    color: var(--text-primary);
}

.track-artist {
    font-size: 14px;
    color: var(--text-secondary);
}

.col-album {
    color: var(--text-secondary);
    font-size: 14px;
}

.col-time {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Bottom Player Bar */
.player-bar {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    background-color: #000;
    border-top: 1px solid #282828;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    padding-bottom: env(safe-area-inset-bottom); /* Fix for iPhone home bar */
    z-index: 30;
}

/* Left: Now Playing */
.player-left {
    width: 30%;
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.now-playing-img {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    object-fit: cover;
}

.now-playing-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.now-playing-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-playing-artist {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-icon-small {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    margin-left: 8px;
}
.btn-icon-small:hover { color: var(--text-primary); }

/* Center: Controls */
.player-center {
    width: 40%;
    max-width: 722px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

.btn-control {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.1s;
}

.btn-control:hover {
    color: var(--text-primary);
}

.btn-play-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--text-primary);
    color: #000;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.btn-play-circle:hover {
    transform: scale(1.1);
}

.btn-play-circle:active {
    transform: scale(1);
}

.player-timeline {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.progress-bar-container {
    flex: 1;
    height: 12px; /* Active area */
    display: flex;
    align-items: center;
    cursor: pointer;
}

.progress-bar-container .progress-bar-bg {
    width: 100%;
    height: 4px;
    background-color: rgba(255,255,255,0.3);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.progress-bar-container:hover .progress-bar-bg {
    overflow: visible;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--text-primary);
    border-radius: 2px;
    width: 0%;
}

.progress-bar-container:hover .progress-bar-fill {
    background-color: var(--accent);
}

.progress-bar-thumb {
    width: 12px;
    height: 12px;
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    left: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    display: none;
    pointer-events: none;
}

.progress-bar-container:hover .progress-bar-thumb {
    display: block;
}

/* Right: Extra Controls */
.player-right {
    width: 30%;
    min-width: 180px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100px;
}
.volume-slider {
    width: 100%;
}

.btn-pre-register {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    padding: 6px 16px;
    border-radius: 32px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-pre-register:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-primary);
}

.btn-pre-register ion-icon {
    font-size: 18px;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-surface);
    border-radius: 12px;
    padding: 40px;
    width: 90%;
    max-width: 480px;
    position: relative;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content h2 {
    font-size: 28px;
    margin-bottom: 12px;
    font-weight: 800;
    color: var(--text-primary);
}

.modal-content p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.register-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.register-form input {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.register-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.register-form input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.hidden {
    display: none !important;
}

/* Responsive constraints */
@media (max-width: 900px) {
    .album-title {
        font-size: 48px;
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto; /* Allow body scrolling on mobile so Safari address bar collapses naturally */
    }

    /* Mobile App Layout */
    .app-container {
        display: block;
        height: auto;
        min-height: 100dvh;
    }
    
    .sidebar {
        display: none; /* Hide sidebar completely on mobile */
    }
    
    .main-view {
        display: block;
        height: auto;
        min-height: 100dvh;
        overflow: visible; /* Main view expands visually */
        padding-bottom: calc(var(--player-height) + env(safe-area-inset-bottom) + 16px);
    }
    
    .player-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: var(--player-height);
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: content-box; /* So safe-area-inset doesn't squish controls */
        z-index: 90;
    }

    /* Mobile specific adjustments */
    .album-hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding-top: 100px;
    }
    
    .album-cover-container {
        width: 180px;
        height: 180px;
    }
    
    .album-title {
        font-size: 32px;
    }
    
    .top-nav {
        padding: 0 16px;
    }
    
    .track-list-container {
        padding: 0 16px 32px;
    }
    
    .track-list-header {
        grid-template-columns: 48px 1fr 60px;
    }
    .track-row {
        grid-template-columns: 48px 1fr 60px;
    }
    .col-album {
        display: none;
    }
    
    .player-left {
        width: auto;
        min-width: unset;
        display: none; /* Hide song title section on pure mobile completely, focus on center controls */
    }
    
    .now-playing-img {
        display: none; /* Keep it simple on mobile */
    }
    
    .player-right {
        display: none; /* Hide volume/extra on mobile player bar */
    }
    
    .player-center {
        width: 100%;
        max-width: 100%;
    }
    
    .player-controls {
        gap: 16px;
    }
}
