/* ── Cart Sidebar ──────────────────────────────────────── */
.cart-sidebar {
    position: fixed;
    top: 0; right: -420px;
    width: 400px; max-width: 100vw;
    height: 100%;
    background: #fff;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 32px rgba(0,0,0,.15);
    transition: right .35s cubic-bezier(.16,1,.3,1);
}
.cart-sidebar.open { right: 0; }

.cart-sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99998;
    opacity: 0; pointer-events: none;
    transition: opacity .35s ease;
}
.cart-sidebar-overlay.open { opacity: 1; pointer-events: all; }

body.cart-open { overflow: hidden; }

.cart-sidebar-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.cart-sidebar-header h4 { margin: 0; font-size: 18px; }
.cart-sidebar-close {
    background: none; border: none; cursor: pointer;
    font-size: 20px; color: #666; padding: 4px;
    transition: color .2s;
}
.cart-sidebar-close:hover { color: #000; }

.cart-sidebar-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.cart-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}
.cart-item-image img {
    width: 60px; height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
}
.cart-item-details { flex: 1; }
.cart-item-name { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.cart-item-price { font-size: 13px; color: #666; margin: 0; }
.cart-item-subtotal { font-size: 13px; color: #333; margin: 0; }
.cart-item-remove {
    position: absolute; top: 12px; right: 0;
    background: none; border: none;
    color: #ccc; cursor: pointer;
    font-size: 14px; padding: 2px 4px;
    transition: color .2s;
}
.cart-item-remove:hover { color: #e53e3e; }

.cart-sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    margin-bottom: 16px;
}
.cart-total-row strong { font-size: 20px; }

/* Cart badge on header icon */
.header-cart-btn, .icon-btn { position: relative; }
.cart-badge {
    position: absolute;
    top: -8px; right: -8px;
    background: var(--theme-color, #b8860b);
    color: #fff;
    border-radius: 50%;
    width: 18px; height: 18px;
    font-size: 10px;
    display: none;
    align-items: center; justify-content: center;
    font-weight: 700;
    line-height: 1;
}

/* ── Toast Notification ──────────────────────────────────── */
.cart-toast {
    position: fixed;
    bottom: 30px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #2d6a4f;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 999999;
    opacity: 0;
    transition: opacity .3s ease, transform .3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.cart-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Back to Top ─────────────────────────────────────────── */
#back-to-top {
    position: fixed;
    bottom: 30px; right: 24px;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--theme-color, #b8860b);
    color: #fff;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    z-index: 9997;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    transition: background .2s, transform .2s;
}
#back-to-top:hover {
    background: #8b6508;
    transform: translateY(-3px);
}

/* ── Search Box ──────────────────────────────────────────── */
#header-search-box {
    background: #fff;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}
#header-search-box .search-form input {
    flex: 1;
    border-radius: 8px;
}

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

.cart-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all .25s ease;
}

.cart-confirm-modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cart-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.cart-confirm-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(92vw, 420px);
    background: #fff;
    border-radius: 20px;
    padding: 30px 24px 24px;
    transform: translate(-50%, -46%) scale(.96);
    transition: all .25s ease;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18);
    text-align: center;
}

.cart-confirm-modal.show .cart-confirm-dialog {
    transform: translate(-50%, -50%) scale(1);
}

.cart-confirm-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: #f4f4f4;
    color: #222;
    cursor: pointer;
}

.cart-confirm-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff2ec, #ffe4da);
    color: #d9534f;
    font-size: 28px;
}

.cart-confirm-dialog h4 {
    margin-bottom: 10px;
    font-size: 24px;
}

.cart-confirm-dialog p {
    margin-bottom: 22px;
    color: #6b7280;
    font-size: 15px;
    line-height: 1.6;
}

.cart-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.cart-confirm-btn {
    min-width: 140px;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s ease;
}

.cart-confirm-cancel {
    background: #f3f4f6;
    color: #111827;
}

.cart-confirm-cancel:hover {
    background: #e5e7eb;
}

.cart-confirm-danger {
    background: #c88733;
    color: #fff;
}

.cart-confirm-danger:hover {
    background: #ad7125;
}

.product-grid-image figure img {
    min-height: 250px;
    max-height: 250px;
    object-fit: cover;
}

.product-grid-title {
    min-height: 52px;
}

.product-title-clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-height: calc(1.4em * 2);
    word-break: break-word;
}

/* ================================================================
   PRODUCT CARD — all classes prefixed with "pcard-" so they never
   conflict with .qty-btn / .icon-btn in the cart sidebar.
   ================================================================ */

/* ── Image + hover overlay ── */
.product-grid-image {
    position: relative;
    overflow: hidden;
}

