/* =====================================================
   Music Platform - Main Stylesheet
   RTL Persian | Dark/Light | Responsive
   ===================================================== */

/* Reset & Base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --font-main: 'Vazirmatn', system-ui, -apple-system, sans-serif;

    /* Dark Theme (Default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a26;
    --bg-card-hover: #22222e;
    --bg-elevated: #1e1e2a;
    --bg-input: #16161f;
    --bg-overlay: rgba(0, 0, 0, 0.6);

    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --text-accent: #4A6FFF;

    --accent: #4A6FFF;
    --accent-hover: #3d5ce6;
    --accent-light: rgba(74, 111, 255, 0.12);
    --accent-glow: rgba(74, 111, 255, 0.3);

    --border: #2a2a36;
    --border-light: #222230;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);

    --gradient-card: linear-gradient(135deg, rgba(74,111,255,0.05) 0%, rgba(0,0,0,0) 100%);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    --player-bg: #0e0e16;
    --player-border: #1a1a28;

    --danger: #ff4466;
    --success: #44cc88;
    --warning: #ffaa33;

    --header-height: 64px;
    --player-height: 80px;
    --bottom-nav-height: 60px;
    --max-width: 1400px;
    --content-padding: 16px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f5f5fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f8;
    --bg-elevated: #ffffff;
    --bg-input: #eeeef4;
    --bg-overlay: rgba(0, 0, 0, 0.3);

    --text-primary: #1a1a2e;
    --text-secondary: #555570;
    --text-muted: #9090a0;
    --text-accent: #3d5ce6;

    --border: #e0e0ea;
    --border-light: #e8e8f0;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);

    --gradient-card: linear-gradient(135deg, rgba(74,111,255,0.03) 0%, rgba(255,255,255,0) 100%);

    --player-bg: #ffffff;
    --player-border: #e0e0ea;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 15px;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea { font: inherit; color: inherit; }

.app-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding-bottom: var(--player-height);
}

@media (max-width: 768px) {
    .app-wrapper { padding-bottom: calc(var(--player-height) + var(--bottom-nav-height)); }
}

/* =====================================================
   App Bar (Header)
   ===================================================== */
.app-bar {
    display: flex;
    align-items: center;
    height: var(--header-height);
    padding: 0 var(--content-padding);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.app-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.app-bar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.app-bar-text { line-height: 1.2; }
.app-bar-sub { font-size: 10px; color: var(--text-muted); font-weight: 300; }
.app-bar-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }

.app-bar-search {
    flex: 1;
    max-width: 400px;
    margin: 0 24px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 8px 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-form svg { color: var(--text-muted); flex-shrink: 0; }

.search-form input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    direction: rtl;
}

.search-form input::placeholder { color: var(--text-muted); }

.app-bar-nav {
    display: flex;
    gap: 4px;
    margin-inline-start: auto;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-xl);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: var(--accent-light);
}

.app-bar-actions {
    display: flex;
    gap: 4px;
    margin-inline-start: auto;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    transition: all 0.2s;
}

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

/* Theme Toggle */
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* Mobile Search Overlay */
.mobile-search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 200;
    backdrop-filter: blur(8px);
}

.mobile-search-overlay.active { display: block; }

.mobile-search-bar {
    background: var(--bg-secondary);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}

.mobile-search-bar .search-form {
    flex: 1;
    margin: 0;
}

/* =====================================================
   Main Content
   ===================================================== */
.main-content {
    min-height: calc(100vh - var(--header-height) - var(--player-height));
    padding: 16px var(--content-padding);
}

/* =====================================================
   Section Headers
   ===================================================== */
