/* =====================================================================
   shop.css — কার্ট, চেকআউট, অর্ডার পেজ (mobile-first, responsive)
   ব্র্যান্ড রং: বেগুনি #7C3AED (আপনার সাইটের সাথে মেলানো)
===================================================================== */

:root {
    --sh-primary:      #7C3AED;
    --sh-primary-dark: #5B21B6;
    --sh-primary-soft: #F3EEFF;
    --sh-ink:          #1F1B2E;
    --sh-muted:        #6B6880;
    --sh-line:         #E7E3F1;
    --sh-bg:           #F7F5FC;
    --sh-card:         #FFFFFF;
    --sh-ok:           #15803D;
    --sh-ok-soft:      #DCFCE7;
    --sh-warn:         #92400E;
    --sh-warn-soft:    #FEF3C7;
    --sh-error:        #B91C1C;
    --sh-error-soft:   #FEE2E2;
    --sh-bkash:        #E2136E;
    --sh-radius:       16px;
}

.shop-page {
    background: var(--sh-bg);
    padding: 20px 0 72px;
    color: var(--sh-ink);
    min-height: 60vh;
}
.shop-page *,
.shop-page *::before,
.shop-page *::after { box-sizing: border-box; }

.shop-title {
    font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
    line-height: 1.25;
    margin: 8px 0 20px;
    font-weight: 700;
}

/* ---------- layout ---------- */
.shop-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
@media (min-width: 900px) {
    .shop-grid { grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; }
    .summary-card { position: sticky; top: 96px; }
}

.checkout-main { display: grid; gap: 16px; min-width: 0; }

.sh-card {
    background: var(--sh-card);
    border: 1px solid var(--sh-line);
    border-radius: var(--sh-radius);
    padding: 16px;
    min-width: 0;
}
@media (min-width: 640px) { .sh-card { padding: 22px; } }

/* fieldset reset */
fieldset.sh-section { margin: 0; }
.sh-legend {
    float: left;
    width: 100%;
    padding: 0;
    margin: 0 0 16px;
    font-size: 1.05rem;
    font-weight: 700;
}
.sh-legend + * { clear: both; }

