/* =================================================================
   BIRTHDAY WEBSITE - FINAL STYLESHEET
   ================================================================= */

/* -----------------------------------------
   1. IMPORTS & VARIABLES
   ----------------------------------------- */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
    --primary: #ff4757;       /* رنگ اصلی (قرمز مایل به صورتی) */
    --spotify-green: #1db954; /* سبز اسپاتیفای */
    --text-main: #ffffff;
    --text-muted: #b3b3b3;
    --glass-bg: rgba(30, 30, 30, 0.9);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* -----------------------------------------
   2. GLOBAL RESET & ANIMATED BACKGROUND
   ----------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    /* پس‌زمینه متحرک */
    background: linear-gradient(135deg, #24243e, #302b63, #0f0c29);
    background-attachment: fixed;
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Vazirmatn', sans-serif;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    /* بهبود نمایش فونت */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* -----------------------------------------
   3. SCENE MANAGEMENT
   ----------------------------------------- */
.scene {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: opacity 0.5s ease, transform 0.5s ease;
    z-index: 1;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    transform: scale(0.95);
}

.poem-container {
    text-align: right; /* متن فارسی راست‌چین زیباتر است */
    direction: rtl;
    margin-top: 30px; /* فاصله از دکمه بالا */
    margin-bottom: 50px; /* فاصله از پایین صفحه */
    max-width: 90%;
    width: 600px;
    line-height: 1.8;
    z-index: 2;
    background: rgba(0, 0, 0, 0.4); /* یک پس‌زمینه محو برای خوانایی بهتر */
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.poem-container p { 
    font-size: 0.95rem; /* کمی کوچک‌تر برای ظرافت */
    color: rgba(255, 255, 255, 0.9); 
    margin: 10px 0;
    min-height: 20px;
    text-align: justify; /* تراز کردن متن */
}

/* -----------------------------------------
   4. SPOTIFY CARD (GLASSMORPHISM)
   ----------------------------------------- */
.spotify-card {
    direction: ltr; /* جهت LTR برای کنترلرهای پلیر */
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    width: 100%;
    max-width: 340px;
    min-height: 540px; 
    border-radius: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--glass-border);
    position: relative; 
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* -----------------------------------------
   5. PLAYLIST SIDEBAR (OFF-CANVAS)
   ----------------------------------------- */
.menu-btn-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.menu-btn-top-left:hover { background: rgba(255, 255, 255, 0.2); color: white; }

.playlist-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #181818; 
    z-index: 50; 
    padding: 20px;
    display: flex;
    flex-direction: column;
    direction: rtl; 
    transform: translateX(-100%); 
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.playlist-sidebar.active { transform: translateX(0); }

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.playlist-header h3 { margin: 0; font-size: 1rem; color: white; }

.close-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.close-btn:hover { background: var(--primary); color: white; }

#playlist-items { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex-grow: 1; }
#playlist-items::-webkit-scrollbar { width: 4px; }
#playlist-items::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.playlist-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: 0.2s;
    margin-bottom: 2px;
}
.playlist-item:hover { background: rgba(255,255,255,0.08); color: white; }
.playlist-item.active-song {
    background: rgba(29, 185, 84, 0.15);
    color: var(--spotify-green);
    border-left: 3px solid var(--spotify-green);
}

/* -----------------------------------------
   6. PLAYER CONTENT (UI)
   ----------------------------------------- */
.player-content {
    width: 100%;
    height: 100%;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

/* Tabs */
.playlist-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 50px;
    margin-bottom: 10px;
    width: 100%;
    max-width: 280px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 10px;
    border-radius: 40px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}
.tab-btn.active {
    background: var(--primary);
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(255, 71, 87, 0.3);
}
.tab-btn:hover:not(.active) { color: white; }

/* Large Icon & Info */
.music-icon-large {
    width: 100px;
    height: 100px;
    background: rgba(0,0,0,0.25);
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--spotify-green);
    margin-bottom: 15px;
    margin-top: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.music-icon-large svg { width: 50px; height: 50px; }

.track-info { width: 100%; text-align: center; margin-bottom: 20px; }
.track-info h2 { font-size: 1.2rem; color: white; margin: 0 0 5px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.track-info p { font-size: 0.9rem; color: var(--text-muted); margin: 0; }

/* Progress Bar */
.progress-container { 
    width: 100%; 
    margin-bottom: 25px; 
    cursor: pointer; 
}
.progress-fill {
    height: 6px; 
    background: rgba(255,255,255,0.1); 
    border-radius: 10px; 
    position: relative; 
    overflow: hidden; 
    width: 100%;
}
#progress-bar {
    height: 100%; 
    width: 0%; 
    background: var(--spotify-green); 
    border-radius: 10px;
    position: absolute; 
    top: 0; 
    left: 0;
    transition: width 0.1s linear;
}
.time-info {
    display: flex; 
    justify-content: space-between; 
    font-size: 0.75rem; 
    color: var(--text-muted); 
    margin-top: 8px;
}

/* Controls */
.controls-row {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 20px; 
    width: 100%;
}

.ctrl-btn { 
    background: transparent; 
    border: none; 
    color: #ffffff; 
    cursor: pointer; 
    transition: 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.ctrl-btn:hover:not(:disabled) { transform: scale(1.1); color: var(--primary); }

.ctrl-btn.sm {
    width: 45px; height: 45px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.05); 
}
.ctrl-btn.sm:hover { background: rgba(255, 255, 255, 0.15); }
.ctrl-btn svg { width: 26px; height: 26px; display: block; fill: currentColor; }

.play-big {
    width: 65px; height: 65px; 
    background: white; 
    border-radius: 50%; 
    color: black !important;
    box-shadow: 0 5px 20px rgba(255,255,255,0.2);
}
.play-big:hover { transform: scale(1.05); box-shadow: 0 8px 25px rgba(255,255,255,0.3); }
.play-big svg { width: 32px; height: 32px; }

/* -----------------------------------------
   7. CHALLENGE & CELEBRATION PANELS
   ----------------------------------------- */
.glass-panel {
    direction: rtl;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

input[type="text"] {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.3);
    color: white;
    font-size: 16px; 
    text-align: center;
    margin: 20px 0;
    outline: none;
    transition: 0.3s;
    font-family: 'Vazirmatn', sans-serif;
}
input[type="text"]:focus { border-color: var(--primary); background: rgba(0,0,0,0.5); }

.error-text { color: #ff6b6b; font-size: 0.9rem; min-height: 25px; margin-bottom: 10px; font-weight: bold; }

.main-btn, .secondary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 35px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    transition: 0.2s;
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
    margin-top: 25px;
    width: 100%;
    max-width: 260px;
}
.main-btn:hover, .secondary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(255, 71, 87, 0.6);
}

