/* ==========================================================================
   پالت رنگی دائمی: شب رویایی بلوبری و ستاره‌های پاستیلی (Default Night Mode)
   ========================================================================== */
   :root {
    --bg-color: #211330; /* بنفش بلوبری تیره */
    --text-main: #FFE5FF; /* صورتی روشن درخشان */
    --text-muted: #A084B8; /* یاسی پاستیلی */
    --accent: #452A5C; /* بنفش مخملی تیره */
    --card-bg: #1A0E26D9; /* بنفش تیره خامه‌ای با افکت شیشه‌ای */
    --hover-bg: #2B183D; /* فوکسیای مات */
    --shadow: rgba(0, 0, 0, 0.35);
    --progress-bg: #FFC6FF; /* صورتی آدامسی برای نوار پیشرفت */
}

/* ==========================================================================
   تنظیمات پایه و عمومی (Reset & Core Layout)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

body {
    font-family: 'Baloo Bhaijaan 2', system-ui, sans-serif;
    font-weight: 500;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    direction: rtl; /* راست‌چین استاندارد فارسی */
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Lalezar', system-ui, sans-serif;
    font-weight: 400;
}

/* ==========================================================================
   منوی ناوبری بالایی (Top Navigation)
   ========================================================================== */
.top-nav {
    position: absolute;
    top: 24px;
    left: 24px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

body:not(.admin-body) .top-nav {
    left: 24px;
    right: auto;
}

.mobile-logo { display: none; }

.icon-btn {
    background: var(--card-bg);
    color: var(--text-main);
    border: 2px solid var(--accent);
    border-radius: 50%;
    width: 46px;
    height: 46px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 6px 12px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.icon-btn:hover { background: var(--hover-bg); transform: scale(1.08); }

/* ==========================================================================
   کانتینر اصلی برنامه (Main Player Container)
   ========================================================================== */
.container {
    display: flex;
    background: var(--card-bg);
    border-radius: 28px;
    box-shadow: 0 20px 50px var(--shadow);
    width: 920px;
    max-width: 95%;
    overflow: hidden;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.player-section {
    flex: 1;
    padding: 45px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-left: 2px solid var(--accent);
    border-right: none;
    position: relative;
}

.desktop-logo { 
    font-size: 2.6rem; 
    margin-bottom: 25px; 
    color: var(--text-main);
    text-shadow: 0 2px 4px var(--shadow);
}

.record-player {
    width: 220px;
    height: 220px;
    background: #311B47;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 12px 28px rgba(49, 27, 71, 0.25);
    margin-bottom: 30px;
}

.record {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #1A0F26 25%, #4C2D6B 50%, #1A0F26 75%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #5A367E;
}

.record.playing { animation: spin 5s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.record-label {
    width: 72px;
    height: 72px;
    background: var(--accent);
    border-radius: 50%;
    border: 4px solid #1A0F26;
}

.track-info { text-align: center; margin-bottom: 25px; width: 100%; }
.track-info h2 { font-size: 1.6rem; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-info p { color: var(--text-muted); font-size: 1rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}

.controls { display: flex; align-items: center; gap: 22px; direction: ltr; }
.controls button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
}
.controls button:hover { transform: scale(1.15); color: var(--text-muted); }
.controls .main-play-btn { font-size: 2.4rem; color: var(--text-main); }

.secondary-btn { font-size: 1.1rem !important; opacity: 0.45; }
.secondary-btn.active { opacity: 1; color: var(--text-main); }
.repeat-one-indicator { position: absolute; font-size: 0.65rem; font-family: sans-serif; font-weight: bold; margin-right: -5px; margin-top: 5px; }

.progress-container {
    width: 100%;
    height: 6px;
    background: var(--accent);
    margin-top: 25px;
    border-radius: 4px;
    cursor: pointer;
}
.progress { height: 100%; background: var(--text-main); width: 0%; border-radius: 4px; transition: width 0.1s linear; }

.volume-container { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 24px; gap: 12px; direction: ltr; }
.volume-icon { font-size: 0.9rem; color: var(--text-muted); }
#volume-slider { flex: 1; max-width: 120px; accent-color: var(--text-main); height: 5px; cursor: pointer; }

/* ==========================================================================
   بخش لیست پخش (Playlist Section)
   ========================================================================== */
.playlist-section { flex: 1; padding: 40px; background: var(--hover-bg); padding-top: 35px; }
.playlist-section h3 { margin-bottom: 22px; color: var(--text-main); font-size: 1.4rem; }

.filter-container { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-chip {
    padding: 6px 16px;
    border-radius: 20px;
    background: var(--accent);
    color: var(--text-main);
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}
.filter-chip:hover { background: var(--text-muted); color: var(--bg-color); }
.filter-chip.active { background: var(--text-main); color: var(--bg-color); }

.playlist { list-style: none; max-height: 390px; overflow-y: auto; padding-bottom: 10px; }
.playlist::-webkit-scrollbar { width: 6px; }
.playlist::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

.playlist li {
    padding: 14px 15px;
    border-bottom: 2px dashed var(--accent);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.playlist li:hover { background: var(--card-bg); border-radius: 14px; }
.playlist li.active { border-right: 5px solid var(--text-main); border-left: none; background: var(--card-bg); border-radius: 0 14px 14px 0; }

.track-left { text-align: right; }
.track-left strong { font-weight: 700; display: block; font-size: 1.05rem; color: var(--text-main); }
.artist-sub { font-size: 0.9rem; color: var(--text-muted); margin-top: 2px; display: block; }
.track-tags { margin-top: 6px; display: flex; gap: 5px; }
.tiny-tag { font-size: 0.7rem; background: var(--accent); padding: 2px 8px; border-radius: 8px; color: var(--text-main); font-weight: 700; }

.track-right { display: flex; align-items: center; font-size: 0.85rem; color: var(--text-muted); font-family: monospace; direction: ltr; }

.download-btn-inline {
    background: none;
    border: none;
    color: var(--text-muted);
    opacity: 0.5;
    cursor: pointer;
    margin-right: 12px;
    margin-left: 0px;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.download-btn-inline:hover { opacity: 1; color: var(--text-main); transform: scale(1.15); }

/* ==========================================================================
   بخش داشبورد مدیریت (Admin Area)
   ========================================================================== */
.admin-container { max-width: 95%; width: 950px; }
.admin-card { background: var(--card-bg); padding: 40px; width: 420px; border-left: 2px solid var(--accent); border-right: none; }
.input-group { margin-top: 16px; text-align: right; }
.input-group label { display: block; font-size: 0.95rem; margin-bottom: 6px; color: var(--text-main); font-weight: 700; }
.input-group input[type="text"], .input-group input[type="password"], .input-group input[type="file"] {
    width: 100%; padding: 11px; border: 2px solid var(--accent); border-radius: 14px; font-family: inherit;
    background: var(--bg-color); color: var(--text-main);
}
.checkbox-group { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.checkbox-group label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; cursor: pointer; color: var(--text-main); }
.upload-btn {
    width: 100%; padding: 12px; background: var(--text-main); color: var(--bg-color);
    border: none; border-radius: 14px; margin-top: 25px; cursor: pointer;
    font-family: 'Lalezar', system-ui, sans-serif; font-size: 1.3rem;
}
.upload-btn:hover { opacity: 0.95; transform: translateY(-1px); }
.delete-btn { background: transparent; color: #ff5c5c; border: 2px solid #ff5c5c; padding: 4px 12px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-family: inherit; }
.delete-btn:hover { background: #ff5c5c; color: white; }

/* ==========================================================================
   بخش المان‌های تزیینی زنده پس‌زمینه (فقط آسمان شب دائمی)
   ========================================================================== */
.sky-decorations {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.moon-decor, .star-decor { 
    display: block; 
}

.moon-decor {
    position: absolute;
    top: 10%;
    left: 8%;
    font-size: 5rem;
    color: #FFE5FF;
    opacity: 0.35;
    filter: drop-shadow(0 0 25px rgba(255, 229, 255, 0.4));
    transform: rotate(-15deg);
    animation: float-slow 9s ease-in-out infinite alternate;
}

.star-decor {
    position: absolute;
    color: #FFFFD0;
    opacity: 0.35;
    animation: twinkle 3.5s ease-in-out infinite alternate;
}

.st1 { top: 14%; right: 18%; font-size: 1.3rem; animation-delay: 0s; }
.st2 { top: 38%; left: 6%; font-size: 1rem; animation-delay: 0.6s; }
.st3 { bottom: 28%; left: 15%; font-size: 1.5rem; animation-delay: 1.2s; }
.st4 { bottom: 22%; right: 7%; font-size: 1.2rem; animation-delay: 1.8s; }
.st5 { top: 58%; right: 20%; font-size: 0.9rem; animation-delay: 2.4s; }

@keyframes float-slow {
    0% { transform: translateY(0px) translateX(0px); }
    100% { transform: translateY(-15px) translateX(7px); }
}
@keyframes twinkle {
    0% { opacity: 0.15; transform: scale(0.8); }
    100% { opacity: 0.55; transform: scale(1.15); }
}

/* ==========================================================================
   بهینه‌سازی ریسپانسیو موبایل
   ========================================================================== */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        padding-top: 80px;
        padding-bottom: 115px;
        display: block;
    }

    .top-nav {
        position: fixed;
        top: 0; left: 0; right: 0;
        background: var(--card-bg);
        padding: 12px 18px;
        box-shadow: 0 4px 15px var(--shadow);
        justify-content: space-between;
        align-items: center;
        border-bottom: 2px solid var(--accent);
        backdrop-filter: blur(15px);
        left: 0 !important; right: 0 !important;
    }
    
    .mobile-logo { display: block; font-size: 1.6rem; margin: 0; color: var(--text-main); }
    .desktop-logo { display: none; }
    .icon-btn { width: 40px; height: 40px; font-size: 1rem; box-shadow: none; border: none; background: var(--hover-bg); }

    .container {
        flex-direction: column;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        backdrop-filter: none;
    }

    .playlist-section, .admin-card {
        width: 100%;
        padding: 25px 16px;
        background: transparent;
        border-left: none;
    }
    
    .playlist { 
        max-height: none; 
        overflow: visible; 
        padding-bottom: 30px;
    }

    .player-section {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 95px;
        padding: 0 16px;
        background: var(--card-bg);
        border-top: 2px solid var(--accent);
        border-left: none;
        box-shadow: 0 -6px 20px var(--shadow);
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        z-index: 1000;
        backdrop-filter: blur(15px);
    }

    .progress-container {
        position: absolute;
        top: 0px; left: 0;
        width: 100%; margin: 0;
        height: 4px;
        border-radius: 0;
    }
    .progress { border-radius: 0; }

    .record-player {
        width: 52px; height: 52px;
        margin: 0;
        flex-shrink: 0;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    .record { width: 48px; height: 48px; border-width: 1px; }
    .record-label { width: 16px; height: 16px; border-width: 2px; }

    .track-info {
        flex: 1;
        margin: 0 14px 0 8px;
        text-align: right;
        min-width: 0;
    }
    .track-info h2 { font-size: 1rem; margin-bottom: 2px; }
    .track-info p { font-size: 0.8rem; }

    .controls { 
        gap: 12px; 
        direction: ltr; 
        flex-shrink: 0;
    }
    .controls button { font-size: 1.05rem; }
    .controls .main-play-btn { font-size: 1.5rem; }
    
    .secondary-btn { display: inline-block !important; font-size: 0.95rem !important; }
    .repeat-one-indicator { margin-right: -4px; margin-top: 4px; font-size: 0.55rem; }
    
    .volume-container { display: none; }

    .moon-decor { font-size: 3.8rem; top: 13%; left: 4%; }
    .st2, .st5 { display: none; }
}

/* ==========================================================================
   امضای فوتر شخصی وب‌سایت (Footer Signature)
   ========================================================================== */
.app-footer {
    text-align: center;
    margin-top: 45px;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.8;
    font-weight: 500;
}

.app-footer a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 2px dotted var(--text-main);
}
.app-footer a:hover {
    color: var(--text-muted);
    border-bottom-color: var(--text-muted);
}

.app-footer .footer-heart {
    color: #ff7597;
    margin: 0 2px;
}
.app-footer .fa-cat {
    margin-right: 2px;
}

@media (max-width: 768px) {
    .app-footer {
        margin-top: 35px;
        margin-bottom: 10px;
    }
}
/* ==========================================================================
   بخش استایل اختصاصی تایمر خواب ظریف (Sleep Timer UI)
   ========================================================================== */
.playlist-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.playlist-header-row h3 {
    margin-bottom: 0 !important; /* خنثی کردن مارجین قبلی برای تراز شدن با تایمر */
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 10px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.timer-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.timer-chip {
    background: var(--accent);
    color: var(--text-main);
    border: none;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.timer-chip:hover {
    background: var(--text-muted);
    color: var(--bg-color);
}

/* استایل حالت فعال شدن تایمر */
.timer-chip.active {
    background: #FF5C5C; /* قرمز ملو پاستیلی برای جلب توجه ظریف */
    color: white;
    animation: timer-pulse 2s infinite alternate;
}

@keyframes timer-pulse {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.04); }
}

/* ریسپانسیو اختصاصی تایمر در موبایل‌های خیلی کوچک */
@media (max-width: 400px) {
    .playlist-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .timer-container {
        width: 100%;
        justify-content: space-between;
    }
}