/* ==========================================================================
   موبایل — فاز ۹ (هات‌فیکس ۱۰)
   --------------------------------------------------------------------------
   فهرست ۷ موردی claude/mobile-todo-2026-09.md. همه‌چیز فقط زیر ۷۶۸px است و
   دسکتاپ هیچ تغییری نمی‌کند. این فایل از head.php و بعد از header.css
   بار می‌شود، پس فقط صفحه‌های سایت (و صفحهٔ ورود پنل) آن را می‌گیرند؛ داخل
   پنل مدیریت اثری ندارد.

   جلوی بعضی انتخاب‌گرها «body» آمده تا از قاعدهٔ هم‌وزن در css صفحه‌ها
   (catalog.css / cart.css / checkout.css که بعد از این فایل بار می‌شوند)
   عقب نماند.
   ========================================================================== */

@media (max-width: 768px) {

    /* ---------- ۱) هدر: از ۱۸۲px به حدود ۱۳۰px ----------
       نوار لوگو باریک‌تر، و خط «خوش آمدید / تاریخ و ساعت / متصل» در موبایل
       پنهان می‌شود (کلید حساب کاربری و نام در همان ردیف کلیدها هست).
       وضعیت «قطع اینترنت» اما همچنان دیده می‌شود، چون برای کاربر مهم است. */
    body .header-logo-col { height: 48px; }
    body .header-row-info { gap: 0; padding-top: 0; padding-bottom: 8px; }
    /* خوش‌آمدگویی در موبایل هم دیده می‌شود (درخواست ۱۴۰۵/۰۹/۰۴)؛ تاریخ/ساعت پنهان می‌ماند */
    body .header-row-info .welcome-text { display: block; flex: 1 1 100%; padding: 4px 0 0; }
    body .header-row-info .datetime-box,
    body .header-row-info .net-status.online { display: none; }
    body .header-row-info .info-meta { order: 0; flex: 1 1 100%; }
    body .header-row-info .net-status.offline {
        display: block; text-align: center; font-size: 13px; font-weight: 700;
        padding: 4px 0 6px;
    }
    body .header-row-buttons { padding-top: 6px; padding-bottom: 6px; min-height: 0; }
    /* صفحه‌هایی که جعبهٔ جستجو ندارند (حساب کاربری، ورود): خط اطلاعات خالی
       می‌ماند و ۴۰px جای بی‌مصرف می‌گرفت. مرورگرهای قدیمیِ بی‌پشتیبانی از
       :has فقط همان ۴۰px را نگه می‌دارند، خرابی دیگری ندارند. */
    /* (حذف شد ۱۴۰۵/۰۹/۰۴: پنهان‌کردن کل خط در صفحه‌های بدون جستجو؛ حالا خوش‌آمدگویی در آن است) */

    /* ---------- ۳) اهداف لمسی ≥ ۴۴px ---------- */
    body .control-btn {
        min-width: 44px; min-height: 44px; padding: 0;
        display: inline-flex; align-items: center; justify-content: center;
    }
    body .menu-toggle {
        min-width: 44px; min-height: 44px; padding: 0 11px;
        justify-content: center; align-items: stretch;
    }
    body .header-search input { min-height: 44px; font-size: 16px; } /* ۱۶px: iOS هنگام فوکوس صفحه را زوم نمی‌کند */
    body .header-search button[type="submit"],
    body .header-search .search-clear-btn { min-width: 40px; min-height: 40px; }

    body .footer-links a { display: inline-block; padding: 12px 6px; }

    /* آیکون‌های قلب/سبد روی عکس کارت محصول (صفحهٔ اصلی) — ۲۵×۲۰ بودند */
    body .qa-btn { min-width: 40px; min-height: 40px; }
    body .product-card-quick-actions { gap: 2px; left: 2px !important; bottom: 2px !important; }

    /* فیلدهای فرم سایت (نه پنل) */
    body main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not(.qty-input),
    body main select,
    body main textarea { min-height: 44px; font-size: 16px; }
    body main input[type="checkbox"],
    body main input[type="radio"] { width: 20px; height: 20px; }
    body main .btn-action,
    body .account-tab-btn { min-height: 44px; }

    body .product-info .breadcrumb a { display: inline-block; padding: 12px 2px; }

    /* ---------- ۴) هیچ متنی زیر ۱۲px ---------- */
    body .product-cat,
    body .product-unit,
    body .cart-item-unit,
    body .account-tab-count,
    body .badge { font-size: 12px; }

    /* ---------- ۶) کارت‌های محصول هم‌قد ----------
       عنوان حداکثر دو خط (بقیه با «…»)، و قیمت همیشه ته کارت. */
    body .product-card { display: flex; flex-direction: column; }
    body .product-card-body { flex: 1 1 auto; display: flex; flex-direction: column; }
    body .product-title {
        display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
        overflow: hidden; min-height: 3em; /* ۲ خط × line-height 1.5 */
    }
    body .product-price { margin-top: auto; }
}