/* ---------- buttons ---------- */
.sh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 12px;
    border: 1.5px solid transparent;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s;
}
.sh-btn:active { transform: translateY(1px); }
.sh-btn-primary { background: var(--sh-primary); color: #fff; }
.sh-btn-primary:hover { background: var(--sh-primary-dark); color: #fff; }
.sh-btn-ghost { background: #fff; color: var(--sh-primary); border-color: var(--sh-primary); }
.sh-btn-ghost:hover { background: var(--sh-primary-soft); }
.sh-btn-block { display: flex; width: 100%; }
.sh-btn[disabled], .sh-btn.is-loading { opacity: .6; cursor: not-allowed; pointer-events: none; }
.sh-btn.is-loading::after,
[data-shop-action].is-loading::after {
    content: "";
    width: 16px; height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: sh-spin .7s linear infinite;
    margin-left: 8px;
}
[data-shop-action].is-loading { opacity: .7; pointer-events: none; }
@keyframes sh-spin { to { transform: rotate(360deg); } }

.sh-link {
    display: block;
    text-align: center;
    margin-top: 14px;
    color: var(--sh-primary);
    font-weight: 600;
    text-decoration: none;
}
.sh-link:hover { text-decoration: underline; }

:where(.shop-page) a:focus-visible,
:where(.shop-page) button:focus-visible,
:where(.shop-page) input:focus-visible,
:where(.shop-page) textarea:focus-visible {
    outline: 3px solid rgba(124, 58, 237, .35);
    outline-offset: 2px;
}

/* ---------- alerts ---------- */
.sh-alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: .95rem;
    line-height: 1.5;
}
.sh-alert[hidden] { display: none; }
.sh-alert-error { background: var(--sh-error-soft); color: var(--sh-error); }
.sh-alert-warn  { background: var(--sh-warn-soft);  color: var(--sh-warn); }

/* ---------- empty state ---------- */
.sh-empty { text-align: center; padding: 48px 20px; color: var(--sh-muted); }
.sh-empty svg { color: var(--sh-primary); margin-bottom: 8px; }
.sh-empty h2 { color: var(--sh-ink); font-size: 1.25rem; margin: 4px 0; }
.sh-empty p  { margin: 0 0 20px; }

/* ---------- thumbnails ---------- */
.thumb {
    display: block;
    width: 88px;
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    overflow: hidden;
    background: var(--sh-primary-soft);
    flex: none;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback { display: flex; align-items: flex-end; padding: 8px; }
.thumb-fallback span {
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
    line-height: 1.2;
    word-break: break-word;
}
.thumb-sm { width: 44px; border-radius: 8px; }
.thumb-sm.thumb-fallback { padding: 4px; }
.thumb-sm.thumb-fallback span { font-size: .55rem; }

/* ---------- cart ---------- */
.cart-list { display: grid; gap: 12px; min-width: 0; }

.cart-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 4px 14px;
    align-items: start;
}
.cart-item .thumb { width: 72px; }
.cart-thumb { grid-row: 1 / span 2; }
.cart-name { font-size: 1rem; line-height: 1.4; margin: 0; font-weight: 700; }
.cart-name a { color: inherit; text-decoration: none; }
.cart-name a:hover { color: var(--sh-primary); }
.cart-author { margin: 2px 0 0; font-size: .875rem; color: var(--sh-muted); }
.cart-unit { margin: 6px 0 0; font-weight: 600; }
.cart-unit s { color: var(--sh-muted); font-weight: 400; margin-left: 6px; font-size: .875rem; }
.cart-warning { margin: 8px 0 0; color: var(--sh-error); font-size: .875rem; }
.cart-item.is-unavailable { background: #FFFBFB; border-color: #FBD5D5; }
.cart-item.is-unavailable .thumb { filter: grayscale(1); opacity: .7; }
.cart-item.is-busy { opacity: .6; pointer-events: none; }
.cart-item.is-removing { opacity: 0; transform: scale(.98); transition: opacity .2s, transform .2s; }

.cart-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-top: 12px;
}
.cart-line-total {
    grid-column: 2;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--sh-primary-dark);
}
.cart-remove {
    background: none;
    border: 0;
    padding: 8px 0;
    color: var(--sh-error);
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
}
.cart-remove:hover { text-decoration: underline; }

@media (min-width: 640px) {
    .cart-item { grid-template-columns: 88px minmax(0, 1fr) auto; gap: 4px 20px; }
    .cart-item .thumb { width: 88px; }
    .cart-line-total { grid-column: 3; grid-row: 1; text-align: right; font-size: 1.15rem; }
}

.qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--sh-line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.qty-stepper button {
    width: 40px; height: 40px;
    border: 0;
    background: #fff;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--sh-ink);
    cursor: pointer;
}
.qty-stepper button:hover:not(:disabled) { background: var(--sh-primary-soft); color: var(--sh-primary); }
.qty-stepper button:disabled { color: #C4C0D4; cursor: not-allowed; }
.qty-num { min-width: 36px; text-align: center; font-weight: 700; }

/* ---------- summary ---------- */
.summary-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 14px; }
.sum-items { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; }
.sum-items li { display: flex; align-items: center; gap: 12px; }
.sum-item-name { flex: 1; min-width: 0; font-size: .92rem; line-height: 1.35; }
.sum-item-name small { display: block; color: var(--sh-muted); margin-top: 2px; }
.sum-items b { white-space: nowrap; font-size: .95rem; }

.sum-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 8px 0;
    color: var(--sh-muted);
}
.sum-row b { color: var(--sh-ink); }
.sum-total {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px dashed var(--sh-line);
    color: var(--sh-ink);
    font-size: 1.1rem;
    font-weight: 700;
}
.sum-total b { color: var(--sh-primary-dark); font-size: 1.35rem; }
.sum-note { margin: 4px 0 16px; font-size: .85rem; color: var(--sh-muted); line-height: 1.5; }
.sum-note-warn { color: var(--sh-error); margin: 10px 0 0; }
.secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 0; }