/* -----------------------------------------
   8. MEDIA QUERIES (MOBILE)
   ----------------------------------------- */
@media (max-width: 480px) {
    .spotify-card {
        width: 95%;
        height: auto;
        min-height: 560px;
        padding-bottom: 20px;
    }
    .playlist-sidebar { padding-top: 60px; }
    .poem-container h1 { font-size: 1.8rem; }
    .glass-panel { padding: 1.5rem; }
    .play-big { width: 55px; height: 55px; }
    .music-icon-large { width: 90px; height: 90px; }
}

/* -----------------------------------------
   9. MAGIC ANIMATIONS (جادوی نهایی)
   ----------------------------------------- */

/* الف) ضربان قلب برای پلیر */
@keyframes heartbeat {
    0% { transform: scale(1); box-shadow: 0 15px 35px rgba(0,0,0,0.3); }
    15% { transform: scale(1.05); box-shadow: 0 20px 50px rgba(255, 71, 87, 0.4); }
    30% { transform: scale(1); box-shadow: 0 15px 35px rgba(0,0,0,0.3); }
    45% { transform: scale(1.05); box-shadow: 0 20px 50px rgba(255, 71, 87, 0.4); }
    60% { transform: scale(1); box-shadow: 0 15px 35px rgba(0,0,0,0.3); }
    100% { transform: scale(1); }
}

.playing-beat {
    animation: heartbeat 1.2s infinite ease-in-out;
    border: 2px solid var(--primary);
    color: var(--primary) !important;
}

/* ب) شناور بودن پنل جشن */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

.floating-content {
    animation: float 4s ease-in-out infinite;
}

/* ج) نشانگر تایپ رایتر */
.cursor-blink {
    border-left: 2px solid var(--primary); /* در حالت RTL سمت چپ */
    animation: blink 0.75s step-end infinite;
}

@keyframes blink {
    from, to { border-color: transparent }
    50% { border-color: var(--primary) }
}

/* استایل دکمه بازگشت متنی */
.text-link-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9rem;
    margin-top: 15px;
    cursor: pointer;
    transition: 0.3s;
    border-bottom: 1px dashed transparent;
}

.text-link-btn:hover {
    color: white;
    border-bottom-color: var(--primary); /* خط زیرش رنگی میشه وقتی موس میره روش */
    transform: translateX(-5px); /* یه حرکت ریز به سمت راست (چون RTL هستیم یعنی عقب) */
}

/* =========================================
   FIX FOR SCENE 1 SCROLLING
   ========================================= */

/* تنظیمات اختصاصی برای صفحه اول که محتوای طولانی دارد */
#scene-intro {
    justify-content: flex-start; /* چیدمان از بالا شروع شود نه از وسط */
    align-items: center;         /* افقی وسط باشد */
    overflow-y: auto;            /* اجازه اسکرول عمودی */
    padding-top: 40px;           /* فاصله مناسب از بالای صفحه */
    padding-bottom: 80px;        /* فاصله از پایین برای راحت خواندن متن آخر */
    height: 100vh;               /* ارتفاع کامل */
    
    /* برای اسکرول نرم در موبایل */
    -webkit-overflow-scrolling: touch; 
}

/* مخفی کردن اسکرول‌بار زشت در کروم/سافاری ولی حفظ قابلیت اسکرول */
#scene-intro::-webkit-scrollbar {
    width: 6px;
}
#scene-intro::-webkit-scrollbar-track {
    background: transparent;
}
#scene-intro::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* اصلاح فاصله باکس متن */
.poem-container {
    margin-top: 20px;
    margin-bottom: 40px;
    /* بقیه استایل‌هایی که قبلا دادم سر جایشان باشند */
}