
:root {
    --bg-black: #000000;
    --bg-base: #121212;
    --bg-elevated: #181818;
    --bg-highlight: #282828;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-green: #1db954;
    --accent-green-hover: #1ed760;
    --sidebar-width: 260px;
    --player-height: 84px;
    --mobile-nav-height: 58px;
    --radius-md: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-black);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    user-select: none;
}

a { color: inherit; text-decoration: none; }
button { background: none; border: none; color: inherit; cursor: pointer; font-family: inherit; }

.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 1fr var(--player-height);
    grid-template-areas: "sidebar main" "player player";
    height: 100%;
    gap: 8px;
    padding: 8px;
}

.mobile-bottom-nav { display: none; }

.sidebar { grid-area: sidebar; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.sidebar-card { background-color: var(--bg-base); border-radius: var(--radius-md); padding: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; }
.logo i { color: var(--accent-green); font-size: 1.6rem; }
.nav-menu ul { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.nav-item { display: flex; align-items: center; gap: 16px; font-weight: 600; font-size: 0.95rem; color: var(--text-secondary); transition: color 0.2s; }
.nav-item:hover, .nav-item.active { color: var(--text-primary); }
.nav-item i { font-size: 1.2rem; width: 24px; text-align: center; }

.library-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.library-header { display: flex; justify-content: space-between; align-items: center; color: var(--text-secondary); font-weight: 600; margin-bottom: 16px; }
.playlist-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.playlist-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 6px; cursor: pointer; transition: background-color 0.2s; }
.playlist-item:hover { background-color: var(--bg-elevated); }
.playlist-cover { width: 48px; height: 48px; background-color: var(--bg-highlight); border-radius: 4px; flex-shrink: 0; }
.playlist-info { display: flex; flex-direction: column; overflow: hidden; }
.playlist-title { font-size: 0.95rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playlist-sub { font-size: 0.8rem; color: var(--text-secondary); }

.main-wrapper {
    grid-area: main;
    background: linear-gradient(180deg, #222222 0%, var(--bg-base) 35%);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background-color: rgba(18, 18, 18, 0.7);
    backdrop-filter: blur(10px);
    z-index: 10;
    flex-shrink: 0;
}

.history-controls { display: flex; gap: 8px; }
.circle-btn { width: 32px; height: 32px; border-radius: 50%; background-color: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.search-bar-container { display: flex; align-items: center; background-color: #242424; border-radius: 50px; padding: 8px 16px; width: 100%; max-width: 360px; gap: 10px; border: 1px solid transparent; }
.search-bar-container:focus-within { border-color: var(--text-primary); }
.search-bar-container input { background: none; border: none; color: var(--text-primary); width: 100%; outline: none; font-size: 0.9rem; }
.user-profile { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.user-badge { background-color: rgba(0, 0, 0, 0.7); padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; font-weight: 700; }
.content-area { flex: 1; overflow-y: auto; padding: 16px 24px 40px 24px; }
.view-section h2 { font-size: 1.5rem; margin-bottom: 16px; margin-top: 12px; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 32px; }
.quick-card { background-color: rgba(255, 255, 255, 0.07); border-radius: 4px; display: flex; align-items: center; height: 64px; overflow: hidden; position: relative; cursor: pointer; transition: background-color 0.2s; }
.quick-card:hover { background-color: rgba(255, 255, 255, 0.15); }
.quick-img { width: 64px; height: 64px; background-color: var(--bg-highlight); margin-right: 14px; flex-shrink: 0; }
.quick-card span { font-weight: 700; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 45px; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 20px; }
.media-card { background-color: var(--bg-elevated); padding: 16px; border-radius: var(--radius-md); cursor: pointer; transition: background-color 0.25s; }
.media-card:hover { background-color: var(--bg-highlight); }
.card-img-wrapper { position: relative; margin-bottom: 14px; }
.card-img { width: 100%; aspect-ratio: 1 / 1; background-color: #333; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.play-hover-btn { position: absolute; bottom: 8px; right: 8px; width: 44px; height: 44px; border-radius: 50%; background-color: var(--accent-green); color: var(--bg-black); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; opacity: 0; transform: translateY(8px); transition: all 0.25s ease; }
.quick-card .play-hover-btn { bottom: auto; right: 12px; width: 38px; height: 38px; transform: none; }
.media-card:hover .play-hover-btn, .quick-card:hover .play-hover-btn { opacity: 1; transform: translateY(0); }
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-subtitle { font-size: 0.85rem; color: var(--text-secondary); }

.player-bar { grid-area: player; background-color: var(--bg-black); display: grid; grid-template-columns: 30% 40% 30%; align-items: center; padding: 0 16px; }
.player-now-playing { display: flex; align-items: center; gap: 14px; min-width: 0; }
.now-playing-cover { width: 56px; height: 56px; background-color: var(--bg-highlight); border-radius: 4px; flex-shrink: 0; background-size: cover; background-position: center; }
.now-playing-info { display: flex; flex-direction: column; min-width: 0; }
.track-name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artist-name { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-controls-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.control-buttons { display: flex; align-items: center; gap: 20px; }
.icon-btn { color: var(--text-secondary); font-size: 1rem; transition: color 0.15s; }
.icon-btn:hover { color: var(--text-primary); }
.play-main-btn { width: 34px; height: 34px; border-radius: 50%; background-color: var(--text-primary); color: var(--bg-black); display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.playback-bar { width: 100%; max-width: 520px; display: flex; align-items: center; gap: 10px; }
.time-text { font-size: 0.72rem; color: var(--text-secondary); min-width: 35px; text-align: center; }
.progress-wrapper { flex: 1; height: 12px; display: flex; align-items: center; cursor: pointer; }
.progress-bg { width: 100%; height: 4px; background-color: #4d4d4d; border-radius: 2px; position: relative; overflow: hidden; }
.progress-buffer { position: absolute; height: 100%; background-color: #7a7a7a; top: 0; left: 0; }
.progress-fill { position: absolute; height: 100%; background-color: var(--text-primary); top: 0; left: 0; border-radius: 2px; }
.player-controls-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.volume-control { display: flex; align-items: center; gap: 8px; width: 110px; }
#volume-slider { width: 100%; accent-color: var(--accent-green); cursor: pointer; height: 4px; }

@media (max-width: 1024px) {
    :root { --sidebar-width: 80px; }
    .logo span, .nav-item span, .hide-tablet, .playlist-info { display: none; }
    .logo, .nav-item, .library-header { justify-content: center; }
    .playlist-item { justify-content: center; padding: 4px; }
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
    .player-bar { grid-template-columns: 28% 46% 26%; }
}

@media (max-width: 767px) {
    .app-layout { display: flex; flex-direction: column; padding: 0; gap: 0; }
    .sidebar, .history-controls, .hide-mobile, .player-controls-right { display: none !important; }
    .main-wrapper { flex: 1; border-radius: 0; padding-bottom: calc(64px + var(--mobile-nav-height)); }
    .top-bar { padding: 0 16px; height: 56px; }
    .content-area { padding: 12px 16px 24px 16px; }
    .view-section h2 { font-size: 1.25rem; }
    .quick-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 24px; }
    .quick-card { height: 52px; }
    .quick-img { width: 52px; height: 52px; margin-right: 10px; }
    .quick-card span { font-size: 0.8rem; padding-right: 8px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .play-hover-btn { display: none; }
    .cards-grid {/*grid-template-columns: repeat(2, 1fr);*/ gap: 12px; }
    .media-card { padding: 10px; }
    .player-bar {
        position: fixed; bottom: calc(var(--mobile-nav-height) + 6px); left: 8px; right: 8px; height: 58px;
        background-color: #282828; border-radius: 8px; display: flex; align-items: center; justify-content: space-between;
        padding: 0 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7); z-index: 100;
    }
    .player-now-playing { flex: 1; gap: 10px; }
    .now-playing-cover { width: 42px; height: 42px; }
    .player-controls-center { flex-direction: row; gap: 0; }
    .control-buttons { gap: 14px; }
    .play-main-btn { background: none; color: var(--text-primary); font-size: 1.25rem; }
    .playback-bar { position: absolute; bottom: 0; left: 8px; right: 8px; width: auto; max-width: none; height: 3px; }
    .time-text { display: none; }
    .progress-wrapper { height: 3px; }
    .progress-bg { height: 2px; }
    .mobile-bottom-nav {
        position: fixed; bottom: 0; left: 0; right: 0; height: var(--mobile-nav-height);
        background: linear-gradient(180deg, rgba(18,18,18,0.95) 0%, #000000 100%);
        backdrop-filter: blur(12px); display: flex; justify-content: space-around; align-items: center;
        border-top: 1px solid rgba(255, 255, 255, 0.08); z-index: 101;
    }
    .mobile-nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-secondary); font-size: 0.7rem; font-weight: 500; width: 33.33%; height: 100%; }
    .mobile-nav-item i { font-size: 1.2rem; }
    .mobile-nav-item.active { color: var(--text-primary); }
}
