: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;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}
.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;}

@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); }
}

/* راهنما */
.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 {
    perspective: 1000px;
    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: rotateX(-45deg);
    box-shadow: 0 15px 30px rgba(14, 165, 233, 0.15);
    border-top: 4px solid #38bdf8;
    border-radius: 10px 10px 0 0;
    margin-bottom: 50px;
}

.seat-map {
    display: inline-grid;
    grid-template-columns: repeat(5, 32px) 40px repeat(5, 32px);
    gap: 12px;
    padding: 0 20px;
    direction: rtl;
    justify-content: center;
}
.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);
}

/* انیمیشن دقیق کلیک */
.seat:not(.sold):not(.pending):hover {
    background-color: #cbd5e1;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.seat:not(.sold):not(.pending):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;
}
.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: 1000;
    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); }

/* --- استایل‌های واکنش‌گرا (موبایل) --- */
@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;
    }
    .seat-map {
        gap: 6px;
        grid-template-columns: repeat(5, 26px) 20px repeat(5, 26px);
        padding: 0 10px;
    }
    .seat {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
    }
    .aisle {
        width: 20px;
    }
}