:root {
    --sc-orange: #f50;
    --sc-dark: #121212;
    --sc-gray: #282828;
    --text-main: #fff;
    --text-muted: #999;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Vazirmatn', sans-serif; -webkit-tap-highlight-color: transparent; }

body { 
    background-color: var(--sc-dark); 
    color: var(--text-main); 
    overflow-x: hidden; 
    -webkit-overflow-scrolling: touch; 
    /* جلوگیری از لگ اسکرول */
    overscroll-behavior: none;
}

a { text-decoration: none; color: inherit; }

.app-container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { 
    width: 240px; 
    background: var(--sc-gray); 
    height: 100vh; 
    position: fixed; 
    right: 0; 
    top: 0; 
    padding: 20px; 
    border-left: 1px solid #333; 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto; 
    flex-shrink: 0;
    /* استفاده از سخت‌افزار برای رندر */
    transform: translateZ(0);
    will-change: transform;
}

.logo { font-size: 1.5rem; color: var(--sc-orange); font-weight: bold; margin-bottom: 30px; text-align: center; }

.nav-item { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    padding: 12px 15px; 
    border-radius: 4px; 
    cursor: pointer; 
    margin-bottom: 5px; 
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s; 
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: rgba(255, 85, 0, 0.2); color: var(--sc-orange); font-weight: bold; }

.delete-btn-sidebar { color: #f44336 !important; font-size: 0.8rem; cursor: pointer; margin-right: 5px; opacity: 0.6; transition: opacity 0.2s; }
.delete-btn-sidebar:hover { opacity: 1; }

/* Main Area */
.main-area { 
    margin-right: 240px; 
    flex: 1; 
    padding: 20px; 
    padding-bottom: 150px; 
    width: 100%; 
    display: flex; 
    flex-direction: column; 
}

.top-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    position: sticky; 
    top: 0; 
    background: rgba(18, 18, 18, 0.95); /* کمی شفافیت برای زیبایی */
    backdrop-filter: blur(10px); 
    padding: 15px 0; 
    z-index: 10; 
}

.search-wrapper { position: relative; width: 100%; max-width: 500px; }
.search-input { width: 100%; padding: 12px 45px 12px 15px; border-radius: 20px; border: none; background: #fff; color: #000; outline: none; font-size: 16px; }

/* Grid - بهینه سازی شده برای سرعت */
.song-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 15px; 
    align-items: start; /* مهم برای جلوگیری از پرش */
}

.song-card { 
    background: var(--sc-gray); 
    border-radius: 8px; 
    overflow: hidden; 
    cursor: pointer; 
    position: relative; 
    /* رمز حل مشکل لگ: رندر نکردن آیتم‌های خارج از صفحه */
    content-visibility: auto; 
    contain-intrinsic-size: 1px 250px; /* ارتفاع تقریبی کارت */
    
    /* انیمیشن سبک‌تر */
    transition: transform 0.2s ease-out; 
    border: 1px solid rgba(255,255,255,0.05);
}

.song-card:hover { 
    transform: translateY(-2px); 
    /* حذف سایه سنگین برای کاهش مصرف منابع */
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); 
}