.product-grid-image figure img {
    min-height: 250px;
    max-height: 250px;
    object-fit: cover;
    width: 100%;
    display: block;
    transition: transform .35s ease;
}

.product-grid-item-1:hover .product-grid-image figure img {
    transform: scale(1.04);
}

/* Overlay fades up on hover */
.product-grid-action {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 14px 12px 12px;
    background: linear-gradient(to top, rgba(0,0,0,.38) 0%, transparent 100%);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .22s ease, transform .22s ease;
    pointer-events: none;
}

.product-grid-item-1:hover .product-grid-action {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* ── Icon buttons on image (eye, whatsapp) ── */
.pcard-icon-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.5);
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .18s, transform .14s;
    text-decoration: none;
    font-size: 15px;
    flex-shrink: 0;
}

.pcard-icon-btn:hover {
    background: rgba(255,255,255,.38);
    transform: scale(1.1);
    color: #fff;
}

.pcard-icon-btn:active { transform: scale(.94); }

.pcard-icon-btn.btn-whatsapp-single:hover {
    background: rgba(37, 211, 102, .7);
    border-color: rgba(37, 211, 102, .5);
}

/* ── Title clamp ── */
.product-grid-title {
    min-height: 52px;
}

.product-title-clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

/* ── Cart row wrapper ── */
.pcard-cart-row {
    margin-top: 12px;
    min-height: 40px;
}

/* ── "Add to cart" button ── */
.pcard-add-btn {
    width: 100%;
    height: 40px;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background .15s, transform .1s;
    letter-spacing: .2px;
    line-height: 1;
}

.pcard-add-btn i { font-size: 14px; }

