/* D'More shop: product grid, cart, checkout and receipt pages. Builds on css/jf.css. */

/* ---------- Compact page header (cart / checkout / receipt) ---------- */
.shop-head { position: relative; isolation: isolate; overflow: hidden; background: var(--forest-950); color: #fff; padding: clamp(120px, 16vh, 150px) 0 clamp(40px, 6vh, 60px); }
.shop-head .hero-bg { position: absolute; inset: 0; z-index: -2; }
.shop-head .hero-bg img { width: 100%; height: 100%; object-fit: cover; }
.shop-head::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(5, 18, 10, .7) 0%, rgba(5, 18, 10, .55) 50%, rgba(5, 18, 10, .9) 100%); }
.shop-head h1 { color: #fff; font-size: clamp(36px, 5vw, 64px); line-height: 1; letter-spacing: -0.04em; margin: 0; }

/* ---------- Shop intro + toolbar ---------- */
.shop-section { padding: clamp(56px, 8vw, 100px) 0; background: var(--cream-50); }
.shop-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: clamp(26px, 4vw, 44px); }
.shop-bar .title { margin: .3em 0 0; }
.title .highlight { color: var(--green-600); }
.shop-cart-link {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 10px 12px 10px 18px; border-radius: 999px;
    background: var(--forest-800); color: #fff;
    font-family: var(--font-head); font-weight: 600; font-size: 15px;
    transition: background .3s var(--ease), transform .3s var(--ease);
}
.shop-cart-link:hover { background: var(--green-600); transform: translateY(-2px); }
.shop-cart-link svg { width: 20px; height: 20px; }
.shop-cart-link .cart-quantity {
    min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px;
    background: var(--lime-400); color: var(--forest-900);
    display: inline-grid; place-items: center; font-size: 13px; font-weight: 700;
}

/* ---------- Product grid ---------- */
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(12px, 2vw, 24px); }
@media (max-width: 1100px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.product-card {
    position: relative;
    display: flex; flex-direction: column;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 10px 10px 16px;
    transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .45s;
}
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: transparent; }

.product-media { position: relative; overflow: hidden; border-radius: calc(var(--radius-lg) - 8px); background: var(--sage-50); aspect-ratio: 1; display: grid; place-items: center; }
.product-card .product-image { width: 82%; height: 82%; object-fit: contain; display: block; transition: transform .7s var(--ease); }
.product-card:hover .product-image { transform: scale(1.07); }

