/* =======================================
   MOC Shop / Checkout — Consolidated Styles
   ======================================= */

/* Product grid wrapper */


/* Product card (already excellent) */
.product-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-1);
    transition: transform .2s ease, box-shadow .2s ease;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-2);
}

.product-card .image {
    background-size: cover;
    background-position: center;
    aspect-ratio: 4/3;
}
.product-card .details {
    padding: clamp(16px, 2vw, 24px);
    text-align: center;
}
.product-card h3 {
    font-size: 1.25rem;
    margin-bottom: .4em;
    font-weight: 700;
}
.product-card p {
    font-size: .95rem;
    color: var(--ink-2);
    margin-bottom: 1em;
}
.price {
    font-weight: 700;
    margin-bottom: .5em;
}

/* ===== Product Options Drawer (Mobile) ===== */
.options-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 50;
}
.options-drawer {
    background: #fff;
    width: 100%;
    max-width: 340px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    padding: 28px 20px 34px;
    box-shadow: 0 -4px 18px rgba(0,0,0,.25);
    text-align: center;
    position: relative;
}
.close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--ink-2);
    cursor: pointer;
    transition: color .2s ease;
}
.close-btn:hover { color: var(--moc-green); }
.options-label {
    font-size: .95rem;
    color: var(--ink-2);
    margin-bottom: 1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.options-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.4em;
}
.option-btn {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    font-weight: 500;
    padding: 8px 18px;
    border-radius: 8px;
    transition: all .2s ease;
    cursor: pointer;
}
.option-btn:hover {
    background: var(--moc-green);
    color: #fff;
    border-color: var(--moc-green);
}
.option-btn.active {
    background: var(--moc-green);
    color: #fff;
    border-color: var(--moc-green);
    box-shadow: 0 0 0 1px var(--moc-green);
}
.drawer-cart-btn { margin-top: .8em; }

/* Shared button utilities (deduplicated) */
.btn.full { width: 100%; border-radius: 10px; }
.btn.disabled { opacity: .6; pointer-events: none; }

/* ===== Cart Sidebar ===== */
/* Overlay */
.cart-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 2000; /* above promo/nav */
    display: flex;
    justify-content: flex-end;
    align-items: stretch;
}
/* Sidebar panel */
.cart-sidebar {
    position: absolute;
    right: 0;
    width: 400px;
    max-width: 90vw;
    background: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: -6px 0 20px rgba(0,0,0,.25);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    transform: translateX(100%);
}
[x-show="$store.cart.mode === 'sidebar'"] .cart-sidebar { transform: translateX(0); }
/* Header */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 12px;
}
.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--ink-2);
    transition: color .2s ease;
}
.btn-close:hover { color: var(--moc-green); }
/* Continue btn */
.continue-btn {
    margin-bottom: 16px;
    border-color: var(--moc-green);
}
/* Items */
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #eee;
    padding: 10px 0;
}
.item-thumb {
    width: 60px;
    height: 60px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    flex-shrink: 0;
}
.item-info { flex: 1; min-width: 0; }
.item-price { font-weight: 600; font-size: .95rem; margin-top: 4px; }
.item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.qty-controls { display: flex; align-items: center; gap: 6px; }
.qty-controls button {
    border: 1px solid #ccc;
    background: #f8f8f8;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: .85rem;
    cursor: pointer;
}
.remove-btn {
    color: var(--moc-green);
    background: none;
    border: none;
    cursor: pointer;
    font-size: .8rem;
}
/* Footer */
.cart-footer {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding-top: 16px;
    background: #fff;
}
.subtotal { text-align: right; font-weight: 600; margin-bottom: 12px; }
/* Empty state */
.empty-cart { text-align: center; color: var(--ink-2); margin-top: 60px; }

/* ===== Cart Sidebar — Mobile (<=768px) ===== */
@media (max-width: 768px) {
    .cart-sidebar-overlay {
        justify-content: center;
        align-items: flex-end;
    }
    .cart-sidebar {
        width: 100%;
        max-width: none;
        height: 90%;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        box-shadow: 0 -6px 20px rgba(0,0,0,.25);
        transition: transform .35s cubic-bezier(.4,0,.2,1);
        padding-bottom: 90px;
    }
    [x-show="$store.cart.mode === 'sidebar'"] .cart-sidebar { transform: translateY(0); }

    /* Sticky footer bar (mobile) */
    .cart-footer {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid var(--line);
        box-shadow: 0 -4px 12px rgba(0,0,0,.1);
        padding: 16px 20px 24px;
    }
    .subtotal {
        text-align: left;
        font-size: 1.05rem;
        margin-bottom: 10px;
    }
    .btn.full {
        font-size: 1rem;
        font-weight: 600;
        padding: 12px;
    }
}

