/**
 * responsive.css - تحسينات التجاوب والشاشات الصغيرة والهواتف
 */

@media (max-width: 991.98px) {
    .hero-title {
        font-size: 2.2rem;
    }
    
    .hero-section {
        padding: 40px 24px;
    }

    .hero-img-box {
        margin-top: 30px;
    }

    .search-form-wrap {
        max-width: 100%;
        margin: 0;
    }

    .category-nav-list {
        gap: 6px;
        flex-wrap: wrap;
        overflow: hidden;
        white-space: normal;
    }

    .filter-card-mobile-collapse {
        margin-bottom: 20px;
    }

    /* Each header section owns a row; notification controls no longer compete
       with the brand for half of a phone viewport. */
    .main-navbar > .container > .row > .col-6 {
        width: 100%;
    }
    .main-navbar { position: sticky; top: 0; }
    .main-navbar > .container.d-flex,
    .nav-actions { flex-wrap: wrap; gap: 8px; }
    .nav-actions { margin-block: 4px; }
    .nav-actions > .action-icon-btn,
    #customerNotifNavWrapper .action-icon-btn { flex-shrink: 0; }
    .main-navbar .brand-custom-logo { max-width: 64px; }
    .main-navbar { font-family: 'Tajawal', system-ui, sans-serif; }
    #customerNotifNavWrapper .dropdown-menu {
        min-width: 0 !important;
        width: min(340px, calc(100vw - 32px)) !important;
        max-height: min(440px, 60dvh) !important;
    }
    #checkoutForm .sticky-top { position: static; }
}

@media (max-width: 767.98px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .hero-desc {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .hero-floating-card {
        position: static;
        margin-top: 15px;
    }

    .product-img-wrap {
        height: 190px;
    }

    .category-card-img {
        height: 110px;
    }

    .promo-banner {
        padding: 24px;
        text-align: center;
    }

    .promo-banner .badge-code {
        margin-top: 15px;
    }

    .order-stepper {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
        padding-right: 20px;
    }

    .order-stepper::before {
        display: none;
    }

    .step-item {
        display: flex;
        align-items: center;
        gap: 15px;
        text-align: right;
    }

    .step-circle {
        margin: 0;
        flex-shrink: 0;
    }

    .custom-toast {
        min-width: calc(100vw - 48px);
    }
}

/* ==================== قواعد استجابة مشتركة دقيقة ==================== */
/* تعتمد هذه القواعد على المكونات الموجودة ولا تغيّر معرفات أو منطق JavaScript. */

body {
    overflow-x: visible;
}

html { scroll-padding-top: calc(var(--customer-header-height, 220px) + 12px); }
.purchase-journey .category-nav-bar { display: none; }
@media screen and (max-width: 767.98px) {
    .purchase-journey main .btn:not(#btnSubmitOrder) {
        font-size: clamp(.85rem, 2.5vw, .95rem);
        min-height: 44px;
        padding: .45rem .8rem !important;
        line-height: 1.4;
    }
    .purchase-journey #actionBtnContainer .btn { flex: 0 1 auto; }
    .purchase-journey main { padding-bottom: 80px; }
    .customer-items-table.table { display: block; width: 100%; min-width: 0; border: 0; }
    .customer-items-table thead {
        position: absolute; width: 1px; height: 1px;
        clip-path: inset(50%); overflow: hidden;
    }
    .customer-items-table tbody { display: block; width: 100%; }
    .customer-items-table tbody tr {
        display: block; margin-bottom: 12px;
        border: 1px solid var(--border-color); border-radius: 10px;
    }
    .customer-items-table.table tbody td {
        display: block; width: 100%; min-width: 0;
        padding: .65rem !important; white-space: normal;
        overflow-wrap: anywhere; text-align: start !important; border: 0;
    }
    .customer-items-table.table td[data-label] {
        display: flex; flex-wrap: wrap; justify-content: space-between;
        gap: .5rem; border-top: 1px solid var(--border-color);
    }
    .customer-items-table td[data-label]::before {
        content: attr(data-label); font-family: 'Tajawal', sans-serif;
        font-weight: 500; color: var(--muted-text);
    }
}

.container {
    width: 100%;
}

.brand-logo {
    min-width: 0;
}

.brand-logo > span,
.brand-logo > div {
    min-width: 0;
}

.brand-logo > div span {
    overflow-wrap: anywhere;
}

.hero-title,
.hero-desc,
.section-title,
.product-title,
.footer-desc,
.footer-links,
.breadcrumb,
.modal-title {
    overflow-wrap: anywhere;
}

.btn,
.btn-plant-primary,
.btn-plant-outline,
.btn-plant-buy-now,
.btn-add-to-cart {
    min-height: 42px;
}

.category-nav-list {
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.category-nav-item {
    flex: 1 1 auto;
    min-width: 0;
}

.top-announcement-bar .container {
    min-width: 0;
}

.top-announcement-bar .container > span {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}
.announcement-offer .badge { white-space: normal; overflow-wrap: anywhere; }
.category-nav-list { max-width: 100%; min-width: 0; }

@media (max-width: 767.98px) {
    main.container, .modal-body { overflow-wrap: anywhere; }
    main .row > *, main .d-flex > *, .modal-body .d-flex > * { min-width: 0; }
    main .d-flex:not(.input-group), .modal-body .d-flex:not(.input-group) {
        flex-wrap: wrap;
    }
    main .badge, .modal-body .badge {
        max-width: 100%; white-space: normal; line-height: 1.5;
    }
    main .btn, .modal-footer .btn { max-width: 100%; overflow-wrap: anywhere; }
    .payment-option-card, .delivery-method-card { gap: 12px; }
    .payment-option-card > .d-flex, .delivery-method-card > .d-flex { flex: 1 1 12rem; }
    .section-title-wrap { flex-wrap: wrap; }
    #orderHeaderTitle { font-size: clamp(1.25rem, 4vw, 2rem); }
    .main-footer { padding-bottom: 90px; }
}

.product-card,
.feature-box,
.filter-card,
.admin-card,
.orders-table-card {
    min-width: 0;
}

.product-img-wrap {
    aspect-ratio: 1 / 1;
    height: auto;
}

.product-img {
    min-width: 0;
}

.product-price-row {
    row-gap: 4px;
}

.product-price-row > * {
    max-width: 100%;
}

.filter-card {
    height: 100%;
}

.table-responsive,
.orders-table-responsive {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table,
.orders-table-responsive table {
    min-width: max-content;
}

.modal-dialog {
    width: auto;
    max-width: min(var(--bs-modal-width, 500px), calc(100% - 1rem));
    margin-inline: auto;
}

.modal-content,
.modal-body,
.modal-footer,
.modal-header {
    min-width: 0;
}

.modal-body {
    overflow-wrap: anywhere;
}

.product-main-view-box,
.product-main-view-box img,
.spec-box,
#productDetailsContainer .bg-white,
#checkoutForm,
#checkoutForm .bg-white {
    min-width: 0;
}

.product-main-img {
    max-width: 100%;
    height: auto;
}

.gallery-thumbs-wrap {
    max-width: 100%;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch;
}

#checkoutItemsList {
    max-width: 100%;
    overflow-x: auto;
}

#checkoutForm input,
#checkoutForm select,
#checkoutForm textarea {
    max-width: 100%;
}

