/* ── Lainika Cart Page ── */

.cart-page {
    background:
        radial-gradient(circle at 8% 0%, rgba(255, 183, 201, 0.22), transparent 32%),
        linear-gradient(180deg, #fffdfb 0%, #faf6f1 42%, #fff9fb 100%);
}

.cart-page .container {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
}

.cart-page main {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

.cart-hero {
    padding: 1.5rem 0 2rem;
    text-align: center;
}

.cart-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: var(--gold-soft, #f6ecd3);
    color: var(--gold-deep, #9c7530);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.9rem;
}

.cart-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    color: var(--text);
    margin: 0 0 0.5rem;
}

.cart-hero p {
    color: var(--ink-soft);
    max-width: 40rem;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Layout: items + sticky summary ── */

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22rem;
    gap: 2rem;
    align-items: start;
}

/* Same [hidden]-vs-display bug hit elsewhere on this site: a
   class-based "display: ..." always beats the browser's own
   [hidden] rule (author styles win regardless of specificity), so
   toggling the `hidden` attribute alone wouldn't actually hide these
   without this override. */
.cart-layout[hidden],
.cart-favorites-prompt[hidden] {
    display: none;
}

@media (max-width: 900px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }
}

.cart-favorites-prompt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.9rem 1.15rem;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft, 0 24px 60px rgba(210, 140, 165, 0.14));
    font-size: 0.88rem;
    color: var(--text);
}

.cart-favorites-prompt i {
    color: #e0466f;
    margin-right: 0.4rem;
}

.cart-favorites-prompt button {
    flex-shrink: 0;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff9bb5 0%, #e86b93 100%);
    border: none;
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.cart-favorites-prompt button:hover {
    transform: translateY(-2px);
}

/* ── Line items ── */

.cart-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.cart-items-header h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--text);
    margin: 0;
}

.cart-clear-btn {
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--ink-soft);
    background: none;
    border: none;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.cart-clear-btn:hover {
    color: var(--rose-deep);
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.cart-line {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft, 0 24px 60px rgba(210, 140, 165, 0.14));
}

.cart-line-image {
    width: 5.5rem;
    height: 5.5rem;
    flex-shrink: 0;
    border-radius: 14px;
    object-fit: cover;
    background: #fff8fb;
}