/* =======================================
   CHECKOUT PAGE — MOC DESIGN SYSTEM
   ======================================= */
.checkout-section {
    background: var(--paper);
    padding: clamp(24px, 4vw, 48px) 0;
}

.checkout-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(24px, 4vw, 40px);
}
@media (min-width: 768px) {
    .checkout-container {
        grid-template-columns: 2fr 1fr;
    }
}

.checkout-title {
    font-family: var(--font-head);
    font-size: 1.875rem;
    margin-bottom: 1rem;
}

/* ==== Items ==== */
.checkout-items { display: flex; flex-direction: column; gap: 16px; }
.checkout-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
}
.checkout-item-info {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.checkout-item-image {
    width: 72px;
    height: 72px;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius);
    flex-shrink: 0;
}
.checkout-item-details h3 {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}
.checkout-item-option {
    color: var(--ink-2);
    font-size: 0.875rem;
    margin-bottom: 8px;
}
.checkout-qty-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.checkout-qty-controls button {
    border: 1px solid var(--line);
    background: #f9fafb;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
.checkout-qty-controls span {
    min-width: 24px;
    text-align: center;
    font-weight: 500;
}
.checkout-item-price {
    text-align: right;
}
.checkout-item-price strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 4px;
}
.remove-link {
    background: none;
    border: none;
    color: var(--moc-green);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
}
.remove-link:hover { opacity: 0.8; }

/* ==== Promo ==== */
.checkout-promo {
    margin-top: 24px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
}
.checkout-promo h3 {
    font-weight: 600;
    margin-bottom: 8px;
}
.checkout-promo-row {
    display: flex;
    gap: 10px;
}
.input-field {
    flex: 1;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.9rem;
}
.promo-success {
    color: var(--moc-green);
    margin-top: 8px;
    font-size: 0.85rem;
}

/* ==== Add-ons ==== */
.checkout-addons {
    margin-top: 32px;
    border-top: 1px solid var(--line);
    padding-top: 20px;
}
.checkout-addons h3 {
    font-weight: 600;
    margin-bottom: 12px;
}
.checkout-addon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}
.checkout-addon-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    box-shadow: var(--shadow-1);
}
.checkout-addon-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    margin-bottom: 8px;
}
.checkout-addon-card h4 {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
}
.checkout-addon-card p {
    font-size: 0.85rem;
    color: var(--ink-2);
    margin-bottom: 6px;
}

/* ==== Summary ==== */
.checkout-summary {
    background: var(--paper);
    border: 1px solid #eee;
    border-radius: 16px;
    box-shadow: var(--shadow-1);
    padding: 24px;
    height: fit-content;
    position: sticky;
    top: 20px;
}
.checkout-summary h2 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    margin-bottom: 16px;
}
.summary-breakdown {
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 16px;
}
.summary-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.summary-line.total {
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 8px;
}
.checkout-trust {
    display: grid;
    gap: 1.25rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.trust-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.trust-icon i {
    font-size: 1.5rem;
    color: var(--moc-green);
    width: 28px;
    text-align: center;
}

.trust-text strong {
    display: block;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--ink);
}

.trust-text p {
    font-size: 0.85rem;
    color: var(--ink-2);
    margin: 0;
}

/* ==== Buttons ==== */
.btn-primary {
    background: var(--moc-orange);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: opacity .2s ease;
}
.btn-primary:hover { opacity: .9; }
.btn-outline {
    background: none;
    border: 1px solid var(--moc-green);
    color: var(--moc-green);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: all .2s ease;
}
.btn-outline:hover {
    background: var(--moc-green);
    color: #fff;
}