/* ---------- ۲) سبد خرید: در موبایل هر ردیف یک «کارت» ----------
   ساختار HTML همان جدول است (cart.js بدون تغییر کار می‌کند)؛ فقط نمایشش
   عوض می‌شود. چیدمان هر کارت:
       [عکس] [نام کالا + واحد]           [حذف]
       [عکس] قیمت واحد: …
       [ − ۲ + ]                        جمع: …                        */
@media (max-width: 640px) {
    body .cart-table-wrap { overflow: visible; }
    body .cart-table,
    body .cart-table tbody { display: block; border: 0; background: none; }
    body .cart-table thead { display: none; }
    body .cart-table tr {
        display: grid;
        /* ستون سوم (auto) به اندازهٔ مبلغ «جمع» باز می‌شود تا هرگز بریده نشود */
        grid-template-columns: 64px 1fr auto 44px;
        grid-template-areas:
            "thumb title title remove"
            "thumb unit  price price"
            "qty   qty   total total";
        gap: 4px 10px; align-items: center;
        background: #fff; border: 1px solid var(--header-border); border-radius: 10px;
        padding: 2px 10px; margin: 0; border: 0; border-bottom: 1px solid #90a4ae; border-radius: 0;
    }
    body .cart-table td { display: block; padding: 0; border: 0; text-align: right; font-size: 14px; }
    body .cart-table td.cart-thumb { grid-area: thumb; align-self: start; }
    body .cart-table td.cart-cell-title { grid-area: title; }
    body .cart-table td.cart-cell-price { grid-area: price; color: #546e7a; }
    body .cart-table td.cart-cell-unit { grid-area: unit; }
    body .cart-table td, body .cart-table td:first-child, body .cart-table td:last-child { background: none; border: 0; border-radius: 0; padding: 0; }
    body .cart-table tbody tr:last-child { border-bottom: 0; }
    body .cart-table td.cart-cell-qty { grid-area: qty; }
    body .cart-table td.cart-line-total { grid-area: total; text-align: left; font-size: 15px; white-space: nowrap; }
    body .cart-table td.cart-cell-remove { grid-area: remove; align-self: start; }
    body .cart-table td[data-label]::before { content: attr(data-label) ": "; color: #78828d; font-weight: 400; }
    body .cart-thumb img { width: 64px; height: 64px; }

    body .qty-btn { width: 44px; height: 44px; font-size: 20px; }
    body .qty-input { width: 48px; height: 44px; font-size: 16px; }
    body .cart-remove-btn { width: 44px; height: 44px; font-size: 18px; }

    body .cart-summary { flex-direction: column; align-items: stretch; text-align: center; }
    body .cart-summary .btn-action { width: 100%; min-height: 48px; }
}

/* سبد سفارش در موبایل: ▲▼ جابه‌جایی زیر دکمهٔ حذف (دستگیرهٔ کشیدن فقط برای ماوس) */
@media (max-width: 640px) {
    body .cart-table tr { grid-template-areas:
            "thumb title title remove"
            "thumb unit  price price"
            "qty   qty   total move"; }
    body .cart-table td.cart-cell-move { grid-area: move; display: flex; justify-content: flex-end; }
    body .cart-grip { display: none; }
    body .cart-move-btn { width: 34px; height: 34px; }
}

@media screen and (max-width: 768px) {
    body main.page-content { padding: 4px; box-sizing: border-box; }

    body main .auth-box-body,
    body main .checkout-box-body,
    body main .home-products-frame-body,
    body main .product-list-body,
    body main .product-info,
    body main .info-card,
    body main .contact-item,
    body main .contact-note,
    body main .guide-step,
    body main .guide-list-card,
    body main .cart-summary,
    body main .account-addresses-box,
    body main .address-card,
    body main .pf-box { padding: 4px; }

    body main .info-page,
    body main .delivery-detail,
    body main .product-detail,
    body main .order-confirm-box { padding: 5px; }

    body main .product-description-box > :not(.product-description-title) {
        margin-inline: 4px;
    }

    body main .product-card-body,
    body main .product-grid-compact .product-card-body {
        padding-inline: 4px;
    }
}