.cart-line-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.cart-line-details h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.cart-line-price {
    margin: 0;
    font-size: 0.88rem;
    color: var(--rose-deep, #c44d72);
    font-weight: 700;
}

.cart-line-total {
    color: var(--ink-soft);
    font-weight: 500;
}

.cart-line-warning {
    margin: 0.1rem 0 0;
    font-size: 0.76rem;
    font-weight: 600;
    color: #b5651d;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Two per-item certificate fields (plushie name + who's adopting it)
   - quiet and compact so the pair doesn't compete with the price/
   warning above it, but still easy to find. Saved as you type (see
   setCartLineCertName()/setCartLineAdopterName() in cart.js). */
.cart-line-cert-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0.2rem 0;
}

.cart-line-cert-heading {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--gold-deep, #9c7530);
}

.cart-line-cert-required {
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    color: var(--ink-soft);
    opacity: 0.8;
}

.cart-line-cert {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cart-line-cert i {
    font-size: 0.7rem;
    color: var(--gold-deep, #9c7530);
    flex-shrink: 0;
}

.cart-line-cert-input {
    flex: 1;
    min-width: 0;
    font-family: inherit;
    font-size: 0.76rem;
    padding: 0.32rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--card-border);
    background: #fff8fb;
    color: var(--text);
}

.cart-line-cert-input:focus {
    outline: none;
    border-color: var(--gold-deep, #9c7530);
}

.cart-line-cert-input::placeholder {
    color: var(--ink-soft);
    opacity: 0.7;
}

/* Only added by validateCartCertFields() in cart.js, right before
   checkout - never shown just because a field is sitting empty while
   someone's still filling out the rest of the cart. */
.cart-line-cert-input.is-invalid {
    border-color: #d9534f;
    background: #fff5f5;
}

.cart-line-cert-input.is-invalid:focus {
    border-color: #d9534f;
}

.cart-line-cert-error {
    margin: -0.15rem 0 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: #d9534f;
}

/* Per-plushie certificate block. When a line holds more than one plushie
   each block is separated and headed, so the buyer names / genders /
   assigns every plushie individually. */
.cart-line-cert-unit {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.cart-line-cert-unit + .cart-line-cert-unit {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px dashed var(--card-border);
}

.cart-line-cert-unit-label {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--rose-deep);
}

/* Gender picker — a native <select> (best mobile UX: it opens the OS
   picker) styled to match the pill inputs, with a custom caret so it
   reads as intentional rather than a browser default. */
.cart-line-cert-select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 1.8rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%239c7530' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 0.7rem;
}

/* Muted while the "Select gender" placeholder is still the choice. Uses
   :has (progressive enhancement — harmless where unsupported). */
.cart-line-cert-select:has(option[value=""]:checked) {
    color: var(--ink-soft);
}

.cart-line-actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cart-qty-stepper {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
}

.cart-qty-btn {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    border: none;
    background: var(--gold-soft, #f6ecd3);
    color: var(--gold-deep, #9c7530);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease, background 0.2s ease, color 0.2s ease;
}

/* Hover only on real pointer devices, so the gold state doesn't stick
   after a tap on touch screens. */
@media (hover: hover) and (pointer: fine) {
    .cart-qty-btn:hover {
        background: var(--gold, #c9974a);
        color: #fff;
    }
}

/* Immediate touch feedback (tap-highlight is disabled site-wide). */
.cart-qty-btn:active {
    transform: scale(0.88);
    background: var(--gold, #c9974a);
    color: #fff;
    transition-duration: 0.08s;
}

.cart-qty-btn:focus-visible,
.cart-line-remove:focus-visible,
.cart-checkout-btn:focus-visible {
    outline: 2px solid var(--rose-deep, #c44d72);
    outline-offset: 2px;
}

.cart-qty-value {
    min-width: 1rem;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
}

.cart-line-remove {
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--ink-soft);
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: transform 0.12s ease, color 0.2s ease;
}

.cart-line-remove:hover {
    color: var(--rose-deep);
}

.cart-line-remove:active {
    transform: scale(0.94);
    color: var(--rose-deep);
    transition-duration: 0.08s;
}

/* Bigger, thumb-friendly quantity buttons on phones — the desktop 22px
   circles are well below a comfortable ~40px touch target. */
@media (max-width: 640px) {
    .cart-qty-btn {
        width: 2.35rem;
        height: 2.35rem;
        font-size: 1.15rem;
    }

    .cart-qty-stepper {
        gap: 1rem;
        padding: 0.3rem 0.8rem;
    }

    /* Roomier certificate fields on phones. There are now three per
       plushie (name / gender / adopter), so comfortable tap height and
       a 16px font — which stops iOS Safari from zooming on focus —
       matter more than the tight desktop sizing. */
    .cart-line-cert-input {
        padding: 0.6rem 0.85rem;
        font-size: 16px;
    }

    .cart-line-cert-select {
        padding-right: 2rem;
        background-size: 0.8rem;
    }
}

/* ── Suggestions ── */

.cart-suggestions {
    margin-top: 2.5rem;
}

.cart-suggestions h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--text);
    margin: 0 0 1rem;
}

.cart-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* Suggestion cards reuse createProductCardSkeleton() via
   renderProductGrid() (see cart.js), so they need the same base card
   styling the Products page grid gets - scoped to .cart-page instead
   of .products-page since that's the body class here. */
.cart-page .product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft, 0 24px 60px rgba(210, 140, 165, 0.14));
    overflow: hidden;
}

.cart-page .product-card-image {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #fff8fb;
}

.cart-page .product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cart-page .product-card-body {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.cart-page .product-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.cart-page .product-card-body h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.cart-page .product-favorite-btn {
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0.1rem;
    color: #cdbfc5;
    font-size: 0.95rem;
    cursor: pointer;
}

.cart-page .product-favorite-btn.is-active {
    color: #e0466f;
}

.cart-page .product-card-body p {
    display: none;
}

.cart-page .product-card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.cart-page .product-price-group {
    display: flex;
    flex-direction: column;
}

.cart-page .product-price {
    font-weight: 700;
    color: var(--rose-deep, #c44d72);
    font-size: 0.85rem;
}

.cart-page .product-cert-badge {
    display: none;
}

.cart-page .product-cta--button {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff9bb5 0%, #e86b93 100%);
    border: none;
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
}

.cart-page .product-label,
.cart-page .product-carousel-arrow,
.cart-page .product-carousel-dots {
    display: none;
}

.cart-page [data-product-id] {
    cursor: pointer;
}

/* ── Order summary ── */

.cart-summary {
    position: sticky;
    top: 5.5rem;
    padding: 1.5rem;
    border-radius: 24px;
    background: #fff;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-lift, 0 32px 70px rgba(196, 77, 114, 0.18));
}

.cart-summary h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--text);
    margin: 0 0 1rem;
}

.cart-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.cart-summary-row strong {
    font-size: 1.15rem;
    color: var(--rose-deep, #c44d72);
}

.cart-progress {
    margin-bottom: 1.25rem;
}

.cart-progress-text {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gold-deep, #9c7530);
}

.cart-progress-track {
    height: 0.4rem;
    border-radius: 999px;
    background: var(--gold-soft, #f6ecd3);
    overflow: hidden;
}

.cart-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--gold, #c9974a), var(--gold-deep, #9c7530));
    transition: width 0.3s ease;
}

.cart-field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.4rem;
}

.cart-packaging-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.cart-packaging-option {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    background: #fff8fb;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.cart-packaging-option:has(input:checked) {
    border-color: var(--rose-deep, #c44d72);
    background: #fff;
    box-shadow: 0 8px 20px rgba(196, 77, 114, 0.12);
}

/* A real photo instead of just text, so it's clear what each option
   actually looks like before choosing - the Signature Wrap thumbnail
   is a real customer photo of the standard gift bag + certificate,
   the Sphere thumbnail is a real photo of the Sphere itself. */
.cart-packaging-thumb {
    width: 4.4rem;
    height: 4.4rem;
    flex-shrink: 0;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}

.cart-packaging-main {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.cart-packaging-main input {
    margin-top: 0.25rem;
    accent-color: var(--rose-deep, #c44d72);
    flex-shrink: 0;
}

.cart-packaging-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cart-packaging-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text);
}

.cart-packaging-price {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold-deep, #9c7530);
    background: var(--gold-soft, #f6ecd3);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}

.cart-packaging-desc {
    font-size: 0.76rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

/* Adoption certificate intro - the actual name inputs now live on
   each cart line (a real certificate is per-plushie, not per order),
   so this is just a one-time explanation above the item list instead
   of repeating the same sentence on every row. */
.cart-items-cert-hint {
    margin: -0.4rem 0 1rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--gold-deep, #9c7530);
}

.cart-gift-note,
.cart-code-input {
    width: 100%;
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.6rem 0.85rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: #fff8fb;
    color: var(--text);
    margin-bottom: 1rem;
    resize: none;
}

.cart-code-input {
    border-radius: 999px;
}

.cart-gift-note:focus,
.cart-code-input:focus {
    outline: none;
    border-color: var(--rose-deep, #c44d72);
}

.cart-message-preview-toggle {
    display: block;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--ink-soft);
    background: none;
    border: none;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    margin-bottom: 0.6rem;
}

.cart-message-preview {
    white-space: pre-wrap;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--ink-soft);
    background: #fff8fb;
    border: 1px dashed var(--card-border);
    border-radius: 14px;
    padding: 0.85rem;
    margin-bottom: 1.1rem;
    max-height: 12rem;
    overflow-y: auto;
}

.cart-message-preview[hidden],
.cart-progress[hidden] {
    display: none;
}

.cart-checkout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff9bb5 0%, #e86b93 100%);
    border: none;
    border-radius: 999px;
    padding: 0.9rem 1.2rem;
    cursor: pointer;
    box-shadow: 0 14px 32px rgba(232, 107, 147, 0.32);
    transition: transform 0.2s ease;
}

.cart-checkout-btn:hover {
    transform: translateY(-2px);
}

.cart-checkout-btn:active {
    transform: translateY(0) scale(0.98);
    transition-duration: 0.08s;
}

.cart-share-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 0.65rem 1rem;
    cursor: pointer;
    margin-top: 0.7rem;
}

.cart-share-btn:hover {
    border-color: rgba(196, 77, 114, 0.35);
}

.cart-summary-trust {
    margin-top: 1.2rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.cart-summary-trust span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-summary-trust i {
    color: var(--gold, #c9974a);
}

/* ── Empty state ── */

.cart-empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    max-width: 26rem;
    margin: 0 auto;
}

.cart-empty-state i {
    font-size: 2.4rem;
    color: var(--card-border);
    margin-bottom: 1rem;
    display: block;
}

.cart-empty-state h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--text);
    margin: 0 0 0.5rem;
}

.cart-empty-state p {
    color: var(--ink-soft);
    line-height: 1.6;
    margin: 0 0 1.5rem;
}

.cart-empty-state a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff9bb5 0%, #e86b93 100%);
    border-radius: 999px;
    padding: 0.75rem 1.4rem;
    text-decoration: none;
}

@media (max-width: 480px) {
    .cart-line {
        flex-wrap: wrap;
    }

    .cart-summary {
        position: static;
    }
}