/* ==== Mobile Layout ==== */
@media (max-width: 768px) {
    .checkout-container { grid-template-columns: 1fr; }
    .checkout-summary { position: relative; top: 0; }
}
/* Checkout Payment Page */
.checkout-section { background:#fff; color:var(--ink); }
.checkout-container { display:grid; gap:40px; max-width:1200px; margin:auto; padding:40px 20px; }
@media(min-width:768px){ .checkout-container { grid-template-columns:2fr 1fr; } }

.checkout-left { display:flex; flex-direction:column; gap:20px; }
.checkout-summary { background:#f9fafb; border-radius:12px; padding:24px; box-shadow:var(--shadow-1); height:fit-content; }

.form-block { display:flex; flex-direction:column; gap:6px; }
.input-field { padding:10px 14px; border:1px solid var(--line); border-radius:8px; font-size:1rem; }
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

.stripe-element { padding:14px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.btn-primary.full { width:100%; border-radius:8px; font-weight:600; padding:12px 0; margin-top:10px; }

.summary-items { border-bottom:1px solid #ddd; margin-bottom:10px; }
.summary-item { display:flex; justify-content:space-between; align-items:center; padding:8px 0; }
.summary-info { display:flex; align-items:center; gap:10px; }
.summary-thumb { width:48px; height:48px; background-size:cover; background-position:center; border-radius:6px; }
.summary-name { font-weight:600; font-size:0.95rem; }
.summary-sub { color:#666; font-size:0.85rem; }
.summary-price { font-weight:600; }
.summary-line { display:flex; justify-content:space-between; margin-top:6px; font-size:0.95rem; }
.summary-line.total { margin-top:10px; font-size:1.1rem; font-weight:700; }
.payment-message { color:var(--moc-orange); margin-top:8px; font-size:0.9rem; }
.checkout-promo-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1rem 0;
}

.checkout-promo-summary .input-field {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.95rem;
}

.checkout-promo-summary .btn-primary {
    padding: 10px 18px;
    background: var(--moc-orange);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s all ease-in-out;
}

.checkout-promo-summary .btn-primary:hover {
    opacity: 0.9;
}

.promo-success {
    color: var(--moc-green);
    font-size: 0.85rem;
    margin-top: 4px;
}
.input-field.error {
    border-color: #e53e3e;
    background: #fff5f5;
}
.error-msg {
    font-size: 0.85rem;
    color: #e53e3e;
    margin: 2px 0 6px 0;
}

.checkout-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--line, #ddd);
    padding-bottom: 1rem;
}

.step {
    text-align: center;
    flex: 1;
    position: relative;
    color: var(--ink-2, #666);
    font-weight: 500;
}

.step .circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin: 0 auto 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
    color: var(--ink-2, #666);
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Active step */
.step.active .circle {
    background: var(--moc-green);
    color: #fff;
}

.step.active span {
    color: var(--moc-green);
    font-weight: 600;
}

/* Completed steps */
.step.complete .circle {
    background: var(--moc-orange);
    color: #fff;
}

.step.complete span {
    color: var(--moc-orange);
}

/* Connecting line between steps */
.step::after {
    content: '';
    position: absolute;
    top: 16px;
    right: -50%;
    height: 2px;
    width: 100%;
    background: #e0e0e0;
    z-index: 0;
}

.step:last-child::after {
    display: none;
}

.step.complete::after {
    background: var(--moc-orange);
}

/* ===========================================
   Checkout Loading Overlay
   =========================================== */
.checkout-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity .3s ease;
}

.checkout-loading-box {
    text-align: center;
    background: #fff;
    padding: 2rem 2.5rem;
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-2, 0 8px 20px rgba(0,0,0,0.12));
}

.checkout-loading-box p {
    font-weight: 500;
    color: var(--ink-2, #444);
    margin-top: 1rem;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #ddd;
    border-top: 4px solid var(--moc-green, #157575);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== CHECKOUT FORM STYLES ========== */

.checkout-block {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(16px, 2vw, 28px);
    margin-bottom: clamp(16px, 2vw, 24px);
    box-shadow: var(--shadow-1);
    transition: all 0.3s ease;
}

.checkout-block h3 {
    font-family: var(--font-head);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--ink);
}

.checkout-block label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ink-2);
    display: block;
    margin-top: 10px;
    margin-bottom: 4px;
}

.checkout-block .input-field {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.checkout-block .input-field:focus {
    border-color: var(--moc-green);
    outline: none;
    box-shadow: 0 0 0 2px rgba(21, 117, 117, 0.1);
}

.checkout-block .input-field.error {
    border-color: #f87171;
    background: #fff5f5;
}

.error-msg {
    font-size: 0.85rem;
    color: #dc2626;
    margin-top: 3px;
}

/* Buttons */
.checkout-block .btn-primary {
    background: var(--moc-green);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    margin-top: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.checkout-block .btn-primary:hover {
    background: #116363;
}

/* Shipping Options */
.shipping-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 8px;
    background: #fafafa;
    cursor: pointer;
}

.shipping-option input[type="radio"] {
    margin-right: 10px;
}

.shipping-option strong {
    color: var(--moc-green);
}
.checkout-summary-inline {
    font-size: 0.9rem;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.checkout-summary-inline button.edit-btn {
    background: none;
    border: none;
    color: var(--moc-green);
    cursor: pointer;
    padding: 0;
}

.form-centered {
    max-width: 500px;
    margin: 0 auto;
}
.checkout-summary-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    color: var(--ink-2);
}
.edit-btn {
    background: none;
    border: none;
    color: var(--moc-green);
    cursor: pointer;
    padding: 0;
}
.edit-btn:hover i {
    color: var(--moc-orange);
}
