/* Mobile-first enhancements for client shop pages */
:root {
    --mobile-nav-height: 64px;
    --mobile-sticky-bar-height: 72px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 767px) {
    body.has-mobile-sticky-bar {
        padding-bottom: calc(var(--mobile-nav-height) + var(--mobile-sticky-bar-height) + var(--safe-bottom)) !important;
    }

    /* Compact page hero */
    .page-hero {
        padding: 1rem 0 1.25rem;
    }

    .page-breadcrumb {
        font-size: 0.78rem;
        flex-wrap: wrap;
        row-gap: 0.25rem;
    }

    .page-hero h1 {
        font-size: 1.35rem;
    }

    .site-container {
        padding: 1rem 0.875rem 2rem;
    }

    .site-card {
        padding: 1rem;
        border-radius: 12px;
    }

    /* Footer: don't sit under bottom nav */
    .site-footer {
        margin-bottom: calc(var(--mobile-nav-height) + var(--safe-bottom));
        padding-bottom: 1.25rem;
    }

    /* Hide header cart — bottom nav has it */
    .header-cart-mobile {
        display: none !important;
    }

    /* Product cards: icon-only buy button on mobile */
    .btn-cart-text {
        display: none !important;
    }

    .product-card-actions .btn-card-buy {
        flex: 0 0 44px !important;
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        font-size: 0 !important;
        line-height: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
    }

    .product-card-actions .btn-card-buy i {
        font-size: 1rem !important;
        line-height: 1 !important;
        margin: 0 !important;
    }

    .product-buy-form .btn-site-primary .btn-cart-text {
        display: none !important;
    }

    .product-buy-form .btn-site-primary i {
        margin-right: 0 !important;
    }

    .btn-card-icon {
        width: 44px;
        height: 44px;
    }

    .product-card-body {
        padding: 0.75rem;
    }

    .product-card-title {
        font-size: 0.875rem;
    }

    .product-card-price {
        font-size: 1rem;
    }

    /* Catalog toolbar */
    .catalog-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .catalog-search {
        min-width: 0;
        width: 100%;
    }

    .catalog-results-info {
        margin-left: 0;
        text-align: center;
    }

    .catalog-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.25rem;
    }

    .catalog-chips::-webkit-scrollbar {
        display: none;
    }

    .btn-mobile-filter {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    /* Basket: card layout */
    .basket-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1rem 0;
        position: relative;
    }

    .basket-item-img {
        width: 100%;
        height: 160px;
        border-radius: 10px;
    }

    .basket-item-info {
        order: 1;
    }

    .basket-item-qty {
        order: 2;
        width: 100%;
    }

    .basket-item-qty .form-control {
        min-height: 44px;
    }

    .basket-item-total {
        order: 3;
        width: 100%;
        text-align: left;
        font-size: 1.1rem;
    }

    .basket-item form:last-child {
        position: absolute;
        top: 0.75rem;
        right: 0;
    }

    .basket-summary {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        text-align: center;
    }

    .basket-actions {
        display: none;
    }

    /* Product detail */
    .product-detail-grid {
        gap: 1.25rem;
    }

    .product-info h1 {
        font-size: 1.25rem;
    }

    .product-detail-price {
        font-size: 1.5rem;
    }

    .product-buy-form {
        flex-direction: column;
        align-items: stretch;
    }

    .product-buy-form input[type="number"] {
        width: 100%;
        min-height: 44px;
    }

    .product-buy-form .btn-site-primary,
    .product-buy-form .btn-site-outline {
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }

    .product-thumbs img,
    .product-thumbs .video-thumb {
        width: 64px;
        height: 64px;
    }

    .related-scroll > .product-card {
        flex: 0 0 72vw;
        max-width: 280px;
    }

    /* Orders cards */
    .order-card-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .order-item-row span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Confirmation table → cards feel */
    .confirmation-order-table .table thead {
        display: none;
    }

    .confirmation-order-table .table tbody tr {
        display: block;
        border-bottom: 1px solid var(--site-border);
        padding: 0.75rem 0;
    }

    .confirmation-order-table .table tbody td {
        display: flex;
        justify-content: space-between;
        border: none;
        padding: 0.2rem 0;
    }

    .confirmation-order-table .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--site-muted);
        margin-right: 1rem;
    }

    /* Home hero compact */
    .hero-inner {
        padding: 1.5rem 0 2rem;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-actions .btn-hero-primary,
    .hero-actions .btn-hero-outline {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }

    .section {
        padding: 2rem 0;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .cta-strip {
        padding: 1.5rem 1.25rem;
        margin: 0 0.875rem 1rem;
    }

    .cta-strip-actions {
        width: 100%;
        flex-direction: column;
    }

    .cta-strip-actions .btn-hero-primary,
    .cta-strip-actions .btn-hero-outline {
        width: 100%;
        justify-content: center;
    }
}

/* Sticky mobile buy bar (product page) */
.mobile-buy-bar {
    display: none;
}

@media (max-width: 767px) {
    .mobile-buy-bar {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(var(--mobile-nav-height) + var(--safe-bottom));
        z-index: 1035;
        background: #fff;
        border-top: 1px solid var(--site-border);
        box-shadow: 0 -4px 20px rgba(26, 43, 74, 0.1);
        padding: 0.65rem 1rem;
    }

    .mobile-buy-bar-info {
        flex: 1;
        min-width: 0;
    }

    .mobile-buy-bar-price {
        font-size: 1.15rem;
        font-weight: 800;
        color: var(--site-accent);
        line-height: 1.2;
    }

    .mobile-buy-bar-stock {
        font-size: 0.75rem;
        font-weight: 600;
    }

    .mobile-buy-bar-stock.in-stock {
        color: var(--site-success);
    }

    .mobile-buy-bar-stock.out-of-stock {
        color: var(--site-accent);
    }

    .mobile-buy-bar .btn-site-primary {
        flex-shrink: 0;
        min-height: 48px;
        width: 48px;
        min-width: 48px;
        padding: 0;
        justify-content: center;
        white-space: nowrap;
    }

    .mobile-buy-bar .btn-site-primary i {
        margin: 0 !important;
    }
}

/* Sticky mobile checkout bar (basket) */
.mobile-basket-bar {
    display: none;
}

@media (max-width: 767px) {
    .mobile-basket-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(var(--mobile-nav-height) + var(--safe-bottom));
        z-index: 1035;
        background: #fff;
        border-top: 1px solid var(--site-border);
        box-shadow: 0 -4px 20px rgba(26, 43, 74, 0.1);
        padding: 0.65rem 1rem;
    }

    .mobile-basket-bar-total {
        font-size: 0.8rem;
        color: var(--site-muted);
        line-height: 1.2;
    }

    .mobile-basket-bar-total strong {
        display: block;
        font-size: 1.15rem;
        font-weight: 800;
        color: var(--site-primary);
    }

    .mobile-basket-bar .btn-site-primary {
        min-height: 48px;
        padding: 0.65rem 1.5rem;
        white-space: nowrap;
    }
}

