/* ==========================================================================
   DeltaSoft Store — Mobile Responsive Layer (max-width: 768px ONLY)
   لا يؤثر إطلاقاً على شاشات الكمبيوتر أو اللابتوب
   ========================================================================== */

@media (max-width: 768px) {
    /* 1. منع التمدد الأفقي للصفحة بالكامل مع الحفاظ على ثبات الهيدر */
    html, body {
        max-width: 100% !important;
        overflow-x: clip !important;
    }

    /* 2. ضبط نوافذ SweetAlert2 لتتوسط شاشة الموبايل بالكامل بدون قص */
    .swal2-container {
        padding: 12px !important;
    }
    .swal2-popup {
        width: 100% !important;
        max-width: 92vw !important;
        margin: 0 auto !important;
        padding: 18px 14px !important;
        box-sizing: border-box !important;
    }
    .swal2-title {
        font-size: 17px !important;
        line-height: 1.5 !important;
        padding: 6px 4px 0 !important;
    }
    .swal2-html-container {
        font-size: 13px !important;
        line-height: 1.6 !important;
        margin: 8px 0 0 !important;
    }
    .swal2-select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 12px 0 4px !important;
        font-size: 14px !important;
        box-sizing: border-box !important;
    }
    .swal2-actions {
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100% !important;
        margin-top: 14px !important;
    }
    .swal2-actions button {
        flex: 1 1 100% !important;
        margin: 0 !important;
    }
    .pts-swal, .inv-swal {
        padding: 0 0 16px !important;
    }
    .pts-swal .swal2-html-container,
    .inv-swal .swal2-html-container {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 3. الهيدر والفوتر الموحد (components/store_chrome.php) */
    .ds-top-nav {
        padding: 8px 10px !important;
    }
    .ds-nav-in {
        justify-content: center !important;
        gap: 8px !important;
    }
    .ds-brand {
        font-size: 15px !important;
        width: 100%;
        justify-content: center;
    }
    .ds-brand-ico {
        width: 32px !important;
        height: 32px !important;
        font-size: 15px !important;
    }
    .ds-nav-icons {
        width: 100%;
        justify-content: space-around !important;
        gap: 6px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .ds-nav-icons::-webkit-scrollbar { display: none; }
    .ds-ico-btn i { font-size: 18px !important; }
    .ds-ico-lbl { font-size: 9.5px !important; }
    .ds-footer { padding: 14px 12px !important; font-size: 12px !important; }

    /* 4. الصفحة الرئيسية (index.php) */
    .promo-bar { padding: 7px 10px 7px 34px !important; }
    .promo-inner { gap: 8px !important; }
    .promo-timer { gap: 5px !important; }
    .t-box b { min-width: 34px !important; height: 28px !important; padding: 0 5px !important; font-size: 14px !important; }
    .t-sep { font-size: 15px !important; margin-top: -10px !important; }

    .header { padding: 9px 10px !important; }
    .header-inner { flex-wrap: nowrap !important; gap: 7px !important; width: 100% !important; }
    .mob-menu-btn, .mob-search-btn { display: inline-flex !important; width: 38px !important; height: 38px !important; font-size: 16px !important; }
    .brand { flex: 1 !important; font-size: 15px !important; gap: 7px !important; min-width: 0 !important; }
    .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .brand-icon { width: 34px !important; height: 34px !important; font-size: 15px !important; border-radius: 9px !important; flex-shrink: 0; }
    .header .user-btn, .header .theme-btn { display: none !important; }
    .cart-btn { width: 42px !important; height: 40px !important; padding: 2px !important; flex-shrink: 0 !important; }
    .cart-svg { width: 34px !important; height: 34px !important; }
    .search-box { min-width: 0 !important; }

    /* إصلاح درج الموبايل ودرج السلة لمنع إزاحة الصفحة */
    .mob-drawer {
        right: 0 !important;
        max-width: 85vw !important;
        transform: translateX(105%);
        visibility: hidden;
        transition: transform 0.28s ease, visibility 0.28s ease !important;
    }
    .mob-drawer.open {
        transform: translateX(0) !important;
        visibility: visible !important;
    }
    .cart-drawer {
        left: 0 !important;
        max-width: 90vw !important;
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0.3s ease !important;
    }
    .cart-drawer.open {
        transform: translateX(0) !important;
        visibility: visible !important;
    }

/* شريط القوائم الرئيسي: نفس الحجم القديم (13px) وثابت بدون سكرول أفقي */
    .main-nav-inner {
        padding: 0 6px !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        overflow-x: visible !important;
        gap: 2px !important;
    }
    .nav-link {
        padding: 10px 4px !important;
        font-size: 13px !important;
        gap: 4px !important;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .nav-dropdown { display: none !important; }

    /* الهيكل والقوائم الـ 12 كشريط أفقي مريح باللمس */
    .page-layout {
        grid-template-columns: minmax(0, 1fr) !important;
        padding: 0 10px !important;
        margin: 12px auto !important;
        gap: 14px !important;
    }
    .page-layout > * { min-width: 0 !important; max-width: 100% !important; }
    .sidebar { gap: 12px !important; }
    .side-box { padding: 12px !important; border-radius: 14px !important; }
    .side-title { font-size: 14px !important; margin-bottom: 10px !important; padding-bottom: 8px !important; }
    .side-list {
        flex-direction: row !important;
        overflow-x: auto !important;
        gap: 9px !important;
        padding-bottom: 4px !important;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .side-list::-webkit-scrollbar { display: none; }
    .side-item {
        flex-direction: column !important;
        text-align: center !important;
        min-width: 100px !important;
        width: 100px !important;
        min-height: auto !important;
        padding: 8px 6px !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
        border-radius: 13px !important;
    }
    .side-item:hover { transform: none !important; }
    .side-item img { width: 62px !important; height: 62px !important; min-width: 62px !important; min-height: 62px !important; }
    .side-item > div:first-child { width: 62px !important; height: 62px !important; font-size: 28px !important; }
    .side-item .s-name { font-size: 12px !important; line-height: 1.3 !important; }
    .side-item .s-cnt { font-size: 10px !important; }

.sec-title { font-size: 17px !important; }
    .footer { margin-top: 28px !important; padding: 20px 12px 14px !important; }
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding-bottom: 16px !important;
    }
    .footer-grid > div {
        background: rgba(255,255,255,0.07);
        border: 1px solid rgba(255,255,255,0.14);
        border-radius: 14px;
        padding: 13px 14px;
    }
    .footer-grid > div:first-child {
        background: transparent;
        border: none;
        text-align: center;
        padding: 4px 6px 8px;
    }
    .footer-grid > div:nth-child(2) ul,
    .footer-grid > div:nth-child(3) ul {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px 10px;
    }
    .footer-grid > div:last-child {
        text-align: center;
    }
    .footer h4 { margin-bottom: 9px !important; font-size: 15px !important; }
    .footer p, .footer li { font-size: 13px !important; line-height: 1.7 !important; }
    .footer-bottom { margin-top: 12px !important; justify-content: center !important; text-align: center !important; }

    /* 5. صفحة إتمام الطلب (checkout.php) */
    .chk-steps { margin: 12px auto 14px !important; padding: 0 10px !important; gap: 6px !important; }
    .cs-item { padding: 6px 11px !important; font-size: 11.5px !important; }
    .cs-sep { display: none !important; }
    .wrap { padding: 0 10px !important; gap: 14px !important; }
    .box { padding: 16px 14px !important; border-radius: 16px !important; }
    .o-item { gap: 9px !important; padding: 9px !important; }
    .o-item img { width: 42px !important; height: 42px !important; }
    .net-box { flex-direction: column !important; align-items: center !important; text-align: center !important; gap: 6px !important; }

    /* 6. صفحة تتبع الطلب (track.php) */
    .order-head { flex-direction: column !important; align-items: stretch !important; }
    .head-right { justify-content: space-between !important; }
    .status-pill { justify-content: center !important; }
/* 7. صفحة حسابي (account.php) — ضبط كامل من الجانبين بدون قص أو سكرول للجدول */
    .acc-subbar { margin: 12px auto 10px !important; padding: 0 12px !important; }
    .wrap {
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 10px !important;
        gap: 14px !important;
    }
    .wrap > * { min-width: 0 !important; max-width: 100% !important; }
    .card { padding: 14px 10px !important; border-radius: 15px !important; max-width: 100% !important; }
    .card table th, .card table td { padding: 8px 4px !important; font-size: 11.5px !important; }
    .card .badge { white-space: nowrap; display: inline-block; padding: 2px 7px !important; font-size: 10.5px !important; }
    .card .btn-sm { padding: 3px 9px !important; font-size: 11px !important; white-space: nowrap; }
    .vc-face { padding: 18px 16px !important; }
}

@media (max-width: 600px) {
    /* شبكة المنتجات: عمودان متساويان تماماً بدون تمدد */
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }
    .p-card { padding: 10px !important; border-radius: 15px !important; min-width: 0 !important; }
    .p-img-wrap { height: 125px !important; margin-bottom: 6px !important; }
    .p-img-wrap img { width: 112px !important; height: 112px !important; max-width: 100% !important; max-height: 100% !important; }
    .p-name-row { margin: 2px 0 8px !important; }
    .p-name { font-size: 14px !important; line-height: 1.3 !important; }
    .p-qv-btn { display: none !important; }
    .p-footer { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; padding-top: 8px !important; }
    .p-price { font-size: 16px !important; text-align: center !important; }
    .p-footer .btn-add, .p-footer .btn-out { width: 100% !important; padding: 7px 8px !important; font-size: 12.5px !important; text-align: center !important; }
    .p-footer .qty-ctrl { width: 100% !important; justify-content: space-between !important; }
}