/* ============================================================
   Night Engine Styles v12.0.0 Professional (Improved UI + Master Volume + Private Talk + Member Cards)
   ============================================================ */

/* ========== انیمیشن‌های پایه ========== */
@keyframes nightFloaty {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes nightRotateBg {
    100% { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes urgentPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bombPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255,0,0,0.3); }
    50% { box-shadow: 0 0 25px rgba(255,0,0,0.6); }
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(241,196,15,0.4); }
    50% { box-shadow: 0 0 50px rgba(241,196,15,0.9); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 8px #2ecc71; }
    50% { box-shadow: 0 0 18px #2ecc71; }
}

/* ========== استیج اصلی شب ========== */
.mafia-night-stage {
    animation: fadeInUp 0.5s ease;
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ========== کارت‌های گرید بازیکنان ========== */
.player-grid-card {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid rgba(255,255,255,0.08);
    position: relative;
    overflow: hidden;
}

.player-grid-card:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(-3px);
}

.player-grid-card.active {
    border-color: #2ecc71 !important;
    background: rgba(46,204,113,0.12) !important;
    box-shadow: 0 0 25px rgba(46,204,113,0.4);
    transform: scale(1.02);
}

.player-grid-card.done {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.7);
}

.player-grid-card img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(241,196,15,0.5);
    margin-bottom: 10px;
}

.player-grid-card.active img {
    border-color: #2ecc71;
    box-shadow: 0 0 25px rgba(46,204,113,0.5);
}

.player-grid-card .grid-name {
    font-weight: bold;
    color: #fff;
    font-size: 1.05em;
}

.player-grid-card .grid-seat {
    font-size: 0.85em;
    color: #f1c40f;
}

.player-grid-card .grid-role {
    font-size: 0.8em;
    color: #aaa;
}

.player-grid-card .grid-status {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 1.2em;
}

/* ========== باکس‌های نقش (اکشن شب) ========== */
.role-action-box {
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}

.role-action-box h4 {
    color: #f1c40f;
    margin: 0 0 12px 0;
    font-size: 1.1em;
    text-align: center;
}

.role-action-box select,
.role-action-box input[type="text"],
.role-action-box input[type="number"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(0,0,0,0.5);
    border: 1px solid #555;
    border-radius: 12px;
    color: #fff;
    font-family: 'iran', sans-serif;
    font-size: 0.95em;
}

.role-action-box select:focus,
.role-action-box input:focus {
    outline: none;
    border-color: #f1c40f;
    box-shadow: 0 0 10px rgba(241,196,15,0.2);
}

.role-action-box button {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'iran', sans-serif;
    transition: all 0.3s;
    margin: 4px;
}

.role-action-box .btn-shot {
    background: #e74c3c;
    color: #fff;
}

.role-action-box .btn-save {
    background: #3498db;
    color: #fff;
}

.role-action-box .btn-buy {
    background: #f1c40f;
    color: #000;
}

.role-action-box .btn-special {
    background: #9b59b6;
    color: #fff;
}

.role-action-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* ========== تایمر اضطراری ========== */
.urgent-timer {
    color: #ff4757 !important;
    text-shadow: 0 0 35px rgba(255,71,87,0.7) !important;
    animation: urgentPulse 0.6s infinite;
}

/* ========== اسلایدر صدا ========== */
#welcome-volume-slider,
.volume-slider,
#master-volume-slider {
    cursor: pointer !important;
}

#welcome-volume-slider:disabled,
.volume-slider:disabled,
#master-volume-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== نشانگر بمب (انیمیشن) ========== */
.bomb-badge {
    background: #ff0000;
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    margin: 3px 2px;
    font-weight: bold;
    display: inline-block;
    animation: bombPulse 1s infinite;
}

/* ========== اسکرول بار سفارشی ========== */
.mafia-night-stage::-webkit-scrollbar {
    width: 8px;
}

.mafia-night-stage::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}

.mafia-night-stage::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #f1c40f, #e67e22);
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.3);
}

/* ========== استایل‌های مرحله آمادگی کاربران (user-ready-check) ========== */
.user-ready-card {
    background: linear-gradient(145deg, rgba(25,30,50,0.9), rgba(15,18,35,0.95));
    border-radius: 24px;
    padding: 18px 12px;
    text-align: center;
    border: 2px solid rgba(241,196,15,0.3);
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    position: relative;
}

.user-ready-card.ready {
    border-color: #2ecc71;
    background: linear-gradient(145deg, rgba(46,204,113,0.15), rgba(30,40,60,0.95));
    box-shadow: 0 0 25px rgba(46,204,113,0.4);
}

.user-ready-card img {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #f1c40f;
    margin-bottom: 12px;
}

.player-name-ready {
    font-weight: bold;
    font-size: 1.2em;
    margin: 5px 0 3px;
    color: #fff;
}

.player-seat-ready {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 12px;
}

.status-badges {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin: 12px 0;
    flex-wrap: wrap;
}

.badge-item {
    background: rgba(0,0,0,0.4);
    border-radius: 30px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
}

.badge-item.active {
    background: rgba(46,204,113,0.2);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.badge-item.inactive {
    background: rgba(231,76,60,0.15);
    color: #e74c3c;
    border: 1px solid rgba(231,76,60,0.4);
}

.ready-status-text {
    margin-top: 12px;
    padding: 6px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    transition: 0.2s;
}

.ready-status-text.waiting {
    background: rgba(241,196,15,0.15);
    color: #f1c40f;
}

.ready-status-text.done {
    background: rgba(46,204,113,0.2);
    color: #2ecc71;
}

.checkmark-full {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 22px;
    color: #2ecc71;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

/* ========== کارت‌های اعضای مافیا / اوشن (با دکمه صحبت خصوصی) ========== */
.member-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(231,76,60,0.1);
    border: 1px solid rgba(231,76,60,0.25);
    border-radius: 14px;
    padding: 12px;
    margin: 6px;
    transition: all 0.3s ease;
}

.member-card:hover {
    background: rgba(231,76,60,0.2);
    transform: translateY(-2px);
}

.member-card img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(241,196,15,0.6);
}