/* ---------- form ---------- */
.field { display: grid; align-content: start; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field label { font-weight: 600; font-size: .92rem; }
.field .opt { color: var(--sh-muted); font-weight: 400; }
.field input[type="text"],
.field input[type="email"],
.field textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1.5px solid var(--sh-line);
    border-radius: 12px;
    background: #fff;
    color: var(--sh-ink);
    font: inherit;
    font-size: 1rem; /* 16px — iOS zoom এড়াতে */
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus,
.field textarea:focus { border-color: var(--sh-primary); outline: none; box-shadow: 0 0 0 3px rgba(124, 58, 237, .18); }
.field input.is-invalid,
.field textarea.is-invalid { border-color: #DC2626; }
.hint { color: var(--sh-muted); font-size: .8rem; }

.field-row { display: grid; align-items: start; gap: 0 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.locked { position: relative; }
.locked input {
    background: #F1EFF7;
    color: var(--sh-muted);
    cursor: not-allowed;
    padding-right: 42px;
}
.locked svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--sh-muted); }

/* ---------- radio cards ---------- */
.choice-list { display: grid; gap: 10px; }
.choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1.5px solid var(--sh-line);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.choice:hover { border-color: #CBB8F5; }
.choice input {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
}
.choice-dot {
    width: 20px; height: 20px;
    flex: none;
    border-radius: 50%;
    border: 2px solid #C4C0D4;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.choice.is-selected { border-color: var(--sh-primary); background: var(--sh-primary-soft); }
.choice.is-selected .choice-dot {
    border-color: var(--sh-primary);
    box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 10px var(--sh-primary);
}
.choice:focus-within { outline: 3px solid rgba(124, 58, 237, .3); outline-offset: 2px; }
.choice-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.choice-text small { color: var(--sh-muted); font-size: .82rem; line-height: 1.4; }
.choice-side { font-weight: 700; white-space: nowrap; color: var(--sh-ink); display: inline-flex; align-items: center; }
.pay-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .2px;
}
.pay-bkash { background: var(--sh-bkash); color: #fff; }

/* ---------- order success ---------- */
.success-wrap { max-width: 960px; }
.success-head {
    text-align: center;
    padding: 28px 12px 8px;
}
.success-head h1 { font-size: clamp(1.3rem, 1rem + 1.5vw, 1.8rem); margin: 12px 0 6px; }
.success-head p { margin: 0; color: var(--sh-muted); }
.success-icon {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 68px; height: 68px;
    border-radius: 50%;
}
.success-head.is-ok .success-icon        { background: var(--sh-ok-soft); color: var(--sh-ok); }
.success-head.is-pending .success-icon   { background: var(--sh-warn-soft); color: var(--sh-warn); }
.success-head.is-cancelled .success-icon { background: var(--sh-error-soft); color: var(--sh-error); }
.order-no {
    display: inline-block;
    margin-top: 14px !important;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--sh-line);
    color: var(--sh-ink) !important;
    font-size: .92rem;
    word-break: break-all;
}
.success-grid { display: grid; gap: 16px; margin-top: 24px; }
@media (min-width: 800px) { .success-grid { grid-template-columns: 1fr 1fr; } }
.success-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
@media (max-width: 480px) { .success-actions .sh-btn { width: 100%; } }

.info-list { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 12px; margin: 0; }
.info-list dt { color: var(--sh-muted); font-size: .9rem; }
.info-list dd { margin: 0; font-weight: 600; word-break: break-word; }
.tag-paid {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--sh-ok-soft);
    color: var(--sh-ok);
    font-size: .75rem;
}

/* ---------- toast ---------- */
.shop-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 9999;
    max-width: min(92vw, 420px);
    padding: 12px 18px;
    border-radius: 12px;
    background: #1F1B2E;
    color: #fff;
    font-size: .95rem;
    line-height: 1.45;
    box-shadow: 0 10px 30px rgba(31, 27, 46, .3);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}
.shop-toast.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.shop-toast.is-error { background: #991B1B; }
.shop-toast a { color: #DDD0FF; font-weight: 700; margin-left: 10px; text-decoration: underline; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
    .shop-page *, .shop-toast { transition: none !important; animation: none !important; }
}

/* ---------- book-details পেজের cover ছবি ---------- */
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.out-of-stock {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #FEE2E2;
    color: #B91C1C;
    font-weight: 600;
}
