/* YassirStore mobile UX layer */
@media (max-width: 768px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body {
        padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
        touch-action: manipulation;
    }

    body.mobile-menu-open {
        overflow: hidden;
    }

    .navbar {
        position: sticky;
        top: 0;
        z-index: 1200;
        background: var(--bg-primary);
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    }

    .navbar .container {
        padding-inline: 0.85rem;
    }

    .nav-wrapper {
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas:
            "logo actions menu"
            "search search search";
        gap: 0.65rem;
        padding-block: 0.7rem;
    }

    html[dir="rtl"] .nav-wrapper,
    html[lang="ar"] .nav-wrapper,
    body[dir="rtl"] .nav-wrapper {
        grid-template-columns: auto auto minmax(0, 1fr);
        grid-template-areas:
            "menu actions logo"
            "search search search";
    }

    .logo a {
        min-width: 0;
    }

    .logo img {
        max-width: 142px;
        max-height: 38px !important;
        object-fit: contain;
    }

    .search-bar {
        width: 100%;
        max-width: none;
    }

    .search-field {
        min-height: 44px;
        border-radius: 999px;
        overflow: hidden;
    }

    .search-field input {
        min-height: 44px;
        font-size: 16px;
    }

    .search-submit {
        min-width: 48px;
        min-height: 44px;
    }

    #searchSuggestions {
        max-height: min(62vh, 440px);
        overflow-y: auto !important;
        border-radius: 0 0 1rem 1rem !important;
    }

    .user-menu {
        display: none;
    }

    .nav-actions {
        grid-area: actions;
        justify-self: end;
    }

    html[dir="rtl"] .nav-actions,
    html[lang="ar"] .nav-actions,
    body[dir="rtl"] .nav-actions {
        justify-self: center;
    }

    .nav-actions .dropdown-btn,
    .menu-toggle {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px;
        min-height: 42px;
        border-radius: 50%;
    }

    .menu-toggle {
        position: relative;
        z-index: 1302;
    }

    html[dir="rtl"] .menu-toggle,
    html[lang="ar"] .menu-toggle,
    body[dir="rtl"] .menu-toggle {
        justify-self: start;
    }

    html[dir="rtl"] .logo,
    html[lang="ar"] .logo,
    body[dir="rtl"] .logo {
        justify-self: end;
    }

    .nav-menu {
        display: block;
        position: fixed;
        top: 0;
        bottom: 0;
        inset-inline-end: 0;
        width: min(86vw, 360px);
        max-width: 100%;
        padding: calc(72px + env(safe-area-inset-top, 0px)) 0 1.25rem;
        border: 0;
        background: var(--bg-primary);
        box-shadow: -18px 0 40px rgba(15, 23, 42, 0.18);
        overflow-y: auto;
        transform: translateX(110%);
        transition: transform 0.24s ease;
        z-index: 1301;
        overscroll-behavior: contain;
    }

    html[dir="rtl"] .nav-menu,
    html[lang="ar"] .nav-menu,
    body[dir="rtl"] .nav-menu {
        left: 0 !important;
        right: auto !important;
        inset-inline-start: 0;
        inset-inline-end: auto;
        box-shadow: 18px 0 40px rgba(15, 23, 42, 0.18);
        transform: translateX(-110%);
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-menu ul {
        display: flex;
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        min-height: 50px;
        padding: 0.85rem 1rem;
        border-bottom: 1px solid var(--border-color);
        justify-content: flex-start;
        gap: 0.65rem;
    }

    .nav-dropdown-products .nav-dropdown-menu {
        display: block;
        margin: 0;
        background: var(--bg-secondary);
        border-radius: 0;
        border-top: 1px solid var(--border-color) !important;
        border-bottom: 1px solid var(--border-color) !important;
    }

    .nav-dropdown-products .dropdown-caret {
        margin-inline-start: auto;
    }

    .nav-dropdown-products .nav-dropdown-link,
    .nav-dropdown-products .nav-dropdown-sublink {
        min-height: 42px;
        display: flex;
        align-items: center;
    }

    .mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 1300;
    }

    .mobile-menu-backdrop.is-active {
        opacity: 1;
        pointer-events: auto;
    }

    .compare-bar {
        bottom: calc(-92px - env(safe-area-inset-bottom, 0px)) !important;
        z-index: 1505 !important;
        border-top-width: 1px !important;
    }

    .compare-bar.is-visible {
        bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .compare-bar__inner {
        padding: 0.55rem 0.75rem !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.55rem !important;
    }

    .compare-bar__label {
        min-width: 0;
        font-size: 0.78rem !important;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .compare-bar__actions {
        gap: 0.35rem !important;
    }

    .compare-bar__actions .btn {
        min-height: 38px;
        padding: 0.35rem 0.55rem !important;
        font-size: 0.76rem !important;
        white-space: nowrap;
    }

    .notification-dropdown .dropdown-content {
        position: fixed !important;
        top: 88px !important;
        left: 0.75rem !important;
        right: 0.75rem !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 0 !important;
        border-radius: 0.9rem !important;
        box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18) !important;
        transform: none !important;
        z-index: 1504 !important;
    }

    .notification-dropdown .dropdown-content > div:first-child {
        padding: 0.85rem 0.95rem !important;
        gap: 0.75rem;
    }

    .notification-dropdown .notifications-list {
        max-height: min(52vh, 340px) !important;
    }

    .notifications-mark-read-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1250;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0;
        padding: 0.42rem 0.55rem calc(0.42rem + env(safe-area-inset-bottom, 0px));
        background: color-mix(in srgb, var(--bg-primary) 96%, transparent);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.12);
        backdrop-filter: blur(14px);
    }

    .mobile-bottom-nav__item {
        position: relative;
        display: flex;
        min-width: 0;
        min-height: 54px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        border: 0;
        border-radius: 0.8rem;
        background: transparent;
        color: var(--text-secondary);
        text-decoration: none;
        font: inherit;
        font-size: 0.72rem;
        font-weight: 700;
        cursor: pointer;
    }

    .mobile-bottom-nav__item i {
        font-size: 1.05rem;
    }

    .mobile-bottom-nav__item.is-active,
    .mobile-bottom-nav__item:focus-visible {
        color: var(--primary-color);
        background: color-mix(in srgb, var(--primary-color) 10%, transparent);
        outline: none;
    }

    .mobile-bottom-nav__badge {
        position: absolute;
        top: 0.25rem;
        inset-inline-start: calc(50% + 0.25rem);
        min-width: 18px;
        height: 18px;
        padding-inline: 0.25rem;
        border-radius: 999px;
        background: var(--danger-color);
        color: #fff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.68rem;
        line-height: 1;
    }

    .whatsapp-float-btn {
        bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
        inset-inline-end: 1rem !important;
    }

    .scroll-to-top-btn {
        bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
        inset-inline-start: 1rem;
        inset-inline-end: auto !important;
    }

    .products-grid,
    .home-products-grid,
    .modern-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.75rem !important;
    }

    .modern-product-card {
        min-width: 0;
        border-radius: 0.85rem;
        overflow: hidden;
    }

    .modern-product-img-wrap {
        aspect-ratio: 1 / 1;
        min-height: 0;
    }

    .modern-product-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .modern-product-content {
        padding: 0.75rem;
    }

    .modern-product-content .product-name,
    .modern-product-content .product-title,
    .product-name a {
        font-size: 0.9rem;
        line-height: 1.35;
    }

    .products-card-actions,
    .product-actions {
        gap: 0.45rem;
    }

    .products-card-actions .btn,
    .products-card-actions button,
    .products-card-actions a {
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        min-height: 42px;
    }

    .pd-layout,
    .product-detail-layout,
    .cart-page-layout,
    .checkout-page-layout,
    .contact-layout,
    .profile-page-layout {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .pd-gallery__img {
        height: min(78vw, 380px);
    }

    .pd-info__title {
        font-size: 1.45rem;
        line-height: 1.35;
    }

    .pd-info__current-price {
        font-size: 1.7rem;
    }

    .pd-actions,
    .pd-layout .product-actions {
        display: grid !important;
        grid-template-columns: 1fr auto auto;
        gap: 0.55rem;
        align-items: center;
    }

    .pd-btn-cart,
    .cart-checkout-btn,
    .checkout-nav-btn,
    .contact-submit-btn,
    .profile-save-btn {
        min-height: 48px;
    }

    .checkout-steps {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .checkout-form-row,
    .checkout-form-row--3,
    .profile-form__row,
    .contact-form__row {
        grid-template-columns: 1fr !important;
    }

    .checkout-summary-card,
    .cart-summary-card,
    .products-filter,
    .profile-sidebar {
        position: static !important;
        width: 100%;
    }

    .footer {
        padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    }

    .footer-content {
        gap: 0.8rem !important;
    }

    .footer-section {
        border-bottom: 1px solid rgba(148, 163, 184, 0.22);
        padding-bottom: 0.65rem;
    }

    .footer-section h4 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 44px;
        margin: 0;
        cursor: pointer;
    }

    .footer-section h4::after {
        content: "\f078";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        font-size: 0.75rem;
        transition: transform 0.2s ease;
    }

    .footer-section.is-open h4::after {
        transform: rotate(180deg);
    }

    .footer-section:not(.is-open) h4 ~ * {
        display: none;
    }
}

