/* --- Fonts --- */
@font-face {
    font-family: 'google';
    src: url('../fonts/GoogleSans-Regular.ttf') format('truetype');
    font-display: swap;
}
@font-face {
    font-family: 'dn';
    src: url('../fonts/iransansdn.ttf') format('truetype');
    font-display: swap;
}

/* --- Theme variables --- */
:root {
    --bg-base: #000000;
    --bg-page: linear-gradient(160deg, #121212 0%, #121212 100%);
    --bg-surface: #121212;
    --bg-glass: rgba(18, 18, 18, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #a7a7a7;
    --accent-color: #1db954;
    --accent-hover: #1ed760;
    --border-glass: rgba(255, 255, 255, 0.08);
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.5);

    --font-primary: 'google', 'dn', Tahoma, sans-serif;

    /* متغیرهای صحیح ارتفاع پلیر */
    --player-h-desktop: 90px;
    --player-h-mobile: 74px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-primary), serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    direction: rtl;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100vh;
}

/* --- Scrollbar (Windows 11 Dark Theme Style) --- */
* {
    scrollbar-width: thin;
    scrollbar-color: #4a4a4a transparent;
}

*::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: #4a4a4a;
    border: 4px solid var(--bg-surface);
    background-clip: content-box;
    border-radius: 9999px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: #777777;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

/* --- Global helpers --- */
a {
    color: inherit;
    text-decoration: none;
}

button, input, textarea, select {
    font: inherit;
}

::selection {
    background: var(--accent-color);
    color: #fff;
}

/* --- Icon sizing --- */
.nav-icon {
    width: 25px;
    height: 25px;
    object-fit: contain;
}

.btn-icon-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.player-action-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.player-action-icon:hover {
    opacity: 1;
}

.card-play-icon {
    width: 22px;
    height: 22px;
    margin-left: 2px;
}

/* --- Layout --- */
.app-container {
    display: flex;
    height: calc(100vh - var(--player-h-desktop));
}

/* --- Sidebar --- */
.sidebar {
    width: 250px;
    background-color: #000000;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1002;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-menu,
.nav-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section h4 {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
    padding-right: 14px;
}

.nav-item {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    transition: color 0.2s ease;
}

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

/* --- Main content --- */
.main-content {
    flex: 1;
    overflow-y: overlay;
    padding: 24px 30px;
    background: var(--bg-page);
    border-radius: 8px;
    margin-top: 8px;
    margin-left: 8px;
}

/* --- Hero banner --- */
.hero-banner {
    padding: 40px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #1d3345 0%, #121212 100%);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.hero-content p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 24px;
}

/* --- Buttons --- */
.btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, background 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: scale(1.04);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

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

/* --- Sections / Cards --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;

}

.track-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}

.track-card {
    background: #181818;
    padding: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.track-card:hover {
    background: #282828;
}

.track-cover-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.track-card img.cover {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.card-play-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: var(--accent-color);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 8px rgba(0,0,0,0.3);
}

.card-play-btn .card-play-icon {
    filter: invert(1);
}

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

.card-play-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05) !important;
}

.track-card h4 {
    font-size: 15px;
    font-weight: normal;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-card p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* =========================================
   Player bottom
   ========================================= */
.player {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--player-h-desktop);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1050;
    background: #181818;
    border-top: none;
}

.player-right-section,
.player-left-section {
    width: 30%;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.player-left-section {
    justify-content: flex-end;
}

.track-cover {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

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

.track-info h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-info p {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    max-width: 722px;
}

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

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover .player-action-icon {
    opacity: 1;
}

.play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

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

.play-btn .player-play-icon {
    width: 14px;
    height: 14px;
    filter: invert(1);
}

.progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-container span {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: #4d4d4d;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

input[type="range"]:hover {
    background: var(--accent-color);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

input[type="range"]:hover::-webkit-slider-thumb {
    opacity: 1;
}

.volume-wrap {
    width: 90px;
    display: flex;
    align-items: center;
}

#volume-bar {
    background: #4d4d4d;
}

#volume-bar:hover {
    background: var(--accent-color);
}

/* =========================================
   Mobile Navbar & Fullscreen Player
   ========================================= */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: #121212;
    z-index: 1050;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-glass);
}

.mobile-bottom-nav .nav-item {
    padding: 10px;
    opacity: 0.6;
}

.mobile-bottom-nav .nav-item.active {
    opacity: 1;
}

.fullscreen-player {
    position: fixed;
    top: 100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-page);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fullscreen-player.active {
    top: 0;
}

.close-fs-btn {
    position: absolute;
    top: 24px;
    left: 24px;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.7;
}

.fs-cover-wrapper {
    width: 85%;
    max-width: 350px;
    aspect-ratio: 1;
    margin-bottom: 40px;
}

.fs-cover-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.fs-info {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
}

.fs-info h2 {
    font-size: 22px;
    margin-bottom: 8px;
    color: #fff;
}

.fs-info p {
    color: var(--text-secondary);
    font-size: 15px;
}

.fs-progress {
    width: 100%;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    direction: ltr;
}

.fs-controls {
    display: flex;
    align-items: center;
    gap: 25px;
    direction: ltr;
}