.pcard-add-btn:hover:not(:disabled) { background: #a93226; }
.pcard-add-btn:active:not(:disabled) { transform: scale(.97); }

/* ── Out of stock state ── */
.pcard-oos-btn {
    background: #f0f0f0 !important;
    color: #aaa !important;
    cursor: not-allowed !important;
    border: 1px solid #e0e0e0 !important;
}

/* ── Qty +/- stepper (replaces the button after add) ── */
.pcard-qty-ctrl {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: 40px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

/* Dec / Inc buttons — NOTE: these are .pcard-qty-btn, NOT .qty-btn */
.pcard-qty-btn {
    width: 42px;
    min-width: 42px;
    height: 40px;
    border: none;
    outline: none;
    background: #f5f5f5;
    color: #444;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .14s, color .14s;
    flex-shrink: 0;
    padding: 0;
}

.pcard-qty-btn:hover {
    background: #fff;
    color: #c0392b;
}

.pcard-qty-btn:active {
    background: #efefef;
}

/* The number in the middle */
.pcard-qty-num {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #222;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

/* ══════════════════════════════════════════════
   CART ITEM QTY — Modern stepper
══════════════════════════════════════════════ */
.cart-item {
    display: flex !important;
    gap: 12px !important;
    padding: 14px 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    align-items: flex-start !important;
}

.cart-item-image {
    flex-shrink: 0 !important;
    width: 64px !important;
    height: 64px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background: #f8f8f8 !important;
    border: 1px solid #eee !important;
}

.cart-item-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.cart-item-details {
    flex: 1 !important;
    min-width: 0 !important;
}

.cart-item-name {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    margin-bottom: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.4 !important;
}

.cart-item-price {
    font-size: 12px !important;
    color: #94a3b8 !important;
    margin-bottom: 8px !important;
}

/* ── Qty Stepper ── */
.cart-item-qty {
    display: inline-flex !important;
    align-items: center !important;
    background: #f1f5f9 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    border: 1px solid #e2e8f0 !important;
    height: 32px !important;
    margin-bottom: 6px !important;
}

.qty-btn {
    width: 30px !important;
    height: 100% !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #475569 !important;
    font-size: 10px !important;
    transition: background 0.15s ease, color 0.15s ease !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}

.qty-btn:hover {
    background: #e2e8f0 !important;
    color: #1e293b !important;
}

.qty-btn:active {
    background: #cbd5e1 !important;
}

.qty-btn.qty-minus:hover {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

.qty-btn.qty-plus:hover {
    background: #dcfce7 !important;
    color: #16a34a !important;
}

.qty-value {
    min-width: 28px !important;
    text-align: center !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    line-height: 1 !important;
    padding: 0 4px !important;
    border-left: 1px solid #e2e8f0 !important;
    border-right: 1px solid #e2e8f0 !important;
    user-select: none !important;
}

.cart-item-subtotal {
    font-size: 12px !important;
    color: #64748b !important;
    margin: 0 !important;
}

.cart-item-subtotal strong {
    color: #1e293b !important;
    font-weight: 700 !important;
}

.cart-item-remove {
    flex-shrink: 0 !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 6px !important;
    background: transparent !important;
    border: 1px solid #e2e8f0 !important;
    color: #94a3b8 !important;
    font-size: 11px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    margin-top: 2px !important;
    padding: 0 !important;
}

.cart-item-remove:hover {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #dc2626 !important;
}


/* ══════════════════════════════════════════════
   NAV DROPDOWN — Category tree
══════════════════════════════════════════════ */
.nav-mega-menu {
    min-width: 230px !important;
    padding: 8px 0 !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12) !important;
}

.nav-mega-menu > li > a {
    display: flex !important;
    align-items: center !important;
    padding: 9px 18px !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    color: #334155 !important;
    transition: background 0.15s, color 0.15s !important;
    white-space: nowrap !important;
}

.nav-mega-menu > li > a:hover,
.nav-mega-menu > li.active > a {
    background: #fffaf1 !important;
    color: #d97706 !important;
}

.nav-all-link a {
    font-weight: 700 !important;
    color: #1e293b !important;
}

.nav-divider {
    height: 1px !important;
    background: #f1f5f9 !important;
    /* margin: 4px 12px !important; */
}

.nav-cat-count {
    margin-left: auto !important;
    font-size: 11px !important;
    background: #f1f5f9 !important;
    color: #64748b !important;
    padding: 1px 6px !important;
    border-radius: 20px !important;
    font-weight: 600 !important;
    line-height: 1.6 !important;
}

/* ── Nested sub-dropdown (Church Artifacts → Bell etc.) ── */
.nav-has-sub {
    position: relative !important;
}

.nav-sub-dropdown {
    display: none !important;
    position: absolute !important;
    left: 100% !important;
    top: 0 !important;
    min-width: 210px !important;
    background: #fff !important;
    border-radius: 10px !important;
    box-shadow: 0 12px 32px rgba(0,0,0,0.1) !important;
    padding: 6px 0 !important;
    z-index: 9999 !important;
    list-style: none !important;
}

.nav-has-sub:hover > .nav-sub-dropdown {
    display: block !important;
}

.nav-sub-dropdown li a {
    display: flex !important;
    align-items: center !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    color: #475569 !important;
    transition: background 0.15s, color 0.15s !important;
    white-space: nowrap !important;
}

.nav-sub-dropdown li a:hover,
.nav-sub-dropdown li.active a {
    background: #fffaf1 !important;
    color: #d97706 !important;
}

.nav-arrow {
    font-size: 10px !important;
    opacity: 0.5 !important;
}


/* ══════════════════════════════════════════════
   FOOTER SUB-LINKS (subcategories indented)
══════════════════════════════════════════════ */
.footer-sub-link a {
    padding-left: 20px !important;
    font-size: 13px !important;
    opacity: 0.75 !important;
}

.footer-sub-link a:hover {
    opacity: 1 !important;
}

.footer-sub-link a i {
    font-size: 10px !important;
}

/* Subcategory fly-out — hidden by default, shown on hover */
.nav-has-sub > .nav-sub-dropdown {
    display: none !important;
    position: absolute !important;
    left: 100% !important;
    top: -6px !important;
    min-width: 210px !important;
    background: #fff !important;
    border-radius: 10px !important;
    box-shadow: 0 12px 32px rgba(0,0,0,0.12) !important;
    padding: 6px 0 !important;
    z-index: 99999 !important;
    list-style: none !important;
    margin: 0 !important;
}

.nav-has-sub:hover > .nav-sub-dropdown {
    display: block !important;
}

/* Prevent subcategory items from leaking into the parent menu */
.nav-mega-menu .nav-sub-dropdown li {
    padding: 0 !important;
}

.nav-mega-menu .nav-sub-dropdown li a {
    padding: 8px 16px !important;
    font-size: 13px !important;
    color: #475569 !important;
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    transition: background 0.15s, color 0.15s !important;
}

.nav-mega-menu .nav-sub-dropdown li a:hover,
.nav-mega-menu .nav-sub-dropdown li.active > a {
    background: #fffaf1 !important;
    color: #d97706 !important;
}

/* Parent item with children gets a pointer cursor and arrow indicator */
.nav-has-sub > a {
    position: relative !important;
}

.nav-has-sub > a .nav-arrow {
    font-size: 10px !important;
    opacity: 0.6 !important;
    margin-left: auto !important;
    transition: transform 0.2s !important;
}

.nav-has-sub:hover > a .nav-arrow {
    transform: rotate(90deg) !important;
    opacity: 1 !important;
}
