/* ================================================
   Shop CSS — Kurdolphin Shop System
   ================================================ */

/* ---------- Cart icon in header ---------- */
.cart-icon-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-block-size: 2.75rem;
    min-inline-size: 2.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.052);
    font-size: 1.1rem;
    text-decoration: none;
    transition: background var(--transition-fast), transform var(--transition-fast);
}
.cart-icon-link:hover { background: var(--color-green-soft); transform: translateY(-1px); }

.cart-count-badge {
    position: absolute;
    top: -6px;
    inset-inline-end: -6px;
    background: var(--color-green-bright);
    color: #06140d;
    font-size: .65rem;
    font-weight: 900;
    min-width: 18px;
    height: 18px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 .25em;
    line-height: 1;
    pointer-events: none;
}
.cart-count-badge[hidden] { display: none; }

/* ---------- Shop Hero ---------- */
.shop-hero {
    background: linear-gradient(135deg, rgba(45,122,79,.2), rgba(201,168,76,.1));
    border-bottom: 1px solid var(--color-border);
    padding: 3rem 1.5rem 2rem;
    text-align: center;
}
.shop-hero-inner { max-width: 600px; margin: auto; }
.shop-hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); margin: .5rem 0 .4rem; }
.shop-hero p { color: var(--color-text-soft); margin: 0; }

/* ---------- Shop Shell ---------- */
.shop-shell {
    max-width: var(--container);
    margin-inline: auto;
    padding: 2rem 1.25rem 4rem;
}

/* ---------- Category Filter Tabs ---------- */
.shop-filter-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: .5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}
.shop-filter-bar::-webkit-scrollbar {
    display: none;
}
.shop-cat-btn {
    flex-shrink: 0;
    scroll-snap-align: start;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    color: rgba(255,255,255,.65);
    border-radius: 99px;
    min-height: 2.75rem;
    padding: .4em 1.1em;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}
.shop-cat-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.shop-cat-btn.is-active {
    background: rgba(29,185,84,.2);
    border-color: rgba(29,185,84,.5);
    color: var(--color-green-bright);
}

/* ---------- Product Grid ---------- */
.shop-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.shop-product-card {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color .2s, transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.shop-product-card:hover {
    border-color: rgba(29,185,84,.4);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,.3);
}

.shop-card-img-btn {
    display: block;
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #1a1a2a;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 100%;
}
.shop-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.shop-product-card:hover .shop-card-img { transform: scale(1.05); }

.shop-card-badge {
    position: absolute;
    top: .5rem;
    inset-inline-start: .5rem;
    font-size: .7rem;
    font-weight: 800;
    border-radius: 6px;
    padding: .2em .6em;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.out-of-stock-badge {
    background: rgba(239,68,68,.8);
    color: #fff;
}

.shop-card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1;
}
.shop-card-cat {
    font-size: .72rem;
    font-weight: 700;
    color: var(--color-gold-bright);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin: 0;
}
.shop-card-name { font-size: .95rem; font-weight: 700; margin: 0; flex: 1; }
.shop-card-name-btn {
    background: none;
    border: none;
    color: var(--color-text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    text-align: inherit;
    transition: color .2s;
}
.shop-card-name-btn:hover { color: var(--color-green-bright); }

.shop-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: auto;
    padding-top: .5rem;
    flex-wrap: wrap;
}
.shop-card-price {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--color-gold-bright);
}
.shop-add-btn {
    font-size: .78rem;
    padding: .4em .85em;
    min-block-size: 2rem;
}
.shop-add-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.4);
}

.shop-empty, .shop-no-results {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 2rem;
    text-align: center;
    color: rgba(255,255,255,.4);
}
.shop-empty-icon { font-size: 3rem; }
.shop-no-results[hidden] { display: none; }

/* ---------- Product Modal ---------- */
.shop-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8000;
    backdrop-filter: blur(6px);
    padding: 1rem;
}
.shop-modal-overlay[hidden] { display: none; }

.shop-modal-card {
    background: #13131e;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 18px;
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 32px 80px rgba(0,0,0,.6);
    animation: modalIn .25s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.94) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.shop-modal-close {
    position: absolute;
    top: .75rem;
    inset-inline-end: .75rem;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: #fff;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background .2s;
}
.shop-modal-close:hover { background: rgba(239,68,68,.3); }

.shop-modal-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.shop-modal-img-wrap {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 18px 0 0 18px;
    background: #1a1a2a;
}
html[dir="ltr"] .shop-modal-img-wrap { border-radius: 0 18px 18px 0; }
.shop-modal-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.shop-stock-badge {
    position: absolute;
    bottom: .75rem;
    inset-inline-start: .75rem;
    background: rgba(0,0,0,.7);
    border-radius: 8px;
    padding: .2em .6em;
    font-size: .75rem;
    font-weight: 700;
}

.shop-modal-info {
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.shop-modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #f0f0ff;
    margin: 0;
}
.shop-modal-desc {
    font-size: .9rem;
    color: var(--color-text-soft);
    line-height: 1.65;
    margin: 0;
}
.shop-modal-price {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--color-gold-bright);
    margin: 0;
}