.details-icon {
    position: absolute; left: 50%; bottom: 12px; transform: translate(-50%, 8px);
    padding: 8px 16px; border-radius: 999px; border: 0;
    background: rgba(255, 255, 255, .95); color: var(--forest-800);
    font-family: var(--font-head); font-weight: 600; font-size: 13.5px; white-space: nowrap;
    box-shadow: 0 6px 18px -8px rgba(8, 40, 20, .45);
    cursor: pointer; opacity: 0; transition: opacity .3s, transform .35s var(--ease), background .3s, color .3s;
}
.product-card:hover .details-icon, .details-icon:focus-visible { opacity: 1; transform: translate(-50%, 0); }
.details-icon:hover { background: var(--forest-800); color: #fff; }
@media (hover: none) { .details-icon { opacity: 1; transform: translate(-50%, 0); padding: 6px 12px; font-size: 12.5px; } }

.product-card h6 { font-family: var(--font-head); font-weight: 700; font-size: 16.5px; line-height: 1.3; color: var(--forest-800); margin: 14px 6px 4px; flex: 1; }
.product-card .price { font-family: var(--font-head); font-weight: 800; font-size: 18px; color: var(--green-600); margin: 0 6px 14px; }

.card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 4px; }
.quantity-control { display: inline-flex; align-items: center; background: var(--sage-50); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex: 0 0 auto; }
.quantity-control button {
    width: 32px; height: 32px; border-radius: 50%; border: 0;
    background: #fff; color: var(--forest-800);
    font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer;
    box-shadow: 0 1px 3px rgba(8, 40, 20, .12);
    transition: background .25s, color .25s;
}
.quantity-control button:hover { background: var(--forest-800); color: #fff; }
.quantity-control input { width: 34px; border: 0; background: transparent; text-align: center; font: inherit; font-weight: 700; color: var(--ink-900); padding: 0; }
.quantity-control input:focus { outline: none; }

.add-to-cart {
    flex: 1 1 110px;
    height: 40px; padding: 0 16px; border: 0; border-radius: 999px;
    background: var(--green-600); color: #fff;
    font-family: var(--font-head); font-weight: 600; font-size: 14.5px; cursor: pointer;
    transition: background .3s var(--ease), transform .3s var(--ease);
}
.add-to-cart:hover { background: var(--forest-800); }
.add-to-cart:active { transform: scale(.97); }

@media (max-width: 520px) {
    .product-card { padding: 7px 7px 12px; border-radius: var(--radius); }
    .product-media { border-radius: 10px; }
    .product-card h6 { font-size: 14.5px; margin: 10px 4px 2px; }
    .product-card .price { font-size: 16px; margin: 0 4px 10px; }
    .card-actions { padding: 0; }
    .quantity-control { width: 100%; justify-content: space-between; }
    .add-to-cart { flex-basis: 100%; height: 38px; font-size: 14px; }
}

/* ---------- Product detail dialogs (opened by showModal / closed by closeModal) ---------- */
.modal { display: none; position: fixed; inset: 0; z-index: 1100; overflow-y: auto; padding: 16px; background: rgba(5, 18, 10, .55); backdrop-filter: blur(4px); }
.modal-dialog { max-width: 560px; margin: max(10vh, 70px) auto 40px; }
.modal-content { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: shopPop .35s var(--ease); }
@keyframes shopPop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 14px; border-bottom: 1px solid var(--line); }
.modal-title { font-family: var(--font-head); font-weight: 700; font-size: 20px; line-height: 1.25; color: var(--forest-800); margin: 0; }
.modal-header .close { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--sage-50); color: var(--forest-800); font-size: 24px; line-height: 1; cursor: pointer; transition: background .25s, color .25s; }
.modal-header .close:hover { background: var(--forest-800); color: #fff; }
.modal-body { padding: 18px 24px 6px; color: var(--ink-500); font-size: 15.5px; max-height: 60vh; overflow-y: auto; }
.modal-body p { margin: 0 0 12px; }
.modal-footer { display: flex; justify-content: flex-end; padding: 10px 24px 22px; }
.modal-footer .btn { border-radius: 999px; padding: 11px 22px; font-size: 15px; }

/* ---------- Add-to-cart notifications ---------- */
.notification-container { position: fixed; top: 80px; right: 16px; z-index: 1050; display: flex; flex-direction: column; gap: 10px; max-width: calc(100% - 32px); }
.notification {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-width: 260px; padding: 12px 14px 12px 16px;
    background: #fff; color: var(--ink-900); border-radius: var(--radius);
    border-left: 4px solid var(--mint-500); box-shadow: var(--shadow-lg);
    animation: shopPop .35s var(--ease);
}
.notification-content { display: flex; align-items: center; gap: 10px; }
.notification-content p { margin: 0; font-size: 14.5px; font-weight: 500; }
.notification i { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; background: var(--mint-500) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 14px no-repeat; }
.close-notification { background: none; border: 0; color: var(--ink-500); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.close-notification:hover { color: var(--ink-900); }

/* ---------- Floating cart (shown on small screens by the page script) ---------- */
.floating-cart { display: none; position: fixed; right: 18px; bottom: 80px; z-index: 95; width: 56px; height: 56px; border-radius: 50%; background: var(--green-600); box-shadow: var(--shadow-lg); transition: transform .3s var(--ease); }
.floating-cart:hover { transform: scale(1.08); }
.floating-cart a { display: grid; place-items: center; width: 100%; height: 100%; color: #fff; }
.floating-cart svg { width: 24px; height: 24px; }
.floating-cart .cart-quantity { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--lime-400); color: var(--forest-900); display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* Off-screen target for the legacy cart-popup helpers in js/cookie.js and js/dmore.js. */
.cart-sink { display: none !important; }

/* ---------- Cart page ---------- */
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: clamp(20px, 3vw, 36px); align-items: start; }
@media (max-width: 900px) { .cart-layout { grid-template-columns: 1fr; } }
.cart-list { display: flex; flex-direction: column; gap: 14px; }
#cartItems { display: flex; flex-direction: column; gap: 14px; }
#cartItems:empty::before { content: "Your cart is empty."; display: block; padding: 40px 24px; text-align: center; color: var(--ink-500); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius-lg); }
.cart-item { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 12px 16px 12px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); transition: box-shadow .35s var(--ease); }
.cart-item:hover { box-shadow: var(--shadow); }
.cart-item-image { width: 84px; height: 84px; border-radius: var(--radius); background: var(--sage-50); display: grid; place-items: center; overflow: hidden; }
.cart-item-image img { width: 84%; height: 84%; object-fit: contain; }
.cart-item-details h4 { font-family: var(--font-head); font-weight: 700; font-size: 17px; color: var(--forest-800); margin: 0 0 4px; }
.cart-item-details p { margin: 0; font-size: 14.5px; color: var(--ink-500); }
.remove-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: #f6e9e6; color: #a3352a; display: grid; place-items: center; cursor: pointer; transition: background .25s, color .25s; }
.remove-btn:hover { background: #a3352a; color: #fff; }
.remove-btn i { width: 18px; height: 18px; display: block; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat; }
@media (max-width: 520px) {
    .cart-item { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; padding: 10px 12px 10px 10px; }
    .cart-item-image { width: 64px; height: 64px; }
    .cart-item-details h4 { font-size: 15.5px; }
}

.summary-card { position: sticky; top: 100px; background: var(--forest-800); color: #fff; border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow-lg); }
.summary-card .pill { margin-bottom: 14px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .82); font-size: 15px; }
.summary-row .cart-quantity { font-weight: 700; color: #fff; }
.cart-total { font-family: var(--font-head); font-weight: 800; font-size: clamp(22px, 2.4vw, 26px); color: var(--lime-300); padding: 16px 0 6px; }
.summary-card .btn { width: 100%; justify-content: center; margin-top: 14px; }
.summary-card .continue { display: block; text-align: center; margin-top: 14px; font-size: 14.5px; color: rgba(255, 255, 255, .8); }
.summary-card .continue:hover { color: var(--lime-300); }
@media (max-width: 900px) { .summary-card { position: static; } }

/* ---------- Checkout ---------- */
.checkout-panel { max-width: 820px; margin: 0 auto; background: var(--forest-800); color: #fff; border-radius: var(--radius-xl); padding: clamp(26px, 5vw, 56px); box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.checkout-panel::before { content: ""; position: absolute; width: 420px; height: 420px; right: -160px; top: -200px; border-radius: 50%; background: radial-gradient(closest-side, rgba(208, 242, 76, .16), transparent); pointer-events: none; }
.checkout-panel > * { position: relative; }
.checkout-panel h2 { color: #fff; font-size: clamp(30px, 4vw, 46px); letter-spacing: -0.03em; margin: .35em 0 0; }
.checkout-panel h2 span { color: var(--lime-300); }
.checkout-meta { margin: 10px 0 0; color: rgba(255, 255, 255, .7); font-size: 15px; }
.checkout-meta .cart-quantity { color: #fff; font-weight: 700; }
.field input:disabled { color: var(--lime-300); font-family: var(--font-head); font-weight: 800; font-size: 20px; -webkit-text-fill-color: var(--lime-300); opacity: 1; }
.checkout-actions { margin-top: 28px; }
.checkout-actions .btn { min-width: 220px; justify-content: center; }

/* ---------- Receipt ---------- */
.receipt { max-width: 560px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xl); padding: clamp(26px, 5vw, 44px); box-shadow: var(--shadow-lg); }
.receipt .tick { width: 60px; height: 60px; border-radius: 50%; background: var(--pill-bg); color: var(--green-600); display: grid; place-items: center; margin-bottom: 18px; }
.receipt .tick svg { width: 30px; height: 30px; }
.receipt h2 { font-size: clamp(28px, 3.4vw, 38px); color: var(--green-600); margin: 0 0 10px; }
.receipt > p { color: var(--ink-500); }
.receipt > p strong { color: var(--ink-900); }
.receipt dl { margin: 24px 0 0; border-top: 1px solid var(--line); }
.receipt dl div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.receipt dt { font-weight: 600; color: var(--forest-800); }
.receipt dd { margin: 0; color: var(--ink-700); text-align: right; word-break: break-word; }
.receipt .actions { margin-top: 26px; text-align: center; }

@media print {
    .nav, .footer, .to-top, .shop-head, .receipt .actions { display: none !important; }
    .shop-section { padding: 0; background: #fff; }
    .receipt { box-shadow: none; border: 0; }
}
