/* ==========================================================================
   Base Responsive & Mobile Navigation Styles
   Files: base-responsive.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Breakpoint: Laptop / Desktop Small (Max-width: 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .header__top {
        gap: 16px;
        padding: 14px 16px;
    }

    .header__search {
        max-width: 400px;
    }

    .nav__list {
        gap: 20px;
    }

    .nav__link {
        font-size: 13px;
    }

    footer.footer .footer__main {
        grid-template-columns: 1fr 1fr !important;
        gap: 24px !important;
    }

    footer.footer .footer__trust-bar {
        justify-content: center !important;
        gap: 20px !important;
    }
}

/* --------------------------------------------------------------------------
   2. Breakpoint: Tablet & Mobile Off-canvas Nav (Max-width: 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    /* Header layout for mobile */
    .header__top {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 12px;
    }

    .header__logo-area {
        order: 1;
    }

    .header__user-actions {
        order: 2;
        gap: 12px;
    }

    /* Move search bar to full row below header top actions */
    .header__search-form {
        order: 3;
        width: 100%;
    }

    .header__search {
        max-width: 100%;
        padding: 2px 4px 2px 12px;
    }

    .header__search-select {
        display: none; /* Hide category select in mobile search bar to save space */
    }

    /* Display Hamburger Button */
    .header__hamburger {
        display: flex !important;
    }

    /* Off-Canvas Navigation Drawer Setup */
    .nav {
        position: fixed;
        top: 0;
        right: -300px;
        width: 280px;
        height: 100vh;
        background-color: var(--color-dark-bg, #1a1c1e);
        z-index: 1000;
        border-top: none;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
        transition: right var(--transition-normal, 0.4s ease);
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .nav--open {
        right: 0 !important;
    }

    .nav__drawer-header {
        display: flex !important;
    }

    .nav__container {
        padding: 20px 16px;
        flex: 1;
    }

    .nav__list {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0;
        padding: 0;
    }

    .nav__item {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .nav__link {
        display: block;
        padding: 14px 8px;
        width: 100%;
        font-size: 14px;
        color: rgba(255, 255, 255, 0.85);
    }

    .nav__link--active::after {
        display: none; /* Remove horizontal underline in vertical drawer */
    }

    .nav__link--active {
        color: var(--color-accent, #c8783f);
        font-weight: 700;
        background-color: rgba(255, 255, 255, 0.03);
        border-radius: 6px;
    }

    /* تغییرات جدید برای قرارگیری مطالب فوتر در کنار هم در تبلت و موبایل */
    footer.footer .footer__main {
        grid-template-columns: repeat(2, 1fr) !important; /* ۲ ستون در کنار هم */
        gap: 24px 16px !important;
    }

    /* ستون برند (درباره ما) عرض کامل را بگیرد تا ۳ ستون بعدی در ۲ ستون کنار هم چیده شوند */
    footer.footer .footer__col--brand {
        grid-column: 1 / -1 !important;
    }

    /* نوار اعتماد (Trust Bar) به صورت 2 یا 3 ستونه در کنار هم */
    footer.footer .footer__trust-bar {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        gap: 16px 12px !important;
    }

    footer.footer .trust-item {
        width: calc(50% - 8px) !important; /* هر آیتم نصف عرض صفحه را می‌گیرد */
    }
}

/* --------------------------------------------------------------------------
   3. Breakpoint: Small Mobile Devices (Max-width: 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .header__logo-title {
        font-size: 13px;
    }

    .header__logo-tagline {
        display: none;
    }

    .header__action-btn span {
        display: none; /* Hide text on very small screens, keep icons accessible */
    }

    .header__action-btn {
        padding: 4px;
    }

    /* در موبایل‌های بسیار کوچک هم همچنان ۲ ستونه بمانند تا فشرده نشوند */
    footer.footer .footer__main {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px 12px !important;
    }

    footer.footer .footer__col--brand {
        grid-column: 1 / -1 !important;
    }

    footer.footer .trust-item {
        width: calc(50% - 6px) !important;
    }
}

@media (max-width: 480px) {
    /* جلوگیری از مخفی شدن دکمه ورود/ثبت نام در موبایل */
    a.header__action-btn,
    .login-btn,
    .header__action-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
    }

    /* مطمئن شدن از نمایش متن داخل دکمه */
    .header__action-btn span {
        display: inline-block !important;
    }
}
