/* ==========================================
   فایل: enfgar.css (طراحی VIP بازی انفجار - اصلاح شده)
========================================== */

/* تخته اصلی بازی */
.game-board {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

/* ================= محیط بوم (Canvas) ================= */
.stage {
    position: relative;
    width: 100%;
    height: 380px;
    background-color: #050914;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8), 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* انیمیشن لرزش هنگام انفجار */
@keyframes shake {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-3px, 3px) rotate(-1deg); }
    20%, 40%, 60%, 80% { transform: translate(3px, -3px) rotate(1deg); }
}

.stage.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
    border-color: var(--status-danger);
    box-shadow: inset 0 0 50px rgba(239, 68, 68, 0.2);
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* لایه رابط کاربری روی بوم (ضریب) */
.ui-layer {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.multiplier {
    font-size: 80px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: -2px;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    transition: color 0.2s, text-shadow 0.2s;
}

.multiplier.crashed {
    color: #ef4444;
    text-shadow: 0 0 50px rgba(239, 68, 68, 0.8);
}

/* ================= صفحه انتظار (تایمر) ================= */
.waiting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 9, 20, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.waiting-title {
    font-size: 18px;
    font-weight: bold;
    color: #cbd5e1;
}

.waiting-time {
    font-size: 60px;
    font-weight: 900;
    color: var(--text-gold);
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.4);
}

.progress-container {
    width: 60%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    width: 100%;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* ================= پنل شرط بندی ================= */
.bet-panel {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-radius: 24px;
}

.inputs-row {
    display: flex;
    gap: 12px;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0; /* ⭐️ حیاتی برای جلوگیری از بیرون‌زدگی فلکس‌باکس */
}

.input-group label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: bold;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    background-color: rgba(0, 0, 0, 0.25);
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    transition: box-shadow 0.3s, border-color 0.3s;
    width: 100%;
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--accent-glow);
}

body.theme-light .input-wrapper {
    background-color: rgba(255, 255, 255, 0.6);
}

.input-wrapper input {
    flex: 1;
    min-width: 0; /* ⭐️ جلوگیری از بیرون زدن اینپوت از کادر */
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 12px 10px;
    font-size: 16px;
    font-weight: 900;
    outline: none;
    direction: ltr;
    text-align: left;
}

.input-wrapper span.unit {
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: bold;
    flex-shrink: 0;
}

/* دکمه اتوماتیک */
.toggle-btn {
    width: 42px;
    flex-shrink: 0; /* جلوگیری از تغییر اندازه دکمه */
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: white;
    transition: background-color 0.3s;
}

.toggle-btn.on {
    background-color: var(--status-success);
}

.toggle-btn.off {
    background-color: var(--status-danger);
}

/* دکمه اکشن انفجار */
#enfgarActionBtn {
    font-size: 20px;
    padding: 16px;
    border-radius: 16px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn.bet {
    background: linear-gradient(135deg, var(--accent-primary), #2563eb);
    box-shadow: var(--accent-glow);
}

.btn.cancel {
    background: linear-gradient(135deg, var(--status-danger), #b91c1c);
    box-shadow: 0 5px 20px rgba(239, 68, 68, 0.4);
}

.btn.cashout {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 5px 20px rgba(245, 158, 11, 0.4);
}

.btn.disabled {
    background: rgba(128, 128, 128, 0.1);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

/* ================= نوار تاریخچه ================= */
.history-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    border-radius: 16px;
    overflow-x: auto;
    white-space: nowrap;
}

/* اسکرول‌بار سفارشی */
.history-bar::-webkit-scrollbar,
#enfgarSectionBets::-webkit-scrollbar,
#enfgarChatBox::-webkit-scrollbar {
    height: 4px;
    width: 4px;
}

.history-bar::-webkit-scrollbar-thumb,
#enfgarSectionBets::-webkit-scrollbar-thumb,
#enfgarChatBox::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
}

/* ================= پنل چت و بازیکنان ================= */
.tabs-container {
    border-radius: 20px;
}

#enfgarChatInput {
    background: transparent;
    border: none;
    color: var(--text-main);
    outline: none;
    width: 100%;
}

body.theme-light #enfgarChatInput {
    color: var(--text-main);
}