:root {
    --bg-light: #f0f8ff;
    --panel-bg: #ffffff;
    --seat-available: #e2e8f0;
    --seat-selected: #0ea5e9; /* آبی آسمانی شاد */
    --seat-pending: #fbbf24; /* زرد آفتابی */
    --seat-sold: #f43f5e; /* قرمز-صورتی شاد */
    --text-main: #334155;
    --shadow-soft: 0 10px 25px rgba(0,0,0,0.05);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: linear-gradient(135deg, #f0f8ff 0%, #e0f2fe 100%);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    padding-bottom: 150px !important; /* افزایش فضای خالی برای حل قطعی افتادن نوار روی محتوا */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

/* دکمه خروج مستقل در بالاترین نقطه سایت (چسبیده به هدر) */
.logout-float {
    position: absolute; /* این ویژگی باعث قفل شدن دکمه در بالای سایت می‌شود */
    top: 20px;
    left: 20px;
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
    padding: 8px 15px;
    border-radius: 8px;
    font-family: 'Vazirmatn';
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.1);
    z-index: 9999;
    transition: 0.3s;
}
.logout-float:hover {
    background: #ef4444;
    color: white;
}
.header h1 {
    font-family: 'Lalezar', cursive;
    font-size: 2.8rem;
    margin-bottom: 5px;
    text-align: center;
    color: #0284c7;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    font-weight: normal;
}

.header p {
    color: #64748b;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
}

/* --- استایل‌های رویداد داینامیک --- */
.header { position: relative; }
.event-badge {
    background: linear-gradient(45deg, #f43f5e, #fb923c);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 10px;
    animation: pulse 2s infinite;
}
.event-details {
    display: flex; gap: 20px; justify-content: center; margin-bottom: 15px;
    background: white; padding: 10px 20px; border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 1px dashed #bae6fd;
    white-space: nowrap; /* تاریخ و ساعات به صورت یک‌خطی نمایش داده شوند */
    flex-wrap: nowrap; /* اجبار به یک خطی ماندن در همه رزولوشن‌ها */
    overflow-x: auto;
}
.event-details span { color: #475569; font-size: 0.95rem; }
.event-details strong { color: #0284c7; font-family: 'Vazirmatn'; font-size: 1.1rem;}

/* --- انیمیشن‌های تبلیغات اسپانسر (تم نئون حرفه‌ای) --- */
.sponsor-card {
    width: 100%; max-width: 400px; margin: 30px auto 10px auto;
    background: linear-gradient(145deg, #0f172a, #1e293b);
    border: 1px solid #38bdf8;
    border-radius: 16px; padding: 25px 20px;
    /* هاله نور درخشان اطراف کارت */
    box-shadow: 0 0 25px rgba(14, 165, 233, 0.4), inset 0 0 15px rgba(14, 165, 233, 0.1);
    position: relative; text-align: center;
}
.sponsor-card > * { opacity: 0; transform: translateY(15px); }
.sponsor-card.show-anim > * { animation: slideUpFade 0.6s ease forwards; }

.sponsor-title {
    margin: 0 0 12px 0; color: #ffffff; font-family: 'Lalezar', cursive; font-size: 1.8rem;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.8), 0 0 20px rgba(56, 189, 248, 0.5);
}
/* افکت لرزش برای جلب توجه متن اصلی */
.neon-shake {
    animation: neonShakeAnim 4s infinite;
}
.sponsor-card.show-anim .sponsor-title { animation: slideUpFade 0.6s ease forwards 0.2s, neonShakeAnim 4s infinite 2s; }

@keyframes neonShakeAnim {
    0%, 90% { transform: translate(0, 0); }
    92% { transform: translate(-3px, 2px); }
    94% { transform: translate(3px, -2px); }
    96% { transform: translate(-3px, -2px); }
    98% { transform: translate(3px, 2px); }
    100% { transform: translate(0, 0); }
}

.sponsor-offer {
    font-size: 1.05rem; color: #e2e8f0; font-weight: bold; margin: 0 0 12px 0;
}
.sponsor-offer span { color: #facc15; font-size: 1.4rem; margin: 0 4px; text-shadow: 0 0 10px rgba(250, 204, 21, 0.5); }
.sponsor-card.show-anim .sponsor-offer { animation-delay: 0.4s; }

.sponsor-features {
    font-size: 0.95rem; color: #34d399; font-weight: bold; margin: 0 auto 15px auto;
    background: rgba(16, 185, 129, 0.15); display: inline-block; padding: 6px 15px; border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.3); box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}
.sponsor-card.show-anim .sponsor-features { animation-delay: 0.6s; }

.sponsor-contact {
    background: rgba(15, 23, 42, 0.6); padding: 12px; border-radius: 10px; font-size: 0.95rem; color: #e2e8f0; border: 1px dashed #334155;
}
.sponsor-card.show-anim .sponsor-contact { animation-delay: 0.8s; }

.sponsor-badge {
    position: absolute; top: -15px; left: 50%; transform: translateX(-50%) scale(0);
    background: #ef4444; color: white; padding: 6px 15px; border-radius: 20px;
    font-size: 0.85rem; font-weight: bold; box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
    opacity: 0; white-space: nowrap; z-index: 1;
}
.sponsor-card.show-anim .sponsor-badge {
    animation: popInBadgeCenter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards 1s, pulseBadge 2s infinite 1.5s;
}

@keyframes slideUpFade {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes popInBadgeCenter {
    0% { transform: translateX(-50%) scale(0); opacity: 0; }
    80% { transform: translateX(-50%) scale(1.1); opacity: 1; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}
@keyframes pulseBadge {
    0% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
    100% { transform: translateX(-50%) scale(1); }
}
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

/* انیمیشن معلق بودن پوستر و نئون لایت */
@keyframes floatPoster {
    0% { transform: translateY(0px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
    50% { transform: translateY(-8px); box-shadow: 0 20px 30px rgba(14, 165, 233, 0.25); }
    100% { transform: translateY(0px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
}

/* راهنما */
.guide {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    background: var(--panel-bg);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-soft);
}
.guide-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #334155;
    font-weight: 600;
}
.seat-sample {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}
.seat-sample.available { background: var(--seat-available); }
.seat-sample.selected { background: var(--seat-selected); box-shadow: 0 0 10px rgba(14,165,233,0.6); }
.seat-sample.pending { background: var(--seat-pending); }
.seat-sample.sold { background: var(--seat-sold); }

/* نقشه صندلی‌ها */
.cinema-container {
     margin-bottom: 40px;
     width: 100%;
     max-width: 100%;
     overflow-x: auto;
     padding-bottom: 20px;
     display: flex;
     flex-direction: column;
     align-items: center; /* تراز قطعی و مرکزی صحنه و صندلی‌ها */
}
.screen {
     background: linear-gradient(to bottom, #bae6fd, transparent);
     height: 70px;
     width: 100%;
     max-width: 520px;
     transform: perspective(1000px) rotateX(-45deg);
     transform-origin: bottom center; /* ثابت نگه داشتن لبه پایین روی زمین */
     box-shadow: 0 15px 30px rgba(14, 165, 233, 0.15);
     border-top: 4px solid #38bdf8;
     border-radius: 10px 10px 0 0;
     margin: 0 0 50px 0; /* حذف auto به دلیل استفاده از flex */
}

.seat-map {
     display: grid; 
     /* لیبل ردیف + ۴ صندلی + راهرو + ۶ صندلی + راهرو + ۴ صندلی (اصلاح شده طبق عکس) */
     grid-template-columns: 25px repeat(4, 32px) 35px repeat(6, 32px) 35px repeat(4, 32px);
     gap: 10px;
     padding: 0 10px;
     direction: rtl;
     justify-content: center;
     margin: 0; 
}
.row-label {
     display: flex;
     align-items: center;
     justify-content: center;
     font-weight: bold;
     color: #ef4444;
     font-size: 1.1rem;
}
.seat.empty-space {
     background: transparent !important;
     box-shadow: none !important;
     cursor: default;
}
.seat.disabled {
     background-color: #94a3b8 !important;
     color: white;
     cursor: not-allowed;
     box-shadow: none;
     transform: none !important;
}
.seat {
    width: 32px;
    height: 32px;
    background-color: var(--seat-available);
    border-radius: 8px 8px 4px 4px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: bold;
    user-select: none;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
/* محدود کردن انیمیشن هاور فقط به کامپیوترها تا در موبایل رنگ‌ها گیر نکنند */
@media (hover: hover) {
    .seat:not(.sold):not(.pending):not(.selected):hover {
        background-color: #cbd5e1;
        transform: translateY(-3px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }
}
.seat:not(.sold):not(.pending):not(.selected):active {
    transform: scale(0.9);
}
.seat.selected {
    background-color: var(--seat-selected);
    color: white;
    transform: scale(1.15);
    box-shadow: 0 8px 15px rgba(14, 165, 233, 0.4);
}
.seat.pending {
    background-color: var(--seat-pending);
    color: white;
    cursor: not-allowed;
    opacity: 0.9;
}
.seat.sold {
    background-color: var(--seat-sold);
    color: white;
    cursor: not-allowed;
}
.aisle { width: 40px; }

/* پنل پرداخت */
.checkout-panel {
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-soft);
    width: 100%;
    max-width: 320px;
    margin-bottom: 30px; /* فاصله گرفتن ایمن پنل از نوار پایین */
    position: relative;
    z-index: 10;
}
.panel-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1.1rem;
}
#payButton {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--seat-selected);
    color: white;
    border: none;
    padding: 14px;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: 700;
    transition: all 0.3s;
}
#payButton:disabled {
    background-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
}
#payButton:not(:disabled):hover {
    background-color: #0284c7;
    box-shadow: 0 8px 15px rgba(2, 132, 199, 0.3);
    transform: translateY(-2px);
}
.support-text {
    margin-top: 15px;
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
}
.support-text a {
    color: #0ea5e9;
    text-decoration: none;
    font-weight: bold;
}

/* --- استایل‌های مودال پرداخت --- */
.modal-overlay {
    display: none;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10000; /* باگ فیکس: افزایش لایه به عدد ده‌هزار برای قرارگیری قطعی روی نوار پایین */
    justify-content: center; align-items: center;
}
.modal-content {
    background: #ffffff; padding: 30px; border-radius: 16px;
    width: 90%; max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2); text-align: center;
}
.modal-content h2 { margin-top: 0; color: #0284c7; font-family: 'Lalezar', cursive; font-size: 2rem;}
.modal-warning { font-size: 0.85rem; color: #f43f5e; font-weight: bold; margin-bottom: 15px;}
.amount-box {
    background: #f0fdf4; border: 2px dashed #22c55e;
    color: #166534; font-size: 1.8rem; font-weight: bold;
    padding: 15px; border-radius: 12px; margin-bottom: 20px;
}
.card-info { 
    background: #f8fafc; padding: 15px; border-radius: 8px; 
    margin-bottom: 20px; text-align: right; border: 1px solid #e2e8f0; 
}
.card-info p { margin: 8px 0; font-size: 0.95rem; color: #334155; }
.card-info strong { color: #0f172a; font-size: 1.1rem; font-family: sans-serif; letter-spacing: 1px;}
.eitaa-guide { font-size: 0.85rem; color: #64748b; margin-bottom: 15px; line-height: 1.6; }
.eitaa-guide strong { color: #0ea5e9; font-weight: bold;}
#trackingInput {
    width: 100%; padding: 12px; border: 1px solid #cbd5e1;
    border-radius: 8px; font-family: 'Vazirmatn'; margin-bottom: 20px; 
    box-sizing: border-box; text-align: center; font-size: 1rem; outline: none;
}
#trackingInput:focus { border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,0.2); }
.modal-buttons { display: flex; gap: 10px; }
.modal-buttons button {
    flex: 1; padding: 12px; border: none; border-radius: 8px; 
    font-family: 'Vazirmatn'; font-weight: bold; cursor: pointer; transition: 0.3s;
}
#cancelModal { background: #e2e8f0; color: #475569; }
#cancelModal:hover { background: #cbd5e1; }
#confirmModal { background: #0ea5e9; color: white; }
#confirmModal:hover { background: #0284c7; transform: translateY(-2px); }

/* --- نوار ناوبری پایین (اپلیکیشنی) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    background: #ffffff;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.15);
    z-index: 9999;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0 15px 0;
    border-radius: 25px 25px 0 0;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    color: #64748b;
    transition: 0.3s;
    flex: 1;
    text-decoration: none;
}
.nav-item:hover { color: #0ea5e9; }
.text-danger:hover { color: #ef4444; }
.nav-icon { font-size: 1.5rem; margin-bottom: 2px; }
.nav-text { font-size: 0.85rem; font-weight: bold; font-family: 'Vazirmatn'; }

/* استایل دکمه مرکزی با بیرون‌زدگی */
.nav-item.highlight {
    transform: translateY(-25px);
}
.glow-wrapper {
    position: relative;
    width: 65px;
    height: 65px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.2);
}
/* افکت نور چرخان دور دکمه */
.glow-border {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #0ea5e9, #38bdf8, #bae6fd, transparent 60%);
    animation: spinGlow 2s linear infinite;
    z-index: -1;
}
/* ماسک سفید مرکزی روی نور */
.glow-wrapper::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: #ffffff;
    border-radius: 50%;
    z-index: 0;
}
.nav-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #0284c7;
}

@keyframes spinGlow {
    100% { transform: rotate(360deg); }
}

/* --- استایل‌های واکنش‌گرا (موبایل) --- */
@media (max-width: 768px) {
    body { padding: 10px; }
    .header h1 { font-size: 1.8rem; }
    .event-details { flex-direction: row; gap: 10px; text-align: center; justify-content: center; flex-wrap: nowrap; white-space: nowrap; font-size: 0.9rem; padding: 10px; }
    .guide { flex-wrap: wrap; justify-content: center; font-size: 0.85rem; padding: 10px; }
    .checkout-panel { width: 100%; max-width: 100%; padding: 15px; }
    .modal-content { padding: 20px; width: 95%; }
    .modal-content h2 { font-size: 1.5rem; }
    .modal-buttons { flex-direction: column; }
    .amount-box { font-size: 1.4rem; padding: 10px; }
    
 /* ایجاد اسکرول لبه‌به‌لبه (Edge-to-Edge) با خنثی کردن پدینگ بادی */
    .cinema-container {
        width: calc(100% + 20px);
        margin-left: -10px;
        margin-right: -10px;
        padding-left: 0;
        padding-right: 0;
    }
    /* حل ریشه‌ای بیرون‌زدگی ستون‌ها در گوشی */
    .screen {
        width: 90%;
        max-width: 400px;
        margin: 0 0 20px 0; /* کاهش فضای خالی اضافی زیر صحنه برای جا شدن کامل دکمه در کادر تصویر */
    }
   .cinema-container {
        width: 100%;
        overflow-x: auto; /* اضافه شدن اسکرول افقی نرم برای گوشی‌های بسیار کوچک */
        padding: 10px 0;
    }
    .seat-map {
         gap: 3px;
         grid-template-columns: 15px repeat(4, 16px) 8px repeat(6, 16px) 8px repeat(4, 16px);
         padding: 0 5px;
         justify-content: center;
         margin: 0 auto;
    }
    .seat {
        width: 16px;
        height: 16px;
        font-size: 0.55rem;
        border-radius: 3px;
    }
    .row-label {
        font-size: 0.75rem;
    }
    .aisle {
        width: 8px;
    }
}

/* --- افکت حرفه‌ای لرزش و چشمک اخطار (مدیریت شده توسط جاوااسکریپت) --- */
@keyframes professionalShakeBlink {
    0% { transform: scale(1) translateX(0); background-color: transparent; color: #ef4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
    15% { transform: scale(1.02) translateX(-4px); background-color: #ef4444; color: #ffffff; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4); }
    30% { transform: scale(1.02) translateX(4px); background-color: #ef4444; color: #ffffff; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4); }
    45% { transform: scale(1.02) translateX(-4px); background-color: #ef4444; color: #ffffff; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4); }
    60% { transform: scale(1.02) translateX(4px); background-color: #ef4444; color: #ffffff; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4); }
    100% { transform: scale(1) translateX(0); background-color: #fef2f2 !important; color: #dc2626 !important; box-shadow: inset 0 0 0 1.5px #f87171 !important; }
}
.shake-warning {
    display: block !important; /* تبدیل اجباری برای پذیرش افکت Transform */
    animation: professionalShakeBlink 0.65s cubic-bezier(0.25, 1, 0.5, 1) forwards !important;
}