#checkoutForm .form-check,
#checkoutForm .form-check-label,
#checkoutForm .form-text {
    overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
    .top-announcement-bar {
        font-size: 0.78rem;
        padding-inline: 0.75rem;
    }

    .top-announcement-bar .container {
        justify-content: center !important;
        line-height: 1.5;
    }

    .top-announcement-bar .container > span {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .main-navbar .container {
        padding-inline: 0.75rem;
    }

    .brand-logo {
        gap: 7px;
        font-size: clamp(0.95rem, 4.4vw, 1.2rem);
    }

    .brand-logo i {
        font-size: 1.45rem;
    }

    .nav-actions {
        gap: 4px;
    }

    .action-icon-btn,
    .nav-icon-btn {
        width: 36px;
        height: 36px;
    }

    .search-form-wrap {
        margin: 0;
    }

    .search-input {
        min-height: 42px;
        font-size: 0.86rem;
    }

    .category-nav-bar {
        padding-block: 4px;
    }

    .category-nav-list {
        gap: 6px;
        margin-inline: 0;
        padding-inline: 0.25rem;
    }

    .category-nav-item a {
        padding: 7px 10px;
        font-size: 0.84rem;
    }

    .hero-section {
        padding: 28px 18px;
        margin-top: 14px;
        margin-bottom: 24px;
        border-radius: 16px;
    }

    .hero-title {
        font-size: clamp(1.45rem, 7vw, 1.8rem);
    }

    .hero-desc {
        font-size: 0.94rem;
        line-height: 1.7;
    }

    .hero-section .btn,
    .promo-banner .btn,
    .hero-section .d-flex > a {
        width: 100%;
        white-space: normal;
    }

    .section-title-wrap {
        align-items: stretch !important;
        gap: 12px;
    }

    .section-title-wrap > a {
        flex: 0 0 auto;
        align-self: end;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .feature-box {
        padding: 16px;
    }

    .feature-icon-circle {
        width: 46px;
        height: 46px;
        font-size: 1.3rem;
    }

    .category-card-img {
        height: 120px;
    }

    .category-card-title {
        font-size: 0.96rem;
    }

    .product-img-wrap {
        aspect-ratio: 1 / 1.05;
    }

    .product-card-body {
        padding: 12px;
    }

    .product-title {
        font-size: 0.98rem;
    }

    .product-current-price {
        font-size: 1.08rem;
    }

    .filter-card,
    .admin-card,
    .orders-table-card {
        padding: 14px;
    }

    .breadcrumb {
        padding: 0.7rem !important;
        font-size: 0.8rem;
        white-space: normal;
    }

    .cart-item-row .row > [class*="col-"] {
        min-width: 0;
    }

    .cart-item-row .btn-cart-minus,
    .cart-item-row .btn-cart-plus {
        min-width: 40px;
    }

    .toast-container-custom {
        right: 12px;
        left: 12px;
        bottom: 12px;
    }

    .custom-toast {
        width: 100%;
        min-width: 0;
    }

    .main-footer {
        margin-top: 42px;
        padding-top: 40px;
    }

    .footer-bottom-bar,
    .footer-bottom-bar > * {
        text-align: center;
        justify-content: center !important;
    }

    .footer-bottom-bar .d-flex {
        flex-wrap: wrap;
    }

    .modal-dialog {
        max-width: min(var(--bs-modal-width, 500px), calc(100% - 0.75rem));
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1 1 8rem;
    }

    .product-main-view-box {
        padding: 10px;
    }

    .product-main-img {
        max-height: 360px;
        object-fit: contain;
    }

    .gallery-thumb {
        width: 62px;
        height: 62px;
    }

    #productDetailsContainer .bg-white.p-4 {
        padding: 1rem !important;
    }

    #productDetailsContainer h1 {
        font-size: 1.45rem !important;
    }

    #productDetailsContainer .input-group {
        max-width: 100%;
    }

    #productDetailsContainer #detailAddToCartBtn,
    #productDetailsContainer #detailBuyNowBtn {
        min-width: 100%;
    }

    #checkoutForm .col-lg-8,
    #checkoutForm .col-lg-4 {
        min-width: 0;
    }

    #checkoutForm .btn {
        white-space: normal;
    }

    .shipment-tracking-card {
        padding: 14px;
    }

    .tracking-track-wrapper {
        margin: 18px 0 10px;
    }

    .tracking-track-bg {
        position: relative;
        inset: auto;
        height: 6px;
        margin-bottom: 12px;
    }

    .tracking-track-fill {
        height: 100%;
        top: 0;
        right: 0;
        transition: width 0.8s ease;
    }

    .tracking-truck-marker {
        position: static;
        transform: none;
        flex-direction: row;
        gap: 6px;
        margin-bottom: 20px;
    }

    .tracking-truck-bubble {
        white-space: normal;
        max-width: min(70vw, 220px);
        text-align: center;
    }

    .tracking-truck-icon-circle {
        margin-top: 0;
        flex: 0 0 auto;
    }

    .tracking-steps-grid {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding-right: 0;
    }

    .tracking-step-node {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr);
        column-gap: 10px;
        align-items: center;
        text-align: right;
        min-width: 0;
    }

    .step-node-icon {
        grid-row: span 3;
        width: 44px;
        height: 44px;
        margin: 0;
        font-size: 1.1rem;
    }

    .step-node-title,
    .step-node-desc,
    .step-node-badge {
        min-width: 0;
        max-width: none;
        overflow-wrap: anywhere;
    }

    .step-node-badge {
        justify-self: start;
    }

    #orderActionButtonsWrap,
    #actionBtnContainer {
        align-items: stretch !important;
    }

    #actionBtnContainer {
        flex-wrap: wrap;
        width: 100%;
    }

    #actionBtnContainer .btn {
        flex: 1 1 10rem;
        white-space: normal !important; /* Overrides Bootstrap text-nowrap. */
    }

    #orderHeaderCard,
    #orderSummarySection,
    .order-header-card,
    .card-custom,
    .guarantee-box {
        padding: 1rem !important;
    }

    #orderHeaderCard h2,
    .order-header-card h1,
    .order-header-card h2,
    .card-custom h4,
    .card-custom h5 {
        overflow-wrap: anywhere;
    }

    #orderSummarySection .badge,
    #orderHeaderCard .badge {
        white-space: normal;
        text-align: center;
    }

    #invoice-hidden-container {
        left: -10000px !important;
    }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    #productsGrid {
        row-gap: 0;
    }

    .product-img-wrap {
        aspect-ratio: 1 / 1.05;
    }
}