.section { margin-bottom: 32px; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.section-eyebrow {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.section-more {
    font-size: 13px;
    color: var(--text-accent);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.2s;
}

.section-more:hover { gap: 8px; }

/* =====================================================
   Featured Slider
   ===================================================== */
.featured-slider {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 4px 0 16px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.featured-slider::-webkit-scrollbar { display: none; }

.featured-slide {
    flex: 0 0 auto;
    width: 280px;
    height: 180px;
    scroll-snap-align: start;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s;
}

.featured-slide:hover { transform: scale(1.02); }

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

.featured-slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
}

.featured-slide-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.featured-slide-artist {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-top: 2px;
}

.featured-slide-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 48px;
    height: 48px;
    background: var(--accent);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.featured-slide:hover .featured-slide-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.featured-slide-play svg { color: #fff; }

/* =====================================================
   Song Card
   ===================================================== */
.song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.song-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s;
    border: 1px solid var(--border-light);
}

.song-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.song-card-cover {
    position: relative;
    padding-top: 100%;
    overflow: hidden;
}

.song-card-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.song-card:hover .song-card-cover img { transform: scale(1.05); }

.song-card-play {
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.25s;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.song-card:hover .song-card-play {
    opacity: 1;
    transform: translateY(0);
}

.song-card-play svg { color: #fff; }

.song-card-info { padding: 10px 12px; }

.song-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-card-artist {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Artist card variant */
.artist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
}

.artist-card {
    text-align: center;
    cursor: pointer;
    transition: transform 0.25s;
}

.artist-card:hover { transform: translateY(-4px); }

.artist-card-avatar {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
    border: 3px solid var(--border-light);
    transition: border-color 0.3s;
}

.artist-card:hover .artist-card-avatar { border-color: var(--accent); }

.artist-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.artist-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Playlist card */
.playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.playlist-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 10px;
    cursor: pointer;
    transition: all 0.25s;
}

.playlist-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.playlist-card-cover {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

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

.playlist-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.playlist-card-count {
    font-size: 11px;
    color: var(--text-muted);
}

/* =====================================================
   Song Detail Page
   ===================================================== */
.song-detail {
    max-width: 800px;
    margin: 0 auto;
}

.song-hero {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
}

.song-hero-cover {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow-lg);
}

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

.song-hero-info { flex: 1; padding-top: 8px; }

.song-hero-type {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.song-hero-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
}

.song-hero-artist {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.song-hero-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-xl);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); }

.btn-outline {
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover { border-color: var(--accent); color: var(--text-primary); }

/* Song List (Queue) */
.song-list { margin-bottom: 32px; }

.song-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.song-list-item:hover { background: var(--bg-card); }
.song-list-item.playing { background: var(--accent-light); }

.song-list-num {
    width: 28px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.song-list-item.playing .song-list-num { color: var(--accent); }

.song-list-cover {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

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

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

.song-list-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.song-list-duration {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Video Cover Toggle */
.video-cover-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: var(--radius-xl);
    font-size: 12px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}

.video-cover-btn.active {
    background: var(--accent);
    color: #fff;
}

/* =====================================================
   Pagination
   ===================================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 32px 0;
}

.page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}

.page-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =====================================================
   Player
   ===================================================== */
.player-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--player-bg);
    border-top: 1px solid var(--player-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.player-bar {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: var(--player-height);
    padding: 0 var(--content-padding);
    gap: 16px;
}

.player-track-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
    max-width: 300px;
}

.player-cover {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    transition: transform 0.3s;
}

.player-cover.playing { animation: spin 8s linear infinite; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.player-meta { min-width: 0; }

.player-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-artist {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.player-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.player-btn:hover { color: var(--text-primary); background: var(--accent-light); }

.player-btn-main {
    width: 44px;
    height: 44px;
    background: var(--accent);
    color: #fff !important;
}

.player-btn-main:hover { background: var(--accent-hover); box-shadow: 0 2px 12px var(--accent-glow); }

.player-progress-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.player-time {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.player-progress {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.player-progress:hover { height: 6px; }

.player-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s linear;
}

.player-extra {
    display: flex;
    align-items: center;
    gap: 4px;
}

.player-volume-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.player-volume-slider {
    width: 80px;
    overflow: hidden;
}

.player-volume-slider input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 4px;
    outline: none;
}

.player-volume-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

/* =====================================================
   Bottom Navigation (Mobile)
   ===================================================== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: var(--player-height);
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 89;
    justify-content: space-around;
    align-items: center;
    backdrop-filter: blur(16px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: var(--text-muted);
    padding: 6px 12px;
    transition: color 0.2s;
}

.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item span { font-weight: 500; }

/* =====================================================
   Footer
   ===================================================== */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 32px var(--content-padding);
    margin-top: 48px;
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}

.footer-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.footer-desc {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 16px;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.social-link {
    padding: 6px 16px;
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.social-link:hover { border-color: var(--accent); color: var(--text-primary); }

.footer-copy {
    font-size: 12px;
    color: var(--text-muted);
}

/* =====================================================
   Ad Slots
   ===================================================== */
.ad-slot {
    margin: 16px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
}

.ad-slot img { max-width: 100%; height: auto; }

.ad-popup {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-overlay);
    z-index: 300;
    backdrop-filter: blur(4px);
}

.ad-popup-inner {
    position: relative;
    max-width: 400px;
    width: 90%;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.ad-close {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: 16px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.ad-close:hover { background: var(--danger); color: #fff; }

/* =====================================================
   Loading & Empty States
   ===================================================== */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state svg { margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state-desc { font-size: 13px; }

/* =====================================================
   Toast Notifications
   ===================================================== */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    pointer-events: auto;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   Maintenance Overlay
   ===================================================== */
.maintenance-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.maintenance-box {
    text-align: center;
    color: var(--text-secondary);
}

.maintenance-box svg { margin-bottom: 16px; }
.maintenance-box h2 { font-size: 18px; font-weight: 600; }

/* =====================================================
   Responsive
   ===================================================== */
.mobile-only { display: none; }

@media (max-width: 768px) {
    :root {
        --content-padding: 12px;
        --header-height: 56px;
        --player-height: 64px;
    }

    .desktop-only { display: none !important; }
    .mobile-only { display: flex; }
    .search-toggle-mobile { display: flex !important; }
    .app-bar-nav { display: none !important; }

    .app-bar {
        height: var(--header-height);
    }

    .app-bar-search {
        display: none;
        margin: 0;
        max-width: none;
    }

    .app-bar-actions {
        margin-inline-start: auto;
    }

    /* Bottom nav spacing */
    .main-content {
        padding-bottom: var(--bottom-nav-height);
    }

    .song-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .artist-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 12px;
    }

    .playlist-grid {
        grid-template-columns: 1fr;
    }

    .featured-slide {
        width: 220px;
        height: 150px;
    }

    /* Player Mobile */
    .player-progress-wrap,
    .player-extra { display: none; }

    .player-bar {
        height: var(--player-height);
        gap: 10px;
    }

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

    .player-cover { width: 40px; height: 40px; }

    /* Song detail mobile */
    .song-hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .song-hero-cover {
        width: 160px;
        height: 160px;
    }

    .song-hero-actions {
        justify-content: center;
    }

    .song-hero-title {
        font-size: 22px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .song-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .artist-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

@media (min-width: 1025px) {
    .song-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
}

/* =====================================================
   Scrollbar
   ===================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =====================================================
   Utility
   ===================================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* =====================================================
   Full-Screen Player (Android-style)
   ===================================================== */
.fs-player {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.fs-player.active { transform: translateY(0); }

.fs-player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    flex-shrink: 0;
}

.fs-player-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.fs-player-close:hover { background: var(--accent-light); color: var(--text-primary); }

.fs-player-title-area { text-align: center; flex: 1; min-width: 0; }
.fs-player-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.fs-player-header-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fs-player-cover-wrap {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding: 0 20px 24px;
}

.fs-player-cover {
    width: min(300px, 70vw);
    height: min(300px, 70vw);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    transition: all 0.3s;
}

.fs-player-cover.spinning {
    border-radius: 50%;
    animation: spin 12s linear infinite;
    box-shadow: 0 0 0 3px var(--accent), 0 16px 48px rgba(0,0,0,0.4);
}

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

.fs-player-info {
    text-align: center;
    padding: 0 24px 16px;
}

.fs-player-song-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }

.fs-player-song-artist {
    font-size: 15px;
    color: var(--accent);
    cursor: pointer;
}

.fs-player-song-artist:hover { text-decoration: underline; }

.fs-player-progress {
    padding: 12px 28px;
    flex-shrink: 0;
}

.fs-player-progress-bar {
    width: 100%;
    height: 5px;
    background: var(--border);
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin-bottom: 6px;
}

.fs-player-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 5px;
    width: 0%;
    transition: width 0.1s;
}

.fs-player-times {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.fs-player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 8px 24px 20px;
    flex-shrink: 0;
}

.fs-player-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.fs-player-btn:hover { background: var(--accent-light); color: var(--text-primary); }

.fs-player-btn-main {
    width: 64px;
    height: 64px;
    background: var(--accent);
    color: #fff !important;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.fs-player-btn-main:hover { background: var(--accent-hover); transform: scale(1.05); }

.fs-player-extra {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 0 24px 16px;
}

.fs-player-extra-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
}

.fs-player-extra-btn svg { color: var(--text-secondary); }

/* Lyrics Box */
.lyrics-section {
    margin: 0 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.lyrics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.lyrics-header:hover { background: var(--bg-card-hover); }

.lyrics-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }

.lyrics-body {
    padding: 0 16px 16px;
    font-size: 15px;
    line-height: 2.2;
    color: var(--text-secondary);
    white-space: pre-line;
    display: none;
}

.lyrics-body.open { display: block; }

/* Loading Spinner */
.loading-more {
    display: flex;
    justify-content: center;
    padding: 24px;
}

.spinner-sm {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Player artist clickable */
.player-artist {
    cursor: pointer;
}

.player-artist:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .fs-player-cover { width: min(260px, 65vw); height: min(260px, 65vw); }
    .fs-player-song-title { font-size: 18px; }
    .fs-player-controls { gap: 16px; }
    .fs-player-btn-main { width: 56px; height: 56px; }
    .lyrics-section { margin: 0 12px 16px; }
}

/* =====================================================
   Skeleton Loading Animations
   ===================================================== */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, var(--bg-card-hover) 40%, var(--bg-card-hover) 60%, transparent 100%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite linear;
}

[data-theme="light"] .skeleton::after {
    background: linear-gradient(90deg, transparent 0%, var(--border-light) 40%, var(--border-light) 60%, transparent 100%);
    background-size: 800px 100%;
}

.skeleton-card { aspect-ratio: 1; }
.skeleton-featured { width: 300px; height: 190px; border-radius: var(--radius-xl); flex-shrink: 0; }
.skeleton-artist { border-radius: 50%; aspect-ratio: 1; }
.skeleton-playlist { width: 60px; height: 60px; border-radius: var(--radius-sm); flex-shrink: 0; }
.skeleton-text { height: 14px; border-radius: 4px; margin-top: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-text.xshort { width: 40%; }
.skeleton-text.tiny { width: 30%; height: 12px; }

/* =====================================================
   Page Transitions
   ===================================================== */
.main-content.page-fade-in {
    animation: pageIn 0.35s ease;
}

.main-content.page-fade-out {
    animation: pageOut 0.2s ease forwards;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pageOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-12px); }
}

/* Section reveal on scroll */
.section[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.section[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered card reveal */
[data-reveal] .song-card,
[data-reveal] .artist-card,
[data-reveal] .playlist-card,
[data-reveal] .featured-slide,
.page-fade-in .song-card,
.page-fade-in .artist-card,
.page-fade-in .playlist-card,
.page-fade-in .featured-slide {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.song-card.revealed, .artist-card.revealed, .playlist-card.revealed, .featured-slide.revealed {
    opacity: 1;
    transform: translateY(0);
}

.song-card:hover, .playlist-card:hover {
    transform: translateY(-2px);
}

/* =====================================================
   Image Lazy Loading Fade-In
   ===================================================== */
.img-lazy {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.img-lazy.loaded {
    opacity: 1;
}

.img-lazy[src] {
    opacity: 1;
}
