/* ============================================================
 *  responsive.css — ریسپانسیو سراسری (افزایشی / override)
 *  این فایل آخر از همه لود می‌شود و فقط برای صفحه‌های کوچک override می‌کند.
 *  دسکتاپ دست‌نخورده می‌ماند. RTL-aware.
 * ============================================================ */

/* ---- ایمنی سراسری (همه‌ی اندازه‌ها) ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video, iframe { max-width: 100%; height: auto; }
img { object-fit: cover; }

/* جدول‌ها به‌جای سرریز، اسکرول افقی شوند */
.table-container,
.leaderboard-table,
.clan-members-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- تبلت (<= 992px) ---- */
@media (max-width: 992px) {
    .vip-grid,
    .vehicle-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .nav-container,
    .container,
    .leaderboard-container {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }
}

/* ---- موبایل (<= 768px) ---- */
@media (max-width: 768px) {

    /* ---- هدر موبایل: کشوی تمام‌صفحه‌ی تمیز (روی همه صفحات کار می‌کند) ---- */
    .nav-toggle { display: flex !important; }
    .nav-menu {
        position: fixed;
        left: -100%;
        right: auto;
        top: 60px;
        z-index: 1001;
        width: 100%;
        height: calc(100vh - 60px);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        background: #080a08;
        border-top: 1px solid var(--border-color, rgba(162,239,110,.2));
        padding: 1rem 1.25rem 2.5rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transition: left 0.3s ease;
        text-align: right;
    }
    .nav-menu.active { left: 0; }
    .nav-menu li { width: 100%; list-style: none; }
    .nav-menu .nav-link {
        display: block;
        padding: 0.9rem 0.25rem;
        border-bottom: 1px solid rgba(162, 239, 110, 0.08);
        font-size: 1.05rem;
    }

    /* منوی کشویی نـاو روی موبایل: آکاردئونی داخل کشو (فقط با تپ باز می‌شود) */
    .nav-menu .nav-dropdown { width: 100%; }
    .nav-menu .nav-dropdown-toggle { justify-content: space-between; }
    .nav-menu .nav-dropdown-menu {
        position: static;
        display: none;
        width: 100%;
        min-width: 0;
        padding: 0;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: rgba(162, 239, 110, 0.04);
        animation: none;
    }
    .nav-menu .nav-dropdown:hover .nav-dropdown-menu { display: none; }
    .nav-menu .nav-dropdown.open .nav-dropdown-menu { display: block; }
    .nav-menu .nav-dropdown-menu a {
        text-align: right;
        padding: 0.8rem 1rem;
        border-bottom: 1px solid rgba(162, 239, 110, 0.06);
        font-size: 0.98rem;
    }
    .nav-menu .nav-dropdown-menu a:hover { padding-right: 1rem; background: rgba(162, 239, 110, 0.08); }

    .nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .nav-toggle.active span:nth-child(2) { opacity: 0; }
    .nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

    /* پیل اسکرپ تمام‌عرض و مرتب */
    .coin-section-wrapper {
        display: flex !important;
        justify-content: center;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
        margin: 0.85rem 0;
        padding-bottom: 0.85rem;
        border-bottom: 1px solid rgba(162, 239, 110, 0.08);
    }

    /* منوی کاربر: دراپ‌داونِ شناور به یک بخشِ ثابتِ بازِ داخل کشو تبدیل می‌شود */
    .user-menu-wrap { width: 100%; }
    .user-avatar-link { justify-content: flex-start; padding: 0.5rem 0.25rem; }
    .dropdown-content {
        position: static !important;
        top: auto !important;
        left: auto !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        width: 100% !important;
        min-width: 0 !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        margin-top: 0.25rem;
    }
    .dropdown-content::before { display: none !important; }
    .dropdown-content a {
        padding: 0.85rem 0.25rem;
        font-size: 0.95rem;
        justify-content: flex-start;
    }

    /* دکمه ورود (کاربر مهمان) تمام‌عرض */
    .nav-link-cta { display: block; text-align: center; width: 100%; margin-top: 0.75rem; }

    /* گریدها → تک یا دو ستون */
    .vip-grid,
    .vehicle-grid,
    .lb-cat-grid,
    .filters-grid,
    .clan-stats-grid {
        grid-template-columns: 1fr !important;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* فاصله‌ها و تیترها */
    .container,
    .leaderboard-container { padding-left: 1rem !important; padding-right: 1rem !important; }
    .hero { min-height: auto !important; padding: 5rem 0 3rem !important; }
    .section { padding: 2.5rem 0 !important; }

    /* مودال‌ها تمام‌عرض و اسکرول‌پذیر */
    .modal-contentt,
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* جدول‌ها: ستون‌ها له نشوند، کانتینر اسکرول شود */
    .leaderboard-table table { min-width: 560px; }
    .leaderboard-table th,
    .leaderboard-table td { padding: 0.7rem 0.6rem; font-size: 0.85rem; }

    /* اندازه لمسی + جلوگیری از زوم iOS */
    .btn, button, .tab-btn, .sort-btn, .page-btn { min-height: 44px; }
    input, select, textarea { font-size: 16px !important; }

    /* دکمه‌های هیرو تمام‌عرض */
    .hero-buttons { flex-direction: column; align-items: center; }
    .hero-buttons .btn { width: 100%; max-width: 320px; }

    /* کارت‌های آمار جمع‌وجور */
    .stat-number { font-size: 1.9rem !important; }
}

/* ---- موبایل کوچک (<= 480px) ---- */
@media (max-width: 480px) {
    .vip-grid,
    .vehicle-grid,
    .stats-grid,
    .lb-cat-grid,
    .filters-grid {
        grid-template-columns: 1fr !important;
    }
    .stat-number { font-size: 1.6rem !important; }
    .section-title { font-size: 1.6rem !important; }
    .tab-container { flex-wrap: wrap; }
    .leaderboard-table th,
    .leaderboard-table td { padding: 0.55rem 0.5rem; font-size: 0.8rem; }
    .vip-price { font-size: 1.6rem !important; }
}

/* احترام به کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