.fs-controls .play-btn {
    width: 64px;
    height: 64px;
}

.fs-controls .play-btn img {
    width: 20px;
    height: 20px;
}

.fs-controls .btn-icon img {
    width: 24px;
    height: 24px;
}

/* =============================================================================================================  */
@media (max-width: 768px) {
    .hero-banner {
        padding: 20px;
    }
    .hero-content h1 {
        font-size: 24px;
        font-weight: 750;
        text-align: center;
        margin-bottom: 10px;
    }
    .hero-content p {
        text-align: center;
        font-size: 14px;
    }

    /* رفع مشکل بیرون زدن دکمه فرم ورود */
    /* استایل‌های مخرب قبلی پاک شدند و فقط برای دکمه هدر اعمال شدند */
    .hero-content .btn-primary {
        margin: 0 auto !important;
        width: fit-content;
    }

    .menu-toggle {
        display: none !important;
    }

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

    .player {
        bottom: 60px;
        border-bottom: 1px solid #2a2a2a;
        cursor: pointer;
    }

    .main-content {
        padding-bottom: 150px;
        padding-top: 60px;
        margin: 0;
        border-radius: 0;
    }

    .sidebar {
        display: none;
    }

    .track-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
    }

    .player {
        height: var(--player-h-mobile);
        padding: 0 12px;
    }

    .player-left-section {
        display: none;
    }

    .player-right-section {
        width: 60%;
        gap: 10px;
    }

    .track-cover {
        width: 48px;
        height: 48px;
    }

    .player-center {
        width: 40%;
        align-items: flex-end;
    }

    .progress-container {
        display: none;
    }

    .player-controls {
        gap: 16px;
    }
}

/* =========================================
   Account nav button
   ========================================= */
.account-nav-section {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-glass);
}

.account-trigger {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    text-align: right;
}

.sidebar .account-trigger {
    width: 100%;
}

.account-trigger .nav-icon {
    opacity: 0.8;
}

.account-trigger.logged-in .nav-icon {
    opacity: 1;
    color: var(--accent-color);
}

.account-trigger.logged-in #account-label {
    color: var(--accent-color);
}

/* =========================================
   Like (heart) buttons
   ========================================= */
.card-like-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-6px);
    transition: all 0.25s ease;
    backdrop-filter: blur(4px);
}

.track-card:hover .card-like-btn {
    opacity: 1;
    transform: translateY(0);
}

.card-like-btn .card-like-icon {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
    opacity: 0.85;
}

.card-like-btn.liked {
    opacity: 1;
    transform: translateY(0);
    background: var(--accent-color);
}

.card-like-btn.liked .card-like-icon {
    filter: none;
    opacity: 1;
}
#btn-favorite.liked .player-action-icon {
    filter: invert(48%) sepia(89%) saturate(1000%) hue-rotate(90deg);
    opacity: 1;
}

/* =========================================
   Auth modal (Login / Signup)
   ========================================= */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 20px;
}

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

.auth-modal {
    width: 100%;
    max-width: 380px;
    background: #181818;
    border-radius: 12px;
    padding: 32px 28px;
    position: relative;
    box-shadow: var(--shadow-soft);
    transform: translateY(10px);
    transition: transform 0.25s ease;
}

.auth-overlay.active .auth-modal {
    transform: translateY(0);
}

.auth-close {
    position: absolute;
    top: 14px;
    left: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}

.auth-close:hover {
    color: #fff;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: #101010;
    border-radius: 999px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 14px;
    padding: 10px 0;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab.active {
    background: var(--accent-color);
    color: #000;
}

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

.auth-form.active {
    display: flex;
}

.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-form input {
    background: #101010;
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 12px;
    color: #fff;
    font-size: 14px;
    direction: ltr;
    text-align: right;
}

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

.captcha-label span {
    direction: ltr;
    text-align: left;
    font-weight: 700;
    color: #fff;
    font-size: 15px;
    letter-spacing: 1px;
}

.auth-error {
    color: #ff5c5c;
    font-size: 13px;
    min-height: 16px;
}

.auth-submit {
    width: 100%;
    justify-content: center;
    padding: 13px 0;
    margin-top: 4px;
}

/* =========================================
   PWA install banners
   ========================================= */
.install-banner {
    position: fixed;
    top: 24px;
    /* تغییرات برای وسط چین شدن بی‌نقص در همه پلتفرم‌ها */
    left: 0;
    right: 0;
    margin: 0 auto;
    width: calc(100% - 32px);
    max-width: 420px;
    background: #181818;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-soft);
    z-index: 2500;
    transform: translateY(-150%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}

.install-banner.active {
    transform: translateY(0);
    opacity: 1;
}

.install-banner-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
}

.install-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.install-banner-text strong {
    font-size: 14px;
    color: #fff;
}

.install-banner-text span {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.install-banner-btn {
    padding: 8px 18px;
    font-size: 13px;
    flex-shrink: 0;
}

.install-banner-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

.ios-share-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    filter: brightness(0) invert(1);
}

@media (max-width: 768px) {
    .install-banner {
        top: 16px;
        width: calc(100% - 24px); /* کمی پهن تر برای موبایل اما کاملا وسط */
    }
}