.card-artwork { width: 100%; padding-bottom: 100%; position: relative; background: linear-gradient(135deg, #333, #222); }
.card-artwork i { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 3rem; color: rgba(255,255,255,0.1); }

.card-info { padding: 10px; display: flex; flex-direction: column; min-height: 85px; }
.card-bottom-row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; }

.action-btn-sm { 
    width: 32px; height: 32px; 
    background: rgba(255,255,255,0.05); 
    border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 0.85rem; 
    border: 1px solid rgba(255,255,255,0.1); 
    color: #aaa; 
    transition: 0.2s; cursor: pointer; 
}
.action-btn-sm:hover { background: rgba(255,255,255,0.1); border-color: var(--sc-orange); color: var(--sc-orange); }
.action-btn-sm.liked { color: var(--sc-orange); border-color: var(--sc-orange); background: rgba(255, 85, 0, 0.1); }

.card-play-btn-inline { 
    width: 35px; height: 35px; 
    background: var(--sc-orange); 
    border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 0.9rem; color: white; border: none; cursor: pointer; 
    transition: transform 0.1s; 
}
.card-play-btn-inline:hover { transform: scale(1.1); background: #ff661a; }

.card-actions { display: flex; gap: 8px; }

.card-artist { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.card-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }

/* Player */
.player-sticky { 
    position: fixed; bottom: 0; left: 0; right: 0; 
    background: #000; z-index: 1000; 
    border-top: 1px solid #333; 
    padding: 10px 240px 10px 20px; 
    display: none; 
    /* بهینه‌سازی سخت‌افزاری */
    transform: translateZ(0);
    will-change: opacity;
}
.progress-wrapper { direction: ltr; width: 100%; height: 3px; background: #333; cursor: pointer; }
.progress-fill { height: 100%; background: var(--sc-orange); width: 0%; }
.player-controls { display: flex; width: 100%; align-items: center; justify-content: space-between; }
.p-left { width: 25%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; flex-shrink: 0; }
.p-center { width: 50%; display: flex; align-items: center; gap: 15px; justify-content: center; flex-shrink: 0; }
.p-right { width: 25%; display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding-left: 10px; flex-shrink: 0; }
.ctrl-btn { background: none; border: none; color: #ccc; font-size: 1rem; cursor: pointer; }
.ctrl-btn.active { color: var(--sc-orange); }
.play-main { width: 40px; height: 40px; border-radius: 50%; background: var(--sc-orange); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: white; border: none; cursor: pointer; }

/* Mobile Nav */
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; height: 75px; background: #000; border-top: 1px solid #222; z-index: 1001; justify-content: space-around; align-items: center; padding-bottom: env(safe-area-inset-bottom); }
.mob-nav-item { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 0.75rem; color: #666; cursor: pointer; padding: 5px; }
.mob-nav-item.active { color: var(--sc-orange); }
.mob-nav-item i { font-size: 1.4rem; }

/* iOS Toast Style */
.ios-toast {
    display: none;
    position: fixed;
    bottom: 85px; 
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: #2c2c2e;
    color: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
    z-index: 9999;
    font-size: 14px;
    border: 1px solid #3a3a3c;
}

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: none; justify-content: center; align-items: center; z-index: 2000; padding: 20px; }
.modal-box { background: var(--sc-gray); padding: 30px; border-radius: 8px; width: 100%; max-width: 350px; position: relative; }
.modal-input { width: 100%; margin-bottom: 15px; padding: 12px; border-radius: 4px; border: 1px solid #444; background: #333; color: white; direction: ltr; text-align: right; }
.modal-btn { width: 100%; padding: 12px; background: var(--sc-orange); border: none; color: white; font-weight: bold; border-radius: 4px; cursor: pointer; }
.load-more-btn { width: 100%; padding: 12px; margin-top: 20px; background: #333; border: 1px solid #444; color: white; border-radius: 20px; cursor: pointer; }

/* Responsive */
@media (max-width: 992px) {
    .sidebar { display: none; } 
    .main-area { margin-right: 0; padding: 15px; padding-bottom: 150px; }
    .song-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .player-sticky { padding: 10px 15px; bottom: 75px; } 
    .mobile-nav { display: flex; }
}
/* ==========================================
   سیستم نوتیفیکیشن (Toast)
   ========================================== */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* کلیک از روی نوتیفیکیشن رد شود */
    width: 90%;
    max-width: 400px;
    align-items: center;
}

.toast-notification {
    background: rgba(40, 40, 40, 0.95);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    animation: toastIn 0.3s ease forwards;
    pointer-events: auto;
    border: 1px solid #444;
    backdrop-filter: blur(5px);
    width: auto;
    text-align: center;
}

.toast-notification i {
    font-size: 1.1rem;
}

/* رنگ‌بندی بر اساس نوع پیام */
.toast-notification.success { border-color: #4caf50; }
.toast-notification.success i { color: #4caf50; }

.toast-notification.error { border-color: #f44336; }
.toast-notification.error i { color: #f44336; }

.toast-notification.warning { border-color: #ff9800; }
.toast-notification.warning i { color: #ff9800; }

.toast-notification.info { border-color: #2196f3; }
.toast-notification.info i { color: #2196f3; }

/* انیمیشن ورود */
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* انیمیشن خروج */
.toast-notification.fade-out {
    animation: toastOut 0.5s ease forwards;
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}
/* ==========================================
   صفحه درخواست آهنگ (اصلاح شده)
   ========================================== */
.request-page-container {
    max-width: 450px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.request-icon-box {
    width: 80px;
    height: 80px;
    background: rgba(255, 85, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: var(--sc-orange);
    border: 1px solid rgba(255, 85, 0, 0.2);
}

.request-form {
    background: var(--sc-gray);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #333;
}

.input-group {
    position: relative;
    margin-bottom: 15px;
    text-align: right;
}

.input-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
    z-index: 1;
}

.input-group input {
    width: 100%;
    box-sizing: border-box; /* مهم: جلوگیری از بیرون زدن */
    padding: 15px 45px 15px 15px; /* فاصله از راست برای آیکون */
    border-radius: 8px;
    border: 1px solid #444;
    background: #333;
    color: white;
    font-size: 15px;
    direction: rtl; /* راست‌چین برای فارسی */
    text-align: right;
    transition: border-color 0.3s;
    outline: none;
    font-family: 'Vazirmatn', sans-serif;
}

.input-group input:focus {
    border-color: var(--sc-orange);
}

/* تغییر رنگ Placeholder */
.input-group input::placeholder {
    color: #777;
    opacity: 1;
}

.request-submit-btn {
    width: 100%;
    padding: 15px;
    background: var(--sc-orange);
    border: none;
    color: white;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s, transform 0.1s;
    margin-top: 10px;
    font-family: 'Vazirmatn', sans-serif;
}

.request-submit-btn:hover { background: #ff661a; }
.request-submit-btn:active { transform: scale(0.98); }
.request-submit-btn:active { transform: scale(0.98); }