/* =====================================================
   Mighty Pedia Shop — Phase 1 styles
   Extends the base styles.css; reuses tokens, atmosphere,
   buttons, and form primitives.
   ===================================================== */

/* ---------- Top bar ---------- */
.shop-topbar {
    position: relative;
    z-index: 2;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--maxw-wide);
    margin: 0 auto;
    gap: 1rem;
}
.shop-topbar-logo {
    display: flex;
    align-items: center;
}
.shop-topbar-logo img {
    height: 36px;
    width: auto;
    display: block;
}
.shop-topbar-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.shop-back-link {
    color: var(--teal-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.2s ease;
}
.shop-back-link:hover {
    color: var(--teal);
}

/* ---------- Cart trigger button ---------- */
.cart-trigger {
    position: relative;
    background: var(--white);
    border: 1.5px solid rgba(0, 169, 157, 0.18);
    color: var(--teal-dark);
    border-radius: 100px;
    padding: 0.45rem 0.9rem 0.45rem 0.75rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.cart-trigger:hover {
    border-color: rgba(0, 169, 157, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 169, 157, 0.16);
}
.cart-trigger-icon {
    display: inline-flex;
    align-items: center;
    color: var(--teal-dark);
}
.cart-trigger-count {
    background: var(--orange);
    color: var(--white);
    font-size: 0.78rem;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    border-radius: 100px;
    font-weight: 700;
    min-width: 1.4rem;
    text-align: center;
}
.cart-trigger-count[data-cart-count="0"] {
    display: none;
}

/* ---------- Shop hero ---------- */
.shop-hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem 2rem 1rem;
    max-width: 760px;
    margin: 0 auto;
}
.shop-hero .accent-bar {
    margin: 0 auto 1.25rem;
}
.shop-hero h1 {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}
.shop-hero p {
    font-size: clamp(1rem, 2vw, 1.1rem);
    color: var(--gray-700);
    line-height: 1.65;
    max-width: 56ch;
    margin: 0 auto;
}

/* ---------- Product grid ---------- */
.shop-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: clamp(1.25rem, 3vw, 2rem);
    padding-top: 2.5rem;
    padding-bottom: 2rem;
    min-height: 240px;
}
.shop-grid-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--gray-500);
    font-family: 'Fredoka', 'Nunito', sans-serif;
    padding: 3rem 0;
}

/* ---------- Customization card (Pattern A) ---------- */
.customization-card {
    position: relative;
    z-index: 1;
    padding-top: 1rem;
    padding-bottom: 3rem;
}
.customization-card-inner {
    background: linear-gradient(135deg, rgba(243, 112, 33, 0.08), rgba(0, 169, 157, 0.06));
    border: 1.5px solid rgba(243, 112, 33, 0.2);
    border-radius: var(--r-xl);
    padding: clamp(1.75rem, 4vw, 2.5rem);
    text-align: center;
}
.customization-card-inner h2 {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: clamp(1.4rem, 3vw, 1.7rem);
    font-weight: 600;
    color: var(--gray-900);
    margin: 0.75rem 0 0.85rem;
    line-height: 1.25;
}
.customization-card-inner p {
    font-size: clamp(0.98rem, 2vw, 1.05rem);
    color: var(--gray-700);
    line-height: 1.7;
    max-width: 60ch;
    margin: 0 auto 1.5rem;
}

/* ---------- Cart drawer ---------- */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    background: var(--cream);
    box-shadow: -10px 0 40px rgba(20, 40, 60, 0.18);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}
.cart-drawer.open {
    transform: translateX(0);
}
.cart-drawer-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 169, 157, 0.12);
}
.cart-drawer-header h2 {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}
.cart-drawer-close {
    background: rgba(0, 0, 0, 0.04);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--gray-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.cart-drawer-close:hover {
    background: rgba(0, 0, 0, 0.08);
}
.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}
.cart-drawer-empty {
    text-align: center;
    color: var(--gray-500);
    font-family: 'Fredoka', 'Nunito', sans-serif;
    padding: 3rem 1rem;
}
.cart-drawer-footer {
    border-top: 1px solid rgba(0, 169, 157, 0.12);
    padding: 1.25rem 1.5rem 1.5rem;
    background: rgba(255, 255, 255, 0.6);
}
.cart-drawer-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.4rem;
}
.cart-drawer-total span:last-child {
    font-size: 1.25rem;
}
.cart-drawer-note {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
}
.cart-drawer-checkout {
    width: 100%;
}

/* Backdrop when cart is open */
.cart-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 35, 0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.cart-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .shop-topbar {
        padding: 1rem 1.25rem;
    }
    .shop-topbar-nav {
        gap: 0.85rem;
    }
    .shop-back-link {
        font-size: 0.88rem;
    }
    .cart-drawer {
        max-width: 100%;
    }
}

/* =====================================================
   PRODUCT CARDS
   ===================================================== */
.product-card {
    background: var(--white);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 169, 157, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12), 0 6px 16px rgba(0, 0, 0, 0.06);
}