/* Quantity selector */
.shop-qty-row {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.shop-qty-label { font-size: .85rem; color: rgba(255,255,255,.7); }
.shop-qty-control {
    display: flex;
    align-items: center;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    overflow: hidden;
}
.shop-qty-btn {
    background: rgba(255,255,255,.06);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.shop-qty-btn:hover { background: rgba(255,255,255,.12); }
.shop-qty-input {
    width: 44px;
    text-align: center;
    background: transparent;
    border: none;
    border-inline: 1px solid rgba(255,255,255,.1);
    color: #f0f0ff;
    font-size: .95rem;
    font-weight: 700;
    outline: none;
    padding: 0;
}

.shop-modal-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}
.shop-modal-add-btn { flex: 1; justify-content: center; }

/* ---------- Toast ---------- */
.shop-toast {
    position: fixed;
    bottom: 1.5rem;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    background: #1e1e30;
    border: 1px solid rgba(29,185,84,.4);
    color: #6ee7b7;
    border-radius: 12px;
    padding: .75rem 1.5rem;
    font-size: .9rem;
    font-weight: 600;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s, bottom .3s;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}
.shop-toast.is-show { opacity: 1; bottom: 2rem; }

/* ---------- Floating Cart (FAB) ---------- */
.shop-fab-cart {
    position: fixed;
    bottom: 80px; /* Above the PWA bottom nav */
    inset-inline-end: 1rem;
    background: var(--color-green-bright);
    color: #000;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 16px rgba(29, 185, 84, 0.4);
    z-index: 90;
    transition: transform 0.2s, background 0.2s;
    text-decoration: none;
}

.shop-fab-cart:hover {
    background: #1ed760;
    transform: scale(1.05);
}

.shop-fab-cart .cart-count-badge {
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    background: #fff;
    color: var(--color-green-bright);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ---------- Cart Page ---------- */
.cart-page {
    max-width: var(--container);
    margin-inline: auto;
    padding: 2rem 1.25rem 4rem;
}
.cart-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}
.cart-header h1 { margin: 0; font-size: 1.75rem; }
.cart-back-btn { margin-inline-start: auto; }

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
}

/* Cart items */
.cart-items { display: flex; flex-direction: column; gap: 1rem; }
.cart-item {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 1rem;
    align-items: center;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    padding: 1rem;
    animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

.cart-item-img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.1);
}
.cart-item-info { min-width: 0; }
.cart-item-name {
    font-size: .95rem;
    font-weight: 700;
    color: #f0f0ff;
    margin: 0 0 .25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-price { font-size: .85rem; color: var(--color-gold-bright); font-weight: 700; margin: 0; }

.cart-item-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
}
.cart-qty-row {
    display: flex;
    align-items: center;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 6px;
    overflow: hidden;
}
.cart-qty-btn {
    background: rgba(255,255,255,.05);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1rem;
    transition: background .15s;
}
.cart-qty-btn:hover { background: rgba(255,255,255,.12); }
.cart-qty-num {
    width: 32px;
    text-align: center;
    font-size: .88rem;
    font-weight: 700;
    color: #f0f0ff;
    border-inline: 1px solid rgba(255,255,255,.1);
    padding: 2px 0;
    background: transparent;
}
.cart-item-remove {
    background: none;
    border: none;
    color: #f87171;
    cursor: pointer;
    font-size: .78rem;
    padding: .2em .5em;
    border-radius: 4px;
    transition: background .15s;
}
.cart-item-remove:hover { background: rgba(239,68,68,.15); }

.cart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 2rem;
    text-align: center;
    color: rgba(255,255,255,.45);
    grid-column: 1 / -1;
}
.cart-empty-icon { font-size: 3.5rem; }
.cart-empty-state[hidden] { display: none; }

/* Cart Summary */
.cart-summary {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    padding: 1.5rem;
    position: sticky;
    top: 80px;
}
.cart-summary[hidden] { display: none; }
.cart-summary h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 1.25rem; color: #f0f0ff; }
.cart-summary-rows { display: flex; flex-direction: column; gap: .65rem; margin-bottom: 1rem; }
.cart-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: .9rem;
    color: rgba(255,255,255,.75);
}
.cart-summary-total {
    font-size: 1rem;
    font-weight: 700;
    color: #f0f0ff;
    padding-top: .65rem;
    border-top: 1px solid rgba(255,255,255,.08);
}
.cart-free-shipping-note {
    font-size: .8rem;
    color: var(--color-green-bright);
    text-align: center;
    margin: .5rem 0;
}
.cart-free-shipping-note[hidden] { display: none; }
.cart-checkout-btn { width: 100%; justify-content: center; margin-top: 1rem; }

/* ---------- Checkout ---------- */
.checkout-page {
    max-width: var(--container);
    margin-inline: auto;
    padding: 2rem 1.25rem 4rem;
}
.checkout-header { margin-bottom: 2rem; }
.checkout-header h1 { margin: .4rem 0 0; font-size: 1.75rem; }
.checkout-flash {
    padding: .75rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: .9rem;
}
.checkout-flash-err { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }

.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
    align-items: start;
}

.checkout-fieldset {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.checkout-fieldset legend {
    font-weight: 700;
    font-size: .9rem;
    color: rgba(255,255,255,.7);
    padding-inline: .4rem;
}
.checkout-form-row { display: flex; gap: 1rem; }
.checkout-form-row.two-col > * { flex: 1; min-width: 0; }
.checkout-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .85rem; }
.checkout-label { font-size: .85rem; color: rgba(255,255,255,.7); font-weight: 600; }
.checkout-input {
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    color: #f0f0ff;
    border-radius: 8px;
    padding: .65rem .85rem;
    font-size: .9rem;
    outline: none;
    transition: border-color .2s;
    width: 100%;
    box-sizing: border-box;
}
.checkout-input:focus { border-color: rgba(29,185,84,.6); }
.checkout-select { cursor: pointer; }

/* Payment options */
.checkout-payment-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-top: .5rem;
}
.checkout-payment-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: rgba(255,255,255,.04);
}
.checkout-payment-card:hover { border-color: rgba(29,185,84,.4); }
.checkout-payment-card.is-selected {
    border-color: var(--color-green-bright);
    background: rgba(29,185,84,.1);
}
.checkout-payment-disabled { opacity: .5; cursor: not-allowed; }
.checkout-payment-radio { display: none; }
.checkout-payment-icon { font-size: 1.5rem; }
.checkout-payment-label { font-size: .88rem; font-weight: 600; }
.checkout-coming-soon { display: block; font-size: .72rem; color: var(--color-muted); margin-top: .15rem; }

.checkout-submit-btn { width: 100%; justify-content: center; margin-top: 1rem; }

/* Checkout summary sidebar */
.checkout-summary {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    padding: 1.5rem;
    position: sticky;
    top: 80px;
}
.checkout-summary h2 { font-size: 1rem; font-weight: 700; margin: 0 0 1rem; color: #f0f0ff; }
.checkout-summary-items {
    list-style: none;
    margin: 0 0 .75rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.checkout-summary-item {
    display: flex;
    justify-content: space-between;
    font-size: .85rem;
    color: rgba(255,255,255,.8);
}
.checkout-summary-divider {
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin: .75rem 0;
}
.checkout-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: .9rem;
    color: rgba(255,255,255,.75);
    margin-bottom: .5rem;
}
.checkout-summary-total { font-weight: 700; font-size: 1rem; color: #f0f0ff; }
.checkout-empty-notice { font-size: .85rem; color: rgba(255,255,255,.4); text-align: center; }

/* ---------- Order Confirmation ---------- */
.order-confirm-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 2rem 1.25rem;
}
.order-confirm-card {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(29,185,84,.2);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    text-align: center;
    max-width: 500px;
    width: 100%;
    animation: modalIn .3s ease;
}
.order-confirm-icon { font-size: 4rem; margin-bottom: 1rem; }
.order-confirm-card h1 { font-size: 1.8rem; margin: 0 0 .5rem; color: #f0f0ff; }
.order-confirm-card > p { color: var(--color-text-soft); margin-bottom: 1.5rem; }
.order-number-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: rgba(29,185,84,.12);
    border: 1px solid rgba(29,185,84,.3);
    border-radius: 12px;
    padding: .75rem 1.5rem;
    margin-bottom: 1rem;
}
.order-number-badge span { font-size: .78rem; color: rgba(255,255,255,.6); }
.order-number-badge strong { font-size: 1.2rem; font-family: monospace; color: var(--color-green-bright); margin-top: .2rem; }
.order-total-display { font-size: 1rem; color: rgba(255,255,255,.7); margin-bottom: 1.5rem; }
.order-total-display strong { color: var(--color-gold-bright); }
.order-confirm-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .cart-layout,
    .checkout-layout { grid-template-columns: 1fr; }
    .cart-summary, .checkout-summary { position: static; }
    .shop-modal-inner { grid-template-columns: 1fr; }
    .shop-modal-img-wrap { border-radius: 18px 18px 0 0; aspect-ratio: 16/9; }
    .checkout-payment-options { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .shop-shell { padding-inline: 1rem; }
    .shop-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .75rem;
    }
    .shop-card-body { padding: .8rem; }
    .shop-card-footer { align-items: stretch; }
    .shop-add-btn { width: 100%; }
    
    /* Bottom Sheet Modal Transformation */
    .shop-modal-overlay { align-items: flex-end; padding: 0; }
    .shop-modal-card { 
        border-radius: 24px 24px 0 0; 
        max-height: 85vh; 
        animation: bottomSheetIn .3s cubic-bezier(0.1, 0.9, 0.2, 1);
        border: none;
        border-top: 1px solid rgba(255,255,255,.1);
    }
    @keyframes bottomSheetIn {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
    .shop-modal-img-wrap { border-radius: 24px 24px 0 0; aspect-ratio: 4/3; }

    .checkout-form-row { flex-direction: column; }
}