.member-name {
    font-weight: bold;
    color: #ffffff;
}

.member-role {
    font-size: 0.8em;
    color: #aaaaaa;
}

.private-talk-btn {
    background: #2ecc71;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    color: #000;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.private-talk-btn:hover {
    transform: scale(1.05);
    background: #f1c40f !important;
    color: #000 !important;
}

/* ========== کنترل صدای مستر (Master Volume Control) ========== */
#master-volume-control {
    background: rgba(0,0,0,0.5);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #f1c40f;
}

#master-volume-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    border-radius: 3px;
    outline: none;
}

#master-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #f1c40f;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px #f1c40f;
    border: 2px solid #fff;
}

#master-mute-btn {
    background: #2ecc71;
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 20px;
    border: none;
    color: #000;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

#master-mute-btn:hover {
    transform: scale(1.05);
}

/* ========== نشانگر میکروفن گرداننده ========== */
#moderator-mic-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    justify-content: center;
    padding: 5px 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 20px;
}

.mic-wave {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e74c3c;
    transition: all 0.3s;
}

.mic-text {
    color: #e74c3c;
    font-size: 11px;
    font-weight: bold;
}

/* ========== دکمه شروع میکروفن گرداننده ========== */
#moderator-mic-toggle {
    background: #f1c40f;
    color: #000;
    border: none;
    padding: 8px 15px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

#moderator-mic-toggle:hover {
    transform: scale(1.02);
    background: #e67e22;
}

/* ========== دکمه‌های کنترل تایمر ========== */
.btn-game-v2 {
    padding: 8px 16px;
    border-radius: 25px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'iran', sans-serif;
}

.btn-game-v2:hover {
    transform: translateY(-2px);
}

/* ========== کارت‌های گزارش شب ========== */
.report-card {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.report-card h3 {
    margin: 0 0 15px 0;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.report-item:hover {
    background: rgba(255,255,255,0.08);
}

.report-item img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(241,196,15,0.4);
    margin-left: 12px;
}

.report-item .report-name {
    font-weight: bold;
    color: #ffffff;
}

.report-item .report-detail {
    font-size: 0.8em;
    color: #888888;
}

/* ========== مودال Override (گرداننده) ========== */
#night-override-modal .modal-content {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 3px solid #e74c3c;
    border-radius: 30px;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    direction: rtl;
    color: #fff;
    box-shadow: 0 0 60px rgba(231,76,60,0.4);
}

#night-override-modal .modal-title {
    color: #e74c3c;
    font-size: 24px;
    margin-bottom: 10px;
    text-align: center;
}

/* ========== لیست اکشن‌های معلق ========== */
.pending-actions {
    max-height: 400px;
    overflow-y: auto;
}

.pending-action-item {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.pending-action-item .btn-approve,
.pending-action-item .btn-reject {
    padding: 6px 12px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

/* ========== بنرهای وضعیت ========== */
.bomb-banner {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    padding: 12px;
    border-radius: 15px;
    margin-bottom: 10px;
    text-align: center;
    animation: bombBlink 1.5s infinite;
    border: 2px solid #ff0000;
}

.silence-banner {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: #fff;
    padding: 10px;
    border-radius: 15px;
    margin-bottom: 10px;
    text-align: center;
}

.extra-time-banner {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    padding: 8px;
    border-radius: 15px;
    margin-bottom: 10px;
    text-align: center;
}

/* ========== نوتیفیکیشن بزرگ اکشن ========== */
.night-action-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a1a2e, #0f0f1a);
    border: 3px solid #f1c40f;
    border-radius: 20px;
    padding: 20px 35px;
    color: #fff;
    z-index: 100001;
    text-align: center;
    box-shadow: 0 0 80px rgba(241,196,15,0.5);
    animation: fadeInUp 0.3s ease-out;
    min-width: 350px;
}

/* ========== رسپانسیو ========== */
@media (max-width: 1200px) {
    #mafia-night-stage-3 > div,
    #mafia-night-stage-4 > div {
        flex-direction: column;
    }
    #mafia-mod-panel,
    #citizen-mod-panel {
        min-height: 350px;
    }
}

@media (max-width: 768px) {
    .player-grid-card img {
        width: 60px;
        height: 60px;
    }
    .player-grid-card {
        padding: 10px 6px;
    }
    .player-grid-card .grid-name {
        font-size: 0.85em;
    }
    .role-action-box button {
        padding: 8px 16px;
        font-size: 0.8em;
    }
    .member-card {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
    .private-talk-btn {
        width: 100%;
        margin-top: 5px;
    }
    .night-action-notification {
        min-width: 280px;
        padding: 15px 25px;
    }
}

@media (max-width: 480px) {
    .status-badges {
        flex-direction: column;
        align-items: center;
    }
    .badge-item {
        width: 90%;
        justify-content: center;
    }
}

/* ========== کلاس‌های کمکی ========== */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 8px;
}

.mb-2 {
    margin-bottom: 8px;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

.w-100 {
    width: 100%;
}

/* ========== انیمیشن ورود پیام چت ========== */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.chat-message-new {
    animation: messageSlideIn 0.2s ease-out;
}