/* Stock badge on product page */
.product-stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.product-stock-badge.in-stock {
    background: #ecfdf5;
    color: #047857;
}

.product-stock-badge.low-stock {
    background: #fffbeb;
    color: #b45309;
}

.product-stock-badge.out-of-stock {
    background: #fef2f2;
    color: #b91c1c;
}

/* WhatsApp FAB */
.shop-fab {
    position: fixed;
    right: 1rem;
    bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 1rem);
    z-index: 1030;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.shop-fab:hover {
    color: #fff;
    transform: scale(1.05);
}

.shop-fab-whatsapp {
    background: #25d366;
}

body.has-mobile-sticky-bar .shop-fab {
    bottom: calc(var(--mobile-nav-height) + var(--mobile-sticky-bar-height) + var(--safe-bottom) + 1rem);
}

@media (min-width: 768px) {
    .shop-fab {
        bottom: 1.5rem;
    }
}

/* Shop alert modals & toasts */
.shop-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.shop-modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.shop-modal-overlay.is-hiding {
    opacity: 0;
    visibility: hidden;
}

body.shop-modal-open {
    overflow: hidden;
}

.shop-modal {
    width: min(440px, 100%);
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    transform: scale(0.92) translateY(12px);
    transition: transform 0.22s ease;
}

.shop-modal-overlay.is-visible .shop-modal {
    transform: scale(1) translateY(0);
}

.shop-modal-danger .shop-modal-header {
    background: linear-gradient(145deg, #dc2626 0%, #b91c1c 55%, #991b1b 100%);
    color: #fff;
    text-align: center;
    padding: 1.75rem 1.5rem 1.35rem;
}

.shop-modal-header-compact {
    padding: 1.35rem 1.5rem 1rem !important;
}

.shop-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 0.85rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
}

.shop-modal-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.25;
}

.shop-modal-subtitle {
    margin: 0.45rem 0 0;
    font-size: 0.9rem;
    opacity: 0.92;
}

.shop-modal-body {
    padding: 1.25rem 1.5rem 0.5rem;
    text-align: center;
}

.shop-modal-body p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #334155;
}

.shop-modal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 1rem 1.25rem 1.35rem;
}

.shop-modal-footer-single {
    padding-top: 0.5rem;
}

.shop-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: none;
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.shop-modal-btn:hover {
    transform: translateY(-1px);
}

.shop-modal-btn-ghost {
    background: #f1f5f9;
    color: #475569;
    flex: 1 1 100%;
}

.shop-modal-btn-light {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    flex: 1 1 auto;
}

.shop-modal-btn-whatsapp {
    background: #25d366;
    color: #fff;
    flex: 1 1 auto;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}

.shop-success-toast {
    position: fixed;
    top: calc(1rem + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    z-index: 1090;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: #059669;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(5, 150, 105, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.shop-success-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.shop-success-toast.is-hiding {
    opacity: 0;
    visibility: hidden;
}

.shop-success-toast-close {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.25rem;
    cursor: pointer;
}

@media (max-width: 480px) {
    .shop-modal-footer {
        flex-direction: column;
    }

    .shop-modal-btn {
        width: 100%;
    }
}