.product-card-media {
    aspect-ratio: 4 / 3;
    background:
        linear-gradient(165deg, rgba(0, 169, 157, 0.06), rgba(243, 112, 33, 0.05)),
        var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.product-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* When image fails to load, fall back to a labeled placeholder treatment */
.product-card-media-empty {
    background:
        repeating-linear-gradient(
            45deg,
            rgba(0, 169, 157, 0.05),
            rgba(0, 169, 157, 0.05) 12px,
            rgba(0, 169, 157, 0.09) 12px,
            rgba(0, 169, 157, 0.09) 24px
        ),
        var(--white);
}
.product-card-media-empty::after {
    content: attr(data-label);
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-weight: 500;
    color: var(--teal-dark);
    text-align: center;
    padding: 1rem;
    font-size: 0.95rem;
}

.product-card-body {
    padding: 1.5rem 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.product-card-body .eyebrow {
    margin-bottom: 0.85rem;
    align-self: flex-start;
}
.product-card-title {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}
.product-card-desc {
    font-size: 0.95rem;
    color: var(--gray-700);
    line-height: 1.55;
    margin-bottom: 1.25rem;
}

/* ---------- Tier picker ---------- */
.tier-table {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}
.tier-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    background: rgba(0, 169, 157, 0.03);
    border: 1.5px solid rgba(0, 169, 157, 0.08);
    border-radius: var(--r-md);
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 0.92rem;
    color: var(--gray-700);
    text-align: left;
    transition: background 0.18s ease, border-color 0.18s ease;
    position: relative;
}
.tier-row:hover {
    background: rgba(0, 169, 157, 0.06);
    border-color: rgba(0, 169, 157, 0.2);
}
.tier-row.is-selected {
    background: rgba(0, 169, 157, 0.1);
    border-color: var(--teal);
    color: var(--gray-900);
}
.tier-radio {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 169, 157, 0.4);
    background: var(--white);
    flex-shrink: 0;
    position: relative;
}
.tier-row.is-selected .tier-radio {
    border-color: var(--teal);
}
.tier-row.is-selected .tier-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--teal);
}
.tier-name {
    font-weight: 600;
    color: var(--gray-900);
}
.tier-units {
    font-size: 0.82rem;
    color: var(--gray-500);
    justify-self: end;
    grid-column: 3 / 4;
}
.tier-price {
    font-weight: 700;
    color: var(--gray-900);
    justify-self: end;
    grid-column: 4 / 5;
    min-width: 4.5rem;
    text-align: right;
}
.tier-price-quote {
    color: var(--teal-dark);
    font-size: 0.88rem;
    font-weight: 600;
}
.tier-discount {
    grid-column: 3 / 5;
    justify-self: end;
    align-self: center;
    background: rgba(0, 169, 157, 0.14);
    color: var(--teal-dark);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 0.2rem;
    grid-row: 2 / 3;
}

/* ---------- Product card CTA ---------- */
.product-card-cta {
    margin-top: auto;
}
.btn-add-to-cart,
.btn-bulk-quote {
    width: 100%;
}

/* =====================================================
   CART LINES
   ===================================================== */
.cart-line {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(0, 169, 157, 0.1);
}
.cart-line:last-child {
    border-bottom: 0;
}
.cart-line-info {
    flex: 1;
    min-width: 0;
}
.cart-line-name {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.2rem;
    line-height: 1.3;
    font-size: 0.98rem;
}
.cart-line-tier {
    font-size: 0.82rem;
    color: var(--gray-500);
}
.cart-line-controls {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}
.qty-stepper {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 169, 157, 0.05);
    border: 1px solid rgba(0, 169, 157, 0.18);
    border-radius: 100px;
    overflow: hidden;
}
.qty-stepper button {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
    color: var(--teal-dark);
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.qty-stepper button:hover {
    background: rgba(0, 169, 157, 0.12);
}
.qty-stepper-value {
    min-width: 1.6rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--gray-900);
}
.cart-line-total {
    min-width: 5rem;
    text-align: right;
    font-weight: 700;
    color: var(--gray-900);
    font-size: 0.95rem;
}
.cart-line-remove {
    background: transparent;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    padding: 0 0.25rem;
    transition: color 0.15s ease;
}
.cart-line-remove:hover {
    color: var(--orange-dark);
}

.cart-drawer-error {
    background: rgba(243, 112, 33, 0.1);
    border: 1px solid rgba(243, 112, 33, 0.3);
    color: var(--orange-dark);
    padding: 0.7rem 0.85rem;
    border-radius: var(--r-md);
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

/* Body lock when cart drawer is open */
body.cart-open {
    overflow: hidden;
}

/* =====================================================
   RESPONSIVE TWEAKS
   ===================================================== */
@media (max-width: 500px) {
    .product-card-body {
        padding: 1.25rem 1.15rem 1.5rem;
    }
    .tier-row {
        font-size: 0.88rem;
        padding: 0.6rem 0.7rem;
    }
    .cart-line-controls {
        gap: 0.45rem;
    }
    .cart-line-total {
        min-width: 4.25rem;
    }
}

/* =====================================================
   ORDER SUCCESS PAGE
   ===================================================== */
.order-success {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 2.5rem auto 4rem;
    padding: 0 1.5rem;
}
.order-success-card {
    background: var(--white);
    border-radius: var(--r-xl);
    padding: clamp(2rem, 5vw, 3rem) clamp(1.5rem, 4vw, 2.5rem);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 169, 157, 0.1);
    text-align: center;
    margin-bottom: 2rem;
}
.order-success-check {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: rgba(0, 169, 157, 0.12);
    color: var(--teal-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    animation: pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes pop-in {
    from { opacity: 0; transform: scale(0.6); }
    to   { opacity: 1; transform: scale(1); }
}
.order-success-card .eyebrow {
    margin-bottom: 1rem;
}
.order-success-card h1 {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: clamp(1.7rem, 4vw, 2.2rem);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.85rem;
    line-height: 1.25;
}
.order-success-sub {
    color: var(--gray-700);
    font-size: clamp(1rem, 2vw, 1.1rem);
    line-height: 1.65;
    max-width: 48ch;
    margin: 0 auto 1.25rem;
}
.order-success-id {
    font-family: 'Nunito', sans-serif;
    font-size: 0.82rem;
    color: var(--gray-500);
    margin-bottom: 2rem;
    word-break: break-all;
}
.order-success-id:empty {
    display: none;
}
.order-success-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}
.order-success-page .customization-card {
    padding-top: 0;
}
