* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e2a45;
    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #7c3aed, #3b82f6);
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: rgba(255, 255, 255, 0.08);
    --glass: rgba(255, 255, 255, 0.05);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    padding-bottom: 140px;
}

/* ===== HEADER ===== */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    padding: 12px 16px 0;
    border-bottom: 1px solid var(--border);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.greeting {
    font-size: 16px;
    font-weight: 600;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.icon-btn:active {
    background: var(--glass);
    transform: scale(0.9);
}

/* ===== SEARCH BAR ===== */

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.search-bar:active {
    border-color: var(--accent);
}

/* ===== CATEGORIES ===== */

.categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    scrollbar-width: none;
}

.categories::-webkit-scrollbar {
    display: none;
}

.cat-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.cat-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.cat-btn:active {
    transform: scale(0.95);
}

/* ===== CONTENT ===== */

.content {
    padding: 16px;
}

.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* ===== RECENT SCROLL ===== */

.recent-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
}

.recent-scroll::-webkit-scrollbar {
    display: none;
}

.recent-card {
    flex-shrink: 0;
    width: 120px;
    cursor: pointer;
    transition: transform 0.2s;
}

.recent-card:active {
    transform: scale(0.95);
}

.recent-cover {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.recent-title {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-artist {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== TRACK LIST ===== */

.track-list {
    display: flex;
    flex-direction: column;
}

.track-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    border-radius: 8px;
    padding: 10px 8px;
}

.track-item:active {
    background: var(--glass);
}

.track-item.playing {
    background: rgba(124, 58, 237, 0.1);
}

.track-item.playing .track-title {
    color: var(--accent-light);
}

.track-cover {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.track-info {
    flex: 1;
    min-width: 0;
}

.track-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.track-artist {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-duration {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 4px;
}

.track-menu {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    padding: 8px;
    cursor: pointer;
}

/* ===== MINI PLAYER ===== */

.mini-player {
    position: fixed;
    bottom: 60px;
    left: 8px;
    right: 8px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    z-index: 200;
    border: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
}

.mini-player-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.mini-cover {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.mini-info {
    min-width: 0;
}

.mini-title {
    font-size: 13px;
    font-weight: 600;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-artist {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
}

.mini-progress {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 8px;
    order: 3;
}

.mini-progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s linear;
}

.mini-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ctrl-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.ctrl-btn:active {
    transform: scale(0.85);
}

.ctrl-btn.active {
    color: var(--accent-light);
}

.play-btn {
    background: var(--accent-gradient);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

/* ===== FULL PLAYER ===== */

.full-player {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    transition: transform 0.3s ease;
}

.full-player.hidden {
    transform: translateY(100%);
    pointer-events: none;
}

.full-player-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    filter: blur(60px) brightness(0.3);
    transform: scale(1.2);
}

.full-player-content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 24px;
    padding-bottom: calc(20px + var(--safe-bottom));
    background: rgba(0, 0, 0, 0.4);
}

.full-player-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.full-cover {
    width: min(300px, 75vw);
    height: min(300px, 75vw);
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    margin-bottom: 32px;
}

.full-info {
    text-align: center;
    margin-bottom: 24px;
    width: 100%;
}

.full-info h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.full-info p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* ===== PROGRESS BAR ===== */

.progress-container {
    width: 100%;
    margin-bottom: 24px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.progress-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: left 0.1s linear;
}

.progress-time {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== FULL CONTROLS ===== */

.full-controls {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
}

.full-controls .ctrl-btn {
    font-size: 20px;
}

.full-controls .main-play {
    width: 64px;
    height: 64px;
    background: var(--accent-gradient);
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.5);
}

.full-actions {
    display: flex;
    gap: 32px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:active {
    transform: scale(0.85);
}

.action-btn.liked {
    color: #ef4444;
}

/* ===== SEARCH PAGE ===== */

.search-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 300;
    transition: transform 0.3s ease;
}

.search-page.hidden {
    transform: translateY(100%);
    pointer-events: none;
}

.search-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.search-header input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
}

.search-page .track-list {
    padding: 8px 16px;
    overflow-y: auto;
    max-height: calc(100vh - 60px);
}

.search-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.search-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

/* ===== NAV BAR ===== */

.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    padding-bottom: calc(8px + var(--safe-bottom));
    border-top: 1px solid var(--border);
    z-index: 200;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    cursor: pointer;
    padding: 4px 16px;
    transition: color 0.2s;
}

.nav-btn i {
    font-size: 20px;
}

.nav-btn.active {
    color: var(--accent-light);
}

/* ===== LOADING SPINNER ===== */

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    animation: spin 1s linear infinite;
}

/* ===== TOAST ===== */

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; }
    100% { opacity: 0; }
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    z-index: 9999;
    border: 1px solid var(--border);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    animation: fadeInOut 2.5s ease forwards;
    white-space: nowrap;
}