@media (max-width: 360px) {
    .products-grid,
    .home-products-grid,
    .modern-products-grid {
        grid-template-columns: 1fr !important;
    }

    .mobile-bottom-nav {
        padding-inline: 0.25rem;
    }

    .mobile-bottom-nav__item {
        font-size: 0.66rem;
    }
}

/* Mobile UX polish pass: product cards and checkout overflow */
@media (max-width: 768px) {
    .container,
    .main-content,
    .products-main,
    .checkout-page-layout,
    .cart-page-layout,
    .profile-page-layout,
    .contact-layout {
        min-width: 0;
        max-width: 100%;
    }

    .products-grid,
    .home-products-grid,
    .modern-products-grid {
        align-items: stretch;
        gap: 0.55rem !important;
    }

    .modern-product-card {
        display: flex;
        flex-direction: column;
        border-radius: 0.7rem;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    }

    .modern-product-img-wrap {
        width: 100%;
        aspect-ratio: 1 / 1;
        background: #f8fafc;
    }

    .modern-product-img-wrap a {
        display: block;
        width: 100%;
        height: 100%;
    }

    .modern-product-img {
        height: 100% !important;
        max-height: none;
        object-fit: cover;
    }

    .modern-badge {
        top: 0.55rem;
        inset-inline-end: 0.55rem;
        right: auto;
        padding: 0.22rem 0.5rem;
        font-size: 0.68rem;
        line-height: 1.2;
    }

    .modern-product-content {
        display: flex;
        flex: 1;
        flex-direction: column;
        padding: 0.6rem;
        min-width: 0;
    }

    .product-category {
        min-height: 1.15rem;
        margin-bottom: 0.25rem;
        font-size: 0.72rem;
        line-height: 1.2;
        letter-spacing: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-name {
        margin-bottom: 0.45rem;
        min-height: 2.45rem;
        font-size: 0.86rem;
        line-height: 1.35;
    }

    .product-name a {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        color: inherit;
    }

    .products-card-footer {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.35rem;
        margin-top: auto;
        margin-bottom: 0.55rem;
    }

    .products-card-footer .product-price {
        min-width: 0;
        display: flex;
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 0.08rem;
        white-space: nowrap;
    }

    html[dir="rtl"] .products-card-footer .product-price {
        align-items: flex-end;
    }

    .products-card-footer .current-price {
        font-size: clamp(1.05rem, 5vw, 1.35rem);
        line-height: 1.05;
        white-space: nowrap;
    }

    .products-card-footer .original-price {
        font-size: 0.74rem;
        line-height: 1.1;
        white-space: nowrap;
    }

    .products-card-footer .product-rating {
        align-self: center;
        padding: 0.25rem 0.38rem;
        border-radius: 0.55rem;
        font-size: 0.72rem;
        line-height: 1;
        white-space: nowrap;
    }

    .products-card-actions {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.28rem;
        width: 100%;
        padding-top: 0.55rem;
        overflow: hidden;
    }

    .products-card-actions .btn,
    .products-card-actions button,
    .products-card-actions a,
    .products-card-actions .btn-add-cart,
    .products-card-actions .btn-in-cart,
    .products-card-actions .btn-wishlist,
    .products-card-actions .btn-compare,
    .products-card-actions .btn-share-product,
    .products-card-actions .btn-affiliate-share {
        width: 100% !important;
        height: 36px !important;
        min-width: 0;
        min-height: 36px !important;
        flex: initial;
        padding: 0 !important;
        border-radius: 0.55rem;
        font-size: 0.9rem;
    }

    .products-card-actions:has(.btn-affiliate-share) {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .checkout-page-layout {
        display: flex !important;
        flex-direction: column;
        overflow: hidden;
    }

    .checkout-summary-card,
    .checkout-form-card {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
        border-radius: 0.9rem;
        overflow: hidden;
    }

    .checkout-summary-card {
        order: -1;
    }

    .checkout-summary-items {
        max-height: none;
        overflow: visible;
    }

    .checkout-summary-item {
        min-width: 0;
        gap: 0.55rem;
    }

    .checkout-summary-item__img {
        width: 42px;
        height: 42px;
    }

    .checkout-summary-item__name {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.35;
    }

    .checkout-summary-item__price {
        max-width: 6.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .checkout-summary-row,
    .checkout-summary-total {
        gap: 1rem;
    }

    .checkout-coupon-form {
        display: grid;
        grid-template-columns: 1fr;
    }

    .checkout-coupon-form button {
        width: 100%;
    }

    .checkout-steps {
        display: grid;
        grid-template-columns: 1fr;
        padding-bottom: 1rem;
        margin-bottom: 1.25rem;
    }

    .checkout-step-btn {
        width: 100%;
        justify-content: space-between;
        white-space: normal;
        text-align: inherit;
    }

    .checkout-option-card {
        align-items: flex-start;
        padding: 0.85rem;
        gap: 0.55rem;
    }

    .checkout-option-card__body strong,
    .checkout-option-card__body small {
        overflow-wrap: anywhere;
    }

    .checkout-nav-btns {
        position: sticky;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        z-index: 20;
        margin-inline: -1rem;
        padding: 0.75rem 1rem;
        background: var(--bg-primary);
        box-shadow: 0 -10px 25px rgba(15, 23, 42, 0.08);
    }

    .footer {
        margin-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 430px) {
    body {
        padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    }

    .navbar .container,
    .container {
        padding-inline: 0.6rem;
    }

    .products-grid,
    .home-products-grid,
    .modern-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .modern-product-content {
        padding: 0.52rem;
    }

    .product-name {
        font-size: 0.8rem;
        min-height: 2.2rem;
    }

    .products-card-footer .current-price {
        font-size: clamp(0.98rem, 5.6vw, 1.22rem);
    }

    .products-card-actions {
        gap: 0.22rem;
    }

    .products-card-actions .btn,
    .products-card-actions button,
    .products-card-actions a,
    .products-card-actions .btn-add-cart,
    .products-card-actions .btn-in-cart,
    .products-card-actions .btn-wishlist,
    .products-card-actions .btn-compare,
    .products-card-actions .btn-share-product,
    .products-card-actions .btn-affiliate-share {
        height: 34px !important;
        min-height: 34px !important;
        font-size: 0.82rem;
    }

    .mobile-bottom-nav {
        padding-inline: 0.35rem;
    }

    .mobile-bottom-nav__item {
        min-height: 50px;
        font-size: 0.66rem;
        border-radius: 0.65rem;
    }
}

@media (min-width: 769px) {
    .mobile-menu-backdrop,
    .mobile-bottom-nav {
        display: none !important;
    }
}

/* Mobile UX polish pass 2: product detail and checkout forms */
@media (max-width: 768px) {
    .page-shell {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .pd-layout {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        min-width: 0;
        margin-bottom: 1.5rem;
        overflow: hidden;
    }

    .pd-gallery,
    .pd-info {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
    }

    .pd-gallery__main {
        border-radius: 0.9rem;
    }

    .pd-gallery__img {
        width: 100%;
        height: auto !important;
        max-height: 430px;
        aspect-ratio: 1 / 1;
        object-fit: contain;
    }

    .pd-gallery__thumbs {
        display: flex;
        gap: 0.45rem;
        overflow-x: auto;
        padding-bottom: 0.35rem;
        scroll-snap-type: x mandatory;
    }

    .pd-gallery__thumb {
        flex: 0 0 72px;
        scroll-snap-align: start;
    }

    .pd-gallery__thumb img {
        height: 58px;
    }

    .pd-info__category {
        font-size: 0.78rem;
        margin-top: 0.45rem;
        margin-bottom: 0.35rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pd-info__title {
        width: 100%;
        max-width: 100%;
        font-size: clamp(1.25rem, 6.2vw, 1.7rem);
        line-height: 1.35;
        margin-bottom: 0.75rem;
        overflow-wrap: anywhere;
    }

    .pd-info__rating,
    .pd-info__price {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.45rem;
    }

    html[dir="rtl"] .pd-info__rating,
    html[dir="rtl"] .pd-info__price {
        justify-content: flex-end;
    }

    .pd-info__current-price {
        font-size: clamp(1.65rem, 8vw, 2rem);
        line-height: 1.1;
    }

    .pd-info__desc {
        max-width: 100%;
        padding: 0.9rem;
        border-radius: 0.85rem;
        overflow-wrap: anywhere;
    }

    .pd-info__stock {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        text-align: center;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .pd-actions {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        gap: 0.8rem;
    }

    .pd-actions__qty {
        display: grid;
        grid-template-columns: auto minmax(132px, 1fr);
        align-items: center;
        gap: 0.75rem;
        width: 100%;
        min-width: 0;
    }

    .pd-actions__qty label {
        margin: 0;
        white-space: nowrap;
    }

    .pd-qty-control {
        width: 100%;
        min-width: 0;
        justify-self: stretch;
    }

    .pd-actions__btns {
        display: grid !important;
        grid-template-columns: 1fr 54px 54px;
        gap: 0.65rem;
        width: 100%;
        min-width: 0;
    }

    .pd-btn-cart,
    .pd-btn-wish,
    .pd-btn-compare {
        width: 100% !important;
        min-width: 0;
        height: 52px;
        min-height: 52px;
        border-radius: 0.8rem;
    }

    .pd-btn-cart {
        white-space: normal;
        line-height: 1.25;
    }

    .pd-btn-wish,
    .pd-btn-compare {
        padding: 0 !important;
    }

    .pd-btn-whatsapp {
        width: 100%;
        justify-content: center;
    }

    .pd-affiliate-link {
        width: 100%;
        min-width: 0;
        font-size: 0.82rem;
    }

    .pd-copy-affiliate-link {
        min-width: 46px;
    }

    .pd-trust {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
        width: 100%;
        max-width: 100%;
        text-align: center;
    }

    .pd-share {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        width: 100%;
        max-width: 100%;
    }

    .pd-share__label {
        justify-content: center;
    }

    .pd-share__buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .pd-tabs {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .pd-tabs__nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        overflow: visible;
    }

    .pd-tabs__btn {
        min-width: 0;
        padding-inline: 0.35rem;
        font-size: 0.82rem;
        white-space: normal;
    }

    .pd-tab-content {
        overflow-wrap: anywhere;
    }

    .checkout-nav-btns {
        position: static !important;
        bottom: auto !important;
        z-index: auto;
        margin: 1.25rem 0 0;
        padding: 1rem 0 0;
        background: transparent;
        box-shadow: none;
        border-top: 1px solid var(--border-color);
    }

    .checkout-nav-btns .checkout-nav-btn {
        min-width: 0;
        white-space: nowrap;
    }

    .checkout-step-panel {
        padding-bottom: 1rem;
    }

    .checkout-form-card,
    .checkout-summary-card {
        overflow: visible;
    }

    .checkout-review-grid,
    .checkout-review-section,
    .checkout-review-totals {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
    }

    .checkout-review-value,
    .checkout-review-total-row,
    .checkout-summary-total {
        overflow-wrap: anywhere;
    }

    .whatsapp-float-btn,
    .scroll-to-top-btn {
        bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

@media (max-width: 430px) {
    .nav-wrapper {
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas:
            "logo actions menu"
            "search search search";
        column-gap: 0.55rem;
    }

    html[dir="rtl"] .nav-wrapper,
    html[lang="ar"] .nav-wrapper,
    body[dir="rtl"] .nav-wrapper {
        grid-template-columns: auto auto minmax(0, 1fr);
        grid-template-areas:
            "menu actions logo"
            "search search search";
    }

    .menu-toggle {
        justify-self: start;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    }

    .logo {
        justify-self: end;
        min-width: 0;
    }

    .pd-actions__qty {
        grid-template-columns: 1fr;
    }

    .pd-actions__btns {
        grid-template-columns: 1fr 48px 48px;
        gap: 0.5rem;
    }

    .pd-btn-cart,
    .pd-btn-wish,
    .pd-btn-compare {
        height: 50px;
        min-height: 50px;
    }

    .checkout-nav-btns {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }
}

/* Mobile UX polish pass 3: account, orders, tracking and affiliate pages */
@media (max-width: 768px) {
    .profile-layout,
    .track-container {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    .profile-main,
    .profile-card,
    .section-card,
    .track-search-card,
    .track-order-header,
    .track-section,
    .order-card,
    .order-card__details,
    .order-card__details-panel {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        box-sizing: border-box;
    }

    .profile-card,
    .section-card,
    .track-search-card,
    .track-order-header,
    .track-section {
        padding: 1rem;
        border-radius: 0.9rem;
    }

    .profile-card__title,
    .track-section__title,
    .track-search-card__title {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0.45rem;
        width: 100%;
        max-width: 100%;
        font-size: 1.15rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .track-search-card form,
    .profile-main form[data-live-search],
    #profileOrdersFilterForm {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        width: 100%;
    }

    .profile-main input,
    .profile-main textarea,
    .profile-main select,
    .track-container input,
    .track-container textarea,
    .track-container select {
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .track-order-header__grid,
    .track-details-grid,
    .order-card__grid,
    .ocd-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    .track-timeline {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.65rem;
        padding: 0;
        overflow: visible;
    }

    .track-timeline__line {
        display: none;
    }

    .track-timeline__step {
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr);
        grid-template-areas:
            "icon label"
            "icon date";
        align-items: center;
        justify-items: start;
        gap: 0.1rem 0.75rem;
        padding: 0.65rem 0.75rem;
        border: 1px solid var(--border-color);
        border-radius: 0.85rem;
        background: var(--bg-primary);
    }

    .track-timeline__icon {
        grid-area: icon;
    }

    .track-timeline__label {
        grid-area: label;
        text-align: start;
        font-size: 0.92rem;
        line-height: 1.35;
    }

    .track-timeline__date {
        grid-area: date;
        text-align: start;
        font-size: 0.76rem;
    }

    .track-history__item {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        gap: 0.55rem;
        overflow-wrap: anywhere;
    }

    .track-products-table-wrap,
    .profile-main [style*="overflow:auto"],
    .profile-main [style*="overflow: auto"] {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .track-products-table {
        display: block;
        width: 100%;
        min-width: 0 !important;
        border: 0;
        background: transparent;
    }

    .track-products-table thead {
        display: none;
    }

    .track-products-table tbody,
    .track-products-row,
    .track-products-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .track-products-row {
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        border: 1px solid var(--border-color);
        border-radius: 0.85rem;
        background: var(--bg-primary);
    }

    .track-products-row:last-child {
        margin-bottom: 0;
    }

    .track-products-cell-product {
        padding: 0 0 0.65rem !important;
        border: 0 !important;
    }

    .track-products-cell-qty,
    .track-products-cell-price,
    .track-products-cell-subtotal {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.45rem 0 !important;
        border-top: 1px solid var(--border-color);
        text-align: start !important;
    }

    .track-products-cell-qty::before {
        content: "الكمية";
        color: var(--text-secondary);
        font-weight: 600;
    }

    .track-products-cell-price::before {
        content: "السعر";
        color: var(--text-secondary);
        font-weight: 600;
    }

    .track-products-cell-subtotal::before {
        content: "المجموع";
        color: var(--text-secondary);
        font-weight: 600;
    }

    .track-products-total-row {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.85rem;
        border-radius: 0.85rem;
        background: var(--bg-secondary);
    }

    .track-products-total-label,
    .track-products-total-value {
        display: block !important;
        width: auto !important;
        padding: 0 !important;
        border: 0 !important;
        white-space: normal;
    }

    .order-card__top {
        display: grid !important;
        grid-template-columns: 1fr auto;
        gap: 0.75rem;
        align-items: start;
    }

    .order-card__number,
    .order-card__number a,
    .order-card__field p,
    .ocd-val,
    .ocd-prod-link,
    .ocd-prod-name {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .ocd-row {
        display: grid;
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
        gap: 0.75rem;
        align-items: start;
    }

    .ocd-val {
        text-align: end;
    }

    .ocd-items-table,
    .admin-table {
        width: 100%;
        min-width: 620px;
        table-layout: fixed;
    }

    .ocd-items-table th,
    .ocd-items-table td,
    .admin-table th,
    .admin-table td {
        white-space: normal;
        overflow-wrap: anywhere;
        vertical-align: top;
    }

    .ocd-thumb,
    .ocd-thumb-ph {
        width: 46px;
        height: 46px;
        min-width: 46px;
    }

    .ticket-reply-form,
    .track-section form,
    .section-card form {
        width: 100%;
        max-width: 100%;
    }

    .ticket-reply-form input[type="file"],
    .track-section input[type="file"],
    .section-card input[type="file"] {
        width: 100%;
        padding: 0.7rem;
        border: 1px dashed var(--border-color);
        border-radius: 0.75rem;
        background: var(--bg-primary);
        font-size: 0.82rem;
    }

    .profile-main .section-card > div[style*="grid-template-columns:1fr auto"],
    .profile-main .section-card > div[style*="grid-template-columns: 1fr auto"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.65rem !important;
    }

    .profile-main .section-card .btn-premium {
        width: 100%;
        justify-content: center;
    }

    .profile-main input[readonly],
    .profile-main #referralLinkInput {
        width: 100%;
        min-width: 0;
        direction: ltr;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .profile-card .products-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(min(155px, 100%), 1fr)) !important;
        justify-items: stretch;
        gap: 0.8rem;
        width: 100%;
    }

    .profile-card .modern-product-card {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .notification-dropdown .dropdown-content {
        position: fixed !important;
        top: 88px !important;
        left: 0.75rem !important;
        right: 0.75rem !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        inset-inline-end: 0.75rem !important;
        inset-inline-start: 0.75rem !important;
    }

    .notification-dropdown .notifications-list {
        max-height: min(58vh, 360px) !important;
    }

    .notification-dropdown .notifications-list a {
        padding: 0.8rem 0.9rem !important;
        overflow-wrap: anywhere;
    }
}

.notifications-mark-read-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--primary-color);
    border-radius: 50%;
    font-size: 0.86rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.notifications-mark-read-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

@media (max-width: 430px) {
    .profile-main,
    .profile-card,
    .section-card,
    .track-search-card,
    .track-order-header,
    .track-section {
        padding: 0.9rem;
    }

    .profile-card__title,
    .track-section__title,
    .track-search-card__title {
        font-size: 1.05rem;
    }

    .order-card__top {
        grid-template-columns: 1fr;
    }

    .ocd-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .ocd-val {
        text-align: start;
    }

    .track-products-row {
        padding: 0.7rem;
    }

    .track-products-cell-qty,
    .track-products-cell-price,
    .track-products-cell-subtotal {
        font-size: 0.9rem;
    }

    .profile-card .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.65rem;
    }

    .wishlist-page-layout .profile-card .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)) !important;
    }
}
