/* ============================================================
   SHOP — category page styles
   Depends on: /css/style.css (CSS custom properties)
   ============================================================ */

/* ---- Page layout ----------------------------------------- */

.shop-page {
    background: var(--cream-50);
    min-height: calc(100vh - var(--navbar-height));
    padding-bottom: var(--space-5xl);
}

/* On product detail page the related section follows immediately — no extra bottom gap needed */
.shop-page:has(+ .product-related) {
    padding-top: calc(var(--navbar-height) + var(--space-xl));
    padding-bottom: 0;
    min-height: 0;
}

.shop-page:has(+ .product-related) .shop-breadcrumb {
    margin-bottom: var(--space-xl);
}

@media (max-width: 768px) {
    .shop-page:has(+ .product-related) {
        padding-top: calc(var(--navbar-height) + var(--space-sm));
    }

    .shop-page:has(+ .product-related) .shop-breadcrumb {
        margin-bottom: var(--space-sm);
    }
}

.shop-page-header {
    padding: calc(var(--navbar-height) + var(--space-md)) 0 var(--space-xl);
    background: var(--warm-white);
    border-bottom: 1px solid var(--cream-200);
    margin-bottom: var(--space-2xl);
}

/* Shop index page uses .repair-header — reduce top padding */
.shop-landing .repair-header {
    padding-top: calc(var(--navbar-height) + 4px) !important;
    padding-bottom: var(--space-lg) !important;
}

@media (max-width: 768px) {
    .shop-landing .repair-header {
        padding-top: calc(70px + 4px) !important;
        padding-bottom: var(--space-md) !important;
    }
}

.shop-page-header .container {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* ---- Breadcrumb ------------------------------------------ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--cream-500);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--cream-500);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb span {
    color: var(--cream-400);
}

.breadcrumb .current {
    color: var(--cream-700);
    font-weight: 500;
}

/* ---- Shop breadcrumb (in-content, below header) ---------- */

.shop-breadcrumb {
    font-size: 0.85rem;
    color: var(--cream-500);
    margin-bottom: var(--space-md);
}

.shop-breadcrumb a {
    color: var(--cream-500);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.shop-breadcrumb a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.shop-breadcrumb .separator {
    margin: 0 0.4rem;
    color: var(--cream-300);
}

.shop-breadcrumb .current {
    color: var(--cream-700);
}

@media (max-width: 768px) {
    .shop-breadcrumb {
        font-size: 0.8rem;
    }
}

/* ---- Page title ------------------------------------------ */

.shop-page-title {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    color: var(--cream-900);
    line-height: 1.1;
    margin: 0;
}

.shop-page-subtitle {
    font-size: var(--font-size-base);
    color: var(--cream-600);
    margin: 0;
}

/* ---- Toolbar (count + sort) ------------------------------ */

.shop-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    gap: var(--space-md);
    flex-wrap: wrap;
}

.shop-count {
    font-size: var(--font-size-sm);
    color: var(--cream-600);
}

.shop-count strong {
    color: var(--cream-800);
    font-weight: 600;
}

.shop-sort {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.shop-sort label {
    font-size: var(--font-size-sm);
    color: var(--cream-600);
    white-space: nowrap;
}

.shop-sort select {
    border: 1px solid var(--cream-300);
    border-radius: var(--radius-sm);
    padding: 8px 32px 8px 12px;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    color: var(--cream-800);
    background: var(--warm-white);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6862' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color var(--transition-fast);
}

.shop-sort select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ---- Product grid ---------------------------------------- */

.shop-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
}

/* ---- Product card ---------------------------------------- */

.product-card {
    display: flex;
    flex-direction: column;
    background: var(--warm-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--cream-200);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--cream-300);
}

/* Image area */
.product-card-img-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #ffffff;
    border-bottom: 1px solid var(--cream-200);
    flex-shrink: 0;
}

.product-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform var(--transition-slow);
    padding: 8px;
    box-sizing: border-box;
}

.product-card:hover .product-card-img-wrap img {
    transform: scale(1.04);
}

/* Placeholder when no image */
.product-card-img-wrap.no-image {
    background: linear-gradient(135deg, var(--cream-100) 0%, var(--cream-200) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card-img-wrap.no-image::after {
    content: '';
    display: block;
    width: 56px;
    height: 56px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 24 24' fill='none' stroke='%23c2beb4' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.6;
}

/* Card body */
.product-card-body {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: var(--space-xs);
}

.product-card-brand {
    font-size: var(--font-size-xs);
    color: var(--cream-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
    margin: 0;
}

.product-card-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--cream-800);
    line-height: 1.35;
    margin: 0;
    /* Clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: var(--space-sm);
}

.product-card-price {
    font-weight: 700;
    color: var(--primary);
    font-size: var(--font-size-base);
}

/* Color dots */
.product-card-colors {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 60%;
}

.color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 150ms ease, border-color 150ms ease;
}

.color-dot:hover,
.color-dot.active {
    transform: scale(1.3);
    border-color: rgba(0, 0, 0, 0.35);
}

/* ---- Skeleton cards -------------------------------------- */

.skeleton-card {
    background: var(--warm-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--cream-200);
    overflow: hidden;
    pointer-events: none;
}

.skeleton-card-img {
    aspect-ratio: 4 / 3;
    background: var(--cream-100);
    animation: shop-shimmer 1.5s ease-in-out infinite;
}

.skeleton-card-body {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.skeleton-line {
    height: 12px;
    border-radius: var(--radius-sm);
    background: var(--cream-200);
    animation: shop-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line.short  { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.long   { width: 55%; }

@keyframes shop-shimmer {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

/* ---- Empty / error states -------------------------------- */

.shop-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-5xl) var(--space-lg);
    color: var(--cream-600);
}

.shop-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-lg);
    opacity: 0.4;
    display: block;
}

.shop-state h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--cream-700);
    margin: 0 0 var(--space-sm);
}

.shop-state p {
    font-size: var(--font-size-base);
    margin: 0;
}

.shop-state.error .shop-state-icon {
    color: var(--error);
}

/* ---- Model group headers (covers grouped view) ---------- */

.product-group-header {
    grid-column: 1 / -1;
    width: 100%;
    padding: 1.5rem 0 0.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary, #33848a);
    border-bottom: 1px solid var(--cream-200, #e8e2d9);
    margin-bottom: 0.25rem;
    letter-spacing: 0.01em;
}

/* First header needs no top breathing room */
.product-group-header:first-child {
    padding-top: 0;
}

@media (max-width: 768px) {
    .product-group-header {
        font-size: 1.15rem;
        padding: 1.25rem 0 0.4rem;
    }
}

/* ---- Sentinel (lazy load trigger) ----------------------- */

#shop-sentinel {
    grid-column: 1 / -1;
    height: 1px;
}

/* ---- Load-more indicator --------------------------------- */

.shop-loading-more {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: var(--space-xl);
}

.shop-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--cream-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: shop-spin 0.7s linear infinite;
}

@keyframes shop-spin {
    to { transform: rotate(360deg); }
}

/* ---- Responsive ------------------------------------------ */

@media (max-width: 1024px) {
    .shop-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .shop-page-title {
        font-size: var(--font-size-3xl);
    }
}

@media (max-width: 768px) {
    .shop-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    .shop-page-header {
        padding: calc(70px + var(--space-md)) 0 var(--space-lg);
        margin-bottom: var(--space-xl);
    }

    .shop-page-title {
        font-size: var(--font-size-2xl);
    }

    .shop-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .shop-sort {
        width: 100%;
    }

    .shop-sort select {
        flex: 1;
    }

    .product-card-title {
        font-size: var(--font-size-xs);
    }

    .product-card-body {
        padding: var(--space-sm);
    }
}

@media (max-width: 480px) {
    .shop-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    .color-dot {
        width: 11px;
        height: 11px;
    }
}

/* ============================================================
   PRODUCT DETAIL PAGE
   ============================================================ */

/* ---- Loading skeleton ------------------------------------ */

.product-skeleton {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    padding: var(--space-2xl) 0 var(--space-5xl);
    animation: shop-shimmer 1.5s ease-in-out infinite;
}

.product-skeleton-gallery {
    aspect-ratio: 1 / 1;
    background: var(--cream-100);
    border-radius: var(--radius-lg);
}

.product-skeleton-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding-top: var(--space-sm);
}

/* ---- Two-column layout ---------------------------------- */

.product-layout {
    display: grid;
    grid-template-columns: 55% 1fr;
    gap: var(--space-3xl);
    padding: 0 0 var(--space-xl);
}

/* ---- Gallery -------------------------------------------- */

.product-col-gallery {
    position: sticky;
    top: calc(var(--navbar-height) + var(--space-lg));
    align-self: start;
}

.product-gallery-main {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    border: 1px solid var(--cream-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-gallery-main.no-image {
    background: linear-gradient(135deg, var(--cream-100) 0%, var(--cream-200) 100%);
}

.product-gallery-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
    box-sizing: border-box;
    transition: opacity 150ms ease;
}

.product-gallery-thumbs {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

.product-gallery-thumb {
    width: 72px;
    height: 72px;
    border: 2px solid var(--cream-200);
    border-radius: var(--radius-md);
    background: #ffffff;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: border-color var(--transition-fast);
}

.product-gallery-thumb:hover {
    border-color: var(--cream-400);
}

.product-gallery-thumb.active {
    border-color: var(--primary);
}

.product-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
    box-sizing: border-box;
}

/* ---- Info column ---------------------------------------- */

.product-col-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.product-detail-brand {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin: 0;
}

.product-detail-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--cream-900);
    line-height: 1.2;
    margin: 0;
}

.product-detail-price {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--primary);
    margin: 0;
    line-height: 1;
}

.product-detail-compat {
    font-size: var(--font-size-sm);
    color: var(--cream-600);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.product-detail-compat i {
    color: var(--cream-400);
    font-size: 12px;
}

/* ---- Variant selector ----------------------------------- */

.product-variant-selector {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--cream-100);
}

.product-variant-label {
    font-size: var(--font-size-sm);
    color: var(--cream-600);
    margin: 0;
}

.product-variant-label strong {
    color: var(--cream-800);
}

.product-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.product-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2.5px solid rgba(0, 0, 0, 0.12);
    cursor: pointer;
    padding: 0;
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
    flex-shrink: 0;
}

.product-swatch:hover {
    transform: scale(1.15);
    border-color: rgba(0, 0, 0, 0.3);
}

.product-swatch.active {
    border-color: transparent;
    box-shadow: 0 0 0 2px var(--warm-white), 0 0 0 4px var(--primary);
}

/* ---- Stock status --------------------------------------- */

.product-stock {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.stock-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--cream-300);
}

.stock-dot.stock-in  { background: #22c55e; }
.stock-dot.stock-low { background: #f97316; }
.stock-dot.stock-out { background: #ef4444; }

.stock-label {
    font-size: var(--font-size-sm);
    color: var(--cream-600);
}

/* ---- Action button -------------------------------------- */

.product-actions {
    padding-top: var(--space-sm);
}

.product-btn-cart {
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    border: none;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: not-allowed;
    background: var(--cream-200);
    color: var(--cream-500);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: none;
}

.product-btn-cart i {
    font-size: 14px;
}

/* ---- Description ---------------------------------------- */

.product-description {
    padding-top: var(--space-md);
    border-top: 1px solid var(--cream-100);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.product-description p {
    font-size: var(--font-size-sm);
    color: var(--cream-700);
    line-height: 1.65;
    margin: 0;
}

.product-description-body p {
    font-size: var(--font-size-sm);
    color: var(--cream-700);
    line-height: 1.65;
    margin: 0 0 var(--space-sm);
}

.product-description-body p:last-child {
    margin-bottom: 0;
}

.product-description-body strong {
    color: var(--cream-900);
    font-weight: 600;
}

.product-description-body ul {
    margin: 0 0 var(--space-sm);
    padding-left: var(--space-lg);
}

.product-description-body li {
    font-size: var(--font-size-sm);
    color: var(--cream-700);
    line-height: 1.65;
    margin-bottom: 2px;
    list-style-type: disc;
}

.product-bulk-note {
    font-size: var(--font-size-xs) !important;
    color: var(--cream-500) !important;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background: var(--cream-100);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
}

.product-bulk-note i {
    color: var(--cream-400);
    font-size: 11px;
}

/* ---- Related products ----------------------------------- */

.product-related {
    background: var(--cream-50);
    border-top: 1px solid var(--cream-200);
    padding: var(--space-3xl) 0 var(--space-5xl);
}

.product-related-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--cream-800);
    margin: 0 0 var(--space-xl);
}

/* ---- Responsive ----------------------------------------- */

@media (max-width: 900px) {
    .product-layout {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
        padding: var(--space-xl) 0 var(--space-3xl);
    }
}

@media (max-width: 768px) {
    .product-layout {
        padding-top: 0;
    }
}

@media (max-width: 900px) {

    .product-col-gallery {
        position: static;
    }

    .product-gallery-main {
        aspect-ratio: 4 / 3;
    }

    .product-detail-title {
        font-size: var(--font-size-xl);
    }

    .product-detail-price {
        font-size: var(--font-size-2xl);
    }

    .product-skeleton {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .product-gallery-thumb {
        width: 56px;
        height: 56px;
    }

    .product-swatch {
        width: 28px;
        height: 28px;
    }
}

/* ============================================================
   GALLERY ARROWS
   ============================================================ */

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.32);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 200ms ease, background 200ms ease;
    z-index: 2;
    padding: 0;
    user-select: none;
}

.gallery-arrow-prev { left:  10px; }
.gallery-arrow-next { right: 10px; }

.gallery-arrow:hover {
    background: rgba(0, 0, 0, 0.55);
}

/* Desktop: hide by default, show on container hover */
@media (min-width: 769px) {
    .gallery-arrow {
        opacity: 0;
    }
    .product-gallery-main:hover .gallery-arrow {
        opacity: 1;
    }
}

/* Mobile: always visible, slightly smaller */
@media (max-width: 768px) {
    .gallery-arrow {
        opacity: 0.6;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

/* ============================================================
   GALLERY SCALE-DOWN (desktop only)
   ============================================================ */

@media (min-width: 769px) {
    .product-gallery-inner {
        width: 50%;
        margin: 0 auto;
    }
    /* Full-size images (hires_images: true in product metadata) */
    .product-gallery.hires .product-gallery-inner {
        width: 100% !important;
    }
}

/* ============================================================
   LIGHTBOX
   ============================================================ */

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 200ms ease;
}

.lightbox-overlay.open {
    opacity: 1;
}

.lightbox-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-img {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    /* No upscaling: image shows at natural size up to viewport limits */
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    transition: opacity 150ms ease;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 200ms ease;
    z-index: 1001;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Lightbox arrows: fixed to viewport edges */
.lightbox-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.8;
    width: 48px;
    height: 48px;
    font-size: 28px;
}

.lightbox-arrow.gallery-arrow-prev { left:  16px; }
.lightbox-arrow.gallery-arrow-next { right: 16px; }

.lightbox-arrow:hover {
    opacity: 1;
}

/* ============================================================
   FILTER SYSTEM — sidebar, drawers, pills, glow states
   ============================================================ */

/* ---- Glow keyframes -------------------------------------- */

@keyframes glow-bronze {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0); border-color: var(--cream-300); }
    50%       { box-shadow: 0 0 0 6px rgba(212, 165, 116, 0.28), 0 0 18px rgba(212, 165, 116, 0.18); border-color: var(--accent); }
}

/* ---- Desktop layout -------------------------------------- */

@media (min-width: 769px) {
    .mobile-topbar { display: none; }

    .shop-layout {
        display: grid;
        grid-template-columns: 250px 1fr;
        gap: var(--space-2xl);
        align-items: start;
    }

    /* Sidebar */
    .filter-sidebar {
        position: sticky;
        top: calc(var(--navbar-height) + var(--space-lg));
        display: flex;
        flex-direction: column;
        gap: var(--space-md);
    }

    .filter-section {
        background: var(--warm-white);
        border: 1px solid var(--cream-200);
        border-radius: var(--radius-md);
        padding: var(--space-md);
        transition: border-color 0.4s ease, box-shadow 0.4s ease;
    }

    /* State 1: brand section glows (bronze pulse) */
    .filter-section--glow-brand {
        animation: glow-bronze 2s ease-in-out infinite;
    }

    /* State 2: model section glows (bronze pulse) */
    .filter-section--glow-model {
        animation: glow-bronze 2s ease-in-out infinite;
    }

    /* State 3: confirmed — teal steady glow on both brand + model */
    .filter-section--confirmed {
        animation: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(51, 132, 138, 0.12), 0 0 12px rgba(51, 132, 138, 0.1);
        transition: border-color 0.5s ease, box-shadow 0.5s ease;
    }

    .filter-section--hidden {
        display: none;
    }

    .filter-section--category {
        margin-top: var(--space-sm);
        border-color: var(--cream-100);
        background: var(--cream-50);
    }
}

/* ---- Mobile layout --------------------------------------- */

@media (max-width: 768px) {
    .filter-sidebar { display: none; }

    .shop-layout {
        display: block;
    }

    /* Mobile top bar */
    .mobile-topbar {
        display: flex;
        gap: var(--space-sm);
        margin-bottom: var(--space-lg);
    }

    .mobile-topbar-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-xs);
        padding: 10px var(--space-md);
        border: 1px solid var(--cream-300);
        border-radius: var(--radius-sm);
        background: var(--warm-white);
        font-family: var(--font-family);
        font-size: var(--font-size-sm);
        font-weight: 500;
        color: var(--cream-700);
        cursor: pointer;
        transition: border-color var(--transition-fast), color var(--transition-fast);
    }

    .mobile-topbar-btn:hover,
    .mobile-topbar-btn.active {
        border-color: var(--primary);
        color: var(--primary);
    }

    /* Mobile glow on filter button */
    .mobile-topbar-btn--glow-brand,
    .mobile-topbar-btn--glow-model {
        animation: glow-bronze 2s ease-in-out infinite;
    }

    .mobile-topbar-btn--confirmed {
        animation: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(51, 132, 138, 0.12);
        color: var(--primary);
    }
}

/* ---- Filter label ---------------------------------------- */

.filter-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cream-500);
    margin: 0 0 var(--space-sm);
}

/* ---- Filter pills ---------------------------------------- */

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.filter-pills--column {
    flex-direction: column;
    gap: 6px;
}

.filter-pills--wrap {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1.5px solid var(--cream-300);
    border-radius: var(--radius-full);
    background: transparent;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--cream-700);
    cursor: pointer;
    text-decoration: none;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
    line-height: 1.3;
}

.filter-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-pill--active,
.filter-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--warm-white);
}

.filter-pill--active:hover,
.filter-pill.active:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--warm-white);
}

/* Clear × inside pill */
.filter-pill-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    font-size: 10px;
    line-height: 1;
    margin-left: 2px;
    flex-shrink: 0;
}

/* Model pills in sidebar: full-width with count */
.filter-pills--column .filter-pill {
    justify-content: space-between;
    border-radius: var(--radius-sm);
    padding: 7px 12px;
}

.filter-pill-count {
    font-size: var(--font-size-xs);
    color: var(--cream-400);
    font-weight: 400;
}

.filter-pill.active .filter-pill-count {
    color: rgba(255,255,255,0.7);
}

/* ---- Category pills row (kabels/opladers) ---------------- */

.category-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

/* ---- Mobile drawers -------------------------------------- */

.mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 500;
}

.mobile-drawer[hidden] {
    display: none;
}

.mobile-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-drawer.open .mobile-drawer-backdrop {
    opacity: 1;
}

.mobile-drawer-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--warm-white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-sm) var(--space-lg) var(--space-2xl);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mobile-drawer.open .mobile-drawer-sheet {
    transform: translateY(0);
}

.mobile-drawer-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--cream-300);
    margin: var(--space-sm) auto var(--space-md);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.mobile-drawer-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--cream-800);
}

.mobile-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--cream-100);
    color: var(--cream-600);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mobile-drawer-close:hover {
    background: var(--cream-200);
}

.mobile-drawer-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Glow on filter sections inside drawer */
.mobile-drawer .filter-section--glow-brand,
.mobile-drawer .filter-section--glow-model {
    animation: glow-bronze 2s ease-in-out infinite;
    border: 1px solid var(--cream-200);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.mobile-drawer .filter-section--confirmed {
    animation: none;
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: 0 0 0 3px rgba(51, 132, 138, 0.1);
}

/* Sort options in sort drawer */
.sort-option {
    display: block;
    width: 100%;
    padding: 14px var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--cream-700);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sort-option:hover {
    background: var(--cream-50);
    color: var(--cream-900);
}

.sort-option.active {
    color: var(--primary);
    font-weight: 600;
    background: var(--primary-subtle);
}

/* ---- Shop main (right side on desktop) ------------------- */

.shop-main {
    min-width: 0;
}

/* ---- Model filter select --------------------------------- */

.filter-model-select {
    width: 100%;
    border: 1px solid var(--cream-300);
    border-radius: var(--radius-sm);
    padding: 8px 32px 8px 12px;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    color: var(--cream-800);
    background: var(--warm-white);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6862' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color var(--transition-fast);
}

.filter-model-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Hide desktop sort toolbar on mobile for covers (has its own sort drawer) */
@media (max-width: 768px) {
    .shop-main .shop-toolbar .shop-sort { display: none; }
}

/* ============================================================
   CART — nav icon, badge, drawer, toast
   ============================================================ */

/* ---- Nav right-actions wrapper --------------------------- */

.nav-right-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---- Cart nav button ------------------------------------- */

.cart-nav-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--cream-700);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--transition-fast), background-color var(--transition-fast);
    flex-shrink: 0;
}

.cart-nav-btn:hover {
    color: var(--primary);
    background-color: var(--cream-100);
}

/* ---- Badge ----------------------------------------------- */

.cart-badge {
    position: absolute;
    top: 5px;
    right: 3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    box-sizing: border-box;
    pointer-events: none;
}

/* ---- Cart backdrop --------------------------------------- */

.cart-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.cart-backdrop[hidden] { display: none; }

.cart-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* ---- Cart drawer — desktop: right panel ------------------ */

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 100vw;
    background: var(--warm-white);
    z-index: 1101;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}

.cart-drawer[hidden] { display: none; }

.cart-drawer.open { transform: translateX(0); }

/* ---- Cart drawer — mobile: bottom sheet ------------------ */

@media (max-width: 768px) {
    .cart-drawer {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        transform: translateY(100%);
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    }

    .cart-drawer.open { transform: translateY(0); }
}

/* ---- Drawer handle (mobile only) ------------------------- */

.cart-drawer-handle {
    display: none;
}

@media (max-width: 768px) {
    .cart-drawer-handle {
        display: block;
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: var(--cream-300);
        margin: 12px auto 0;
        flex-shrink: 0;
        cursor: grab;
    }
}

/* ---- Drawer header --------------------------------------- */

.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--cream-200);
    flex-shrink: 0;
}

.cart-drawer-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--cream-900);
    margin: 0;
}

.cart-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--cream-100);
    color: var(--cream-600);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.cart-drawer-close:hover { background: var(--cream-200); }

/* ---- Drawer body (scrollable) ---------------------------- */

.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm) var(--space-lg);
    overscroll-behavior: contain;
}

/* ---- Empty cart ------------------------------------------ */

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-5xl) var(--space-lg);
    text-align: center;
}

.cart-empty-msg {
    font-size: var(--font-size-base);
    color: var(--cream-600);
    margin: 0;
}

.cart-empty-link {
    color: var(--primary);
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-decoration: none;
}

.cart-empty-link:hover { text-decoration: underline; }

/* ---- Cart item ------------------------------------------- */

.cart-item {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--cream-100);
    align-items: flex-start;
}

.cart-item:last-child { border-bottom: none; }

.cart-item-img {
    width: 60px;
    height: 60px;
    border: 1px solid var(--cream-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
}

.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
    box-sizing: border-box;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.cart-item-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--cream-800);
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

a.cart-item-title:hover { color: var(--primary); }

.cart-item-variant {
    font-size: var(--font-size-xs);
    color: var(--cream-500);
}

/* Bottom row: price + qty controls */
.cart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.cart-item-price {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--primary);
}

/* ---- Quantity controls ----------------------------------- */

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cart-qty-btn {
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--cream-300);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--cream-700);
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    padding: 0;
}

.cart-qty-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.cart-qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.cart-qty-num {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--cream-800);
    min-width: 22px;
    text-align: center;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--cream-400);
    font-size: 12px;
    cursor: pointer;
    padding: 6px;
    transition: color var(--transition-fast);
    line-height: 1;
    margin-left: 2px;
}

.cart-item-remove:hover { color: #ef4444; }
.cart-item-remove:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Drawer footer (totals) ------------------------------ */

.cart-drawer-footer {
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    border-top: 1px solid var(--cream-200);
    flex-shrink: 0;
}

/* ---- Totals ---------------------------------------------- */

.cart-totals {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: var(--space-md);
}

.cart-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--cream-700);
    gap: var(--space-sm);
}

.cart-totals-grand {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--cream-900);
}

.cart-totals-divider {
    height: 1px;
    background: var(--cream-200);
    margin: 2px 0;
}

.cart-shipping-tbd {
    color: var(--cream-400);
    font-style: italic;
    text-align: right;
}

.cart-shipping-free {
    color: var(--primary);
    font-weight: 600;
}

.cart-free-shipping-hint {
    font-size: var(--font-size-xs);
    color: var(--cream-500);
    text-align: center;
    margin: 0 0 var(--space-sm);
}

/* ---- Checkout button ------------------------------------- */

.cart-checkout-btn {
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    border: none;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 700;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.cart-checkout-btn:hover:not(:disabled) { background: var(--primary-dark); }

.cart-checkout-btn[data-checkout-ready="false"],
.cart-checkout-btn:disabled {
    background: var(--cream-300);
    color: var(--cream-500);
    cursor: not-allowed;
    opacity: 0.75;
}

/* ---- Toast ----------------------------------------------- */

.cart-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--cream-900);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    z-index: 1200;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

.cart-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cart-toast--error { background: #ef4444; }

/* ---- Add-to-cart button states (product detail) ---------- */

.product-btn-cart.is-orderable {
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background var(--transition-fast), opacity var(--transition-fast);
}

.product-btn-cart.is-orderable:hover:not(:disabled) {
    background: var(--primary-dark);
}

.product-btn-cart.is-orderable:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.product-btn-cart.is-added {
    background: #22c55e;
    cursor: default;
}

/* Swatch section shake animation when no variant selected */
@keyframes swatch-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60%  { transform: translateX(-5px); }
    40%, 80%  { transform: translateX(5px); }
}

.product-swatches--shake {
    animation: swatch-shake 0.4s ease;
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: var(--radius-sm);
}

/* ============================================================
   CHECKOUT PAGE
   ============================================================ */

.co-page {
    padding-top: calc(var(--navbar-height) + var(--space-xl));
    padding-bottom: var(--space-5xl);
    min-height: calc(100vh - var(--navbar-height));
}

@media (max-width: 768px) {
    .co-page {
        padding-bottom: 100px; /* clearance for sticky mobile bar */
    }
}

/* ---- Page title ------------------------------------------ */

.co-page-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--cream-900);
    margin: 0 0 var(--space-xl);
}

@media (max-width: 768px) {
    .co-page-title {
        font-size: var(--font-size-xl);
        margin-bottom: var(--space-lg);
    }
}

/* ---- Loading state --------------------------------------- */

.co-loading {
    display: flex;
    justify-content: center;
    padding: var(--space-5xl) 0;
}

/* ---- Two-column layout ----------------------------------- */

.co-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-3xl);
    align-items: start;
}

@media (max-width: 900px) {
    .co-layout {
        grid-template-columns: 1fr 320px;
        gap: var(--space-2xl);
    }
}

@media (max-width: 768px) {
    .co-layout {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    /* Prevent grid items from expanding beyond 1fr due to min-width: auto default */
    .co-form-col,
    .co-summary-col {
        min-width: 0;
    }

    /* Reduce section padding on narrow screens */
    .co-section {
        padding: var(--space-lg);
    }

    /* Collapse street row at 768px (not just at 480px) */
    .co-row--street {
        grid-template-columns: 1fr 1fr;
    }

    .co-row--street > .co-field:first-child {
        grid-column: 1 / -1;
    }
}

/* ---- Form sections --------------------------------------- */

.co-section {
    background: var(--warm-white);
    border: 1px solid var(--cream-200);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.co-section:last-child {
    margin-bottom: 0;
}

.co-section-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--cream-900);
    margin: 0 0 var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--cream-100);
}

.co-section-title-note {
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: var(--cream-400);
    margin-left: 4px;
}

/* ---- Form rows ------------------------------------------- */

.co-row {
    margin-bottom: var(--space-md);
}

.co-row:last-child {
    margin-bottom: 0;
}

.co-row--2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.co-row--street {
    display: grid;
    grid-template-columns: 1fr 110px 90px;
    gap: var(--space-md);
}

.co-row--postcode {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: var(--space-md);
}

@media (max-width: 480px) {
    .co-row--2col {
        grid-template-columns: 1fr;
    }

    .co-row--street {
        grid-template-columns: 1fr 1fr;
    }

    /* Street takes full width on small screens */
    .co-row--street > .co-field:first-child {
        grid-column: 1 / -1;
    }
}

/* ---- Form fields ----------------------------------------- */

.co-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.co-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--cream-700);
}

.co-optional {
    font-size: var(--font-size-xs);
    font-weight: 400;
    color: var(--cream-400);
}

.co-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--cream-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--cream-900);
    background: var(--warm-white);
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

/* Prevent iOS auto-zoom (must be ≥16px on mobile) */
@media (max-width: 768px) {
    .co-input {
        font-size: 16px;
    }
}

.co-input:focus {
    outline: none;
    border-color: var(--primary);
}

.co-input.error {
    border-color: #ef4444;
}

.co-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6862' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.co-error {
    font-size: var(--font-size-xs);
    color: #ef4444;
    margin: 0;
    min-height: 16px;
    line-height: 1.4;
}

/* ---- Checkbox row ---------------------------------------- */

.co-checkbox-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--cream-700);
    user-select: none;
}

.co-checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* ---- Business fields (toggle) ---------------------------- */

.co-business-fields {
    display: none;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--cream-100);
}

.co-business-fields.visible {
    display: flex;
}

/* ---- Magic code UI --------------------------------------- */

.co-magic-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.25rem;
    font-size: 0.82rem;
    color: #6b7280;
}
.co-magic-hint {
    color: #6b7280;
    font-size: 0.82rem;
}
.co-magic-btn {
    background: none;
    border: none;
    padding: 0;
    color: #33848a;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.co-magic-btn:hover { color: #1f6469; }

.co-pin-area {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    margin-bottom: var(--space-md);
}
.co-pin-msg {
    font-size: 0.875rem;
    color: #374151;
    margin: 0 0 0.6rem;
}
.co-pin-msg a.co-magic-resend {
    color: #33848a;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.875rem;
}
.co-pin-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.co-pin-input {
    width: 8rem;
    letter-spacing: 0.2em;
    font-size: 1.1rem;
    text-align: center;
}
.co-pin-verify-btn {
    background: #33848a;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.co-pin-verify-btn:hover { background: #1f6469; }
.co-pin-verify-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.co-welcome-msg {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: #059669;
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
}

/* ---- Field pulse (action needed) ------------------------- */

@keyframes co-field-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0); border-color: var(--cream-300, #e5e7eb); }
    50%       { box-shadow: 0 0 0 5px rgba(212, 165, 116, 0.3), 0 0 14px rgba(212, 165, 116, 0.18); border-color: rgba(212, 165, 116, 0.9); }
}

.co-field-pulse {
    animation: co-field-pulse 1.8s ease-in-out infinite;
}

/* Pay button hint text */
.co-pay-hint {
    position: absolute;
    bottom: 6px;
    left: 0;
    right: 0;
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
    pointer-events: none;
}

/* VAT lookup status line */
.co-vat-status {
    font-size: 0.85rem;
    margin-top: 0.35rem;
    min-height: 1.2em;
    color: #6b7280;
}
.co-vat-status--loading { color: #6b7280; }
.co-vat-status--error   { color: #dc2626; }
.co-vat-status a.co-vat-retry { color: #dc2626; text-decoration: underline; cursor: pointer; }

/* Company info card shown after successful lookup */
.co-vat-company-card {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}
.co-vat-company-card[hidden] { display: none; }
.co-vat-card-name { font-weight: 600; color: #111827; }
.co-vat-card-addr { color: #374151; }
.co-vat-card-nr   { color: #6b7280; font-size: 0.82rem; margin-top: 0.15rem; }
.co-vat-confirm   {
    margin: 0.6rem 0 0;
    color: #059669;
    font-size: 0.85rem;
}

/* ---- Shipping options ------------------------------------ */

.co-shipping-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.co-shipping-opt {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-md);
    border: 1.5px solid var(--cream-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    user-select: none;
}

.co-shipping-opt:hover {
    border-color: var(--cream-400);
}

.co-shipping-opt.selected {
    border-color: var(--primary);
    background: rgba(51, 132, 138, 0.04);
}

.co-shipping-opt input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.co-shipping-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.co-shipping-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--cream-800);
}

.co-shipping-desc {
    font-size: var(--font-size-xs);
    color: var(--cream-500);
    line-height: 1.4;
}

.co-shipping-estimate {
    font-size: var(--font-size-xs);
    color: var(--cream-500);
    line-height: 1.4;
    margin-top: 1px;
}

.co-shipping-hours-link {
    color: var(--primary, #33848a);
    text-decoration: none;
}

.co-shipping-hours-link:hover {
    text-decoration: underline;
}

.co-shipping-price {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--cream-800);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Order summary --------------------------------------- */

.co-summary-wrap {
    background: var(--warm-white);
    border: 1px solid var(--cream-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

@media (min-width: 769px) {
    /* Sticky is on the grid item (.co-summary-col), not on .co-summary-wrap.
       .co-summary-wrap has overflow:hidden which would prevent sticky on itself. */
    .co-summary-col {
        position: sticky;
        top: calc(var(--navbar-height) + var(--space-lg));
        align-self: start;
    }

    /* Flex column so items can scroll while totals stay pinned at bottom.
       Max-height = viewport minus equal top/bottom breathing room.
       Small carts: box sized to content, no scrolling.
       Large carts: box caps at max-height, item list scrolls. */
    .co-summary-wrap {
        display: flex;
        flex-direction: column;
        max-height: calc(100vh - var(--navbar-height) - 2 * var(--space-lg));
    }
}

.co-summary-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--cream-200);
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--cream-900);
}

.co-summary-items {
    padding: var(--space-sm) var(--space-lg);
    overflow-y: auto;
}

/* ---- Summary item ---------------------------------------- */

.co-summary-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--cream-100);
}

.co-summary-item:last-child {
    border-bottom: none;
}

.co-summary-img {
    width: 50px;
    height: 50px;
    border: 1px solid var(--cream-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
}

.co-summary-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
    box-sizing: border-box;
}

.co-summary-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.co-summary-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--cream-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.co-summary-variant,
.co-summary-qty {
    font-size: var(--font-size-xs);
    color: var(--cream-500);
}

.co-summary-linetotal {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--cream-800);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Totals block ---------------------------------------- */

.co-totals {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--cream-200);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.co-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: var(--font-size-sm);
    color: var(--cream-700);
    gap: var(--space-sm);
}

.co-totals-grand {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--cream-900);
}

.co-totals-divider {
    height: 1px;
    background: var(--cream-200);
    margin: 2px 0;
}

/* Shipping status labels */
.co-ship-tbd {
    color: var(--cream-400);
    font-style: italic;
}

.co-ship-free {
    color: #22c55e;
    font-weight: 600;
}

/* ---- Pay button (desktop, inside summary) ---------------- */

.co-pay-btn {
    display: block;
    width: calc(100% - 2 * var(--space-lg));
    margin: var(--space-md) var(--space-lg) var(--space-lg);
    padding: 14px 24px;
    border-radius: var(--radius-md);
    border: none;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 700;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background var(--transition-fast), opacity var(--transition-fast);
    text-align: center;
}

.co-pay-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.co-pay-btn:disabled {
    background: var(--cream-300);
    color: var(--cream-500);
    cursor: not-allowed;
    opacity: 0.75;
}

/* Hide desktop pay button on mobile */
@media (max-width: 768px) {
    .co-pay-btn {
        display: none;
    }
}

/* ---- Summary — desktop spacing overrides (min-width: 769px) */

@media (min-width: 769px) {
    .co-summary-header {
        padding: 20px var(--space-xl);
        flex-shrink: 0;   /* never compress the header */
    }

    .co-summary-items {
        padding: var(--space-md) var(--space-xl) var(--space-lg);
        /* Natural height by default; shrinks (and scrolls) only when wrap hits max-height */
        flex: 0 1 auto;
        min-height: 0;
    }

    .co-summary-item {
        gap: 14px;
        padding: 14px 0;
    }

    .co-summary-img {
        width: 70px;
        height: 70px;
    }

    .co-summary-title {
        font-size: var(--font-size-sm);
        line-height: 1.4;
        white-space: normal;
    }

    .co-totals {
        padding: var(--space-lg) var(--space-xl);
        gap: 10px;
        flex-shrink: 0;   /* always fully visible, never compressed */
    }

    .co-totals-row {
        font-size: var(--font-size-base);
    }

    .co-totals-grand {
        font-size: var(--font-size-lg);
    }

    .co-pay-btn {
        width: calc(100% - 2 * var(--space-xl));
        margin: var(--space-lg) var(--space-xl) var(--space-xl);
        padding: 16px 24px;
        flex-shrink: 0;   /* always fully visible, never compressed */
    }
}

/* ---- Mobile sticky bar ----------------------------------- */

.co-mobile-bar {
    display: none;
}

@media (max-width: 768px) {
    .co-mobile-bar {
        display: flex;
        align-items: center;
        gap: var(--space-md);
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--warm-white);
        border-top: 1px solid var(--cream-200);
        padding: var(--space-md) var(--space-lg);
        z-index: 200;
        box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08);
    }

    .co-mobile-bar[hidden] {
        display: none;
    }

    .co-mobile-bar-total {
        flex: 1;
        min-width: 0;
    }

    .co-mobile-bar-label {
        font-size: var(--font-size-xs);
        color: var(--cream-500);
    }

    .co-mobile-bar-amount {
        font-size: var(--font-size-lg);
        font-weight: 700;
        color: var(--cream-900);
        white-space: nowrap;
    }

    .co-mobile-pay-btn {
        padding: 12px 20px;
        border-radius: var(--radius-md);
        border: none;
        font-family: var(--font-family);
        font-size: var(--font-size-sm);
        font-weight: 700;
        background: var(--primary);
        color: #fff;
        cursor: pointer;
        white-space: nowrap;
        flex-shrink: 0;
        transition: background var(--transition-fast);
    }

    .co-mobile-pay-btn:hover:not(:disabled) {
        background: var(--primary-dark);
    }

    .co-mobile-pay-btn:disabled {
        background: var(--cream-300);
        color: var(--cream-500);
        cursor: not-allowed;
    }
}

/* ============================================================
   Checkout error banner
   ============================================================ */

.co-error-banner {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius-md);
    color: #b91c1c;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.co-error-banner[hidden] { display: none; }

.co-error-banner strong { font-weight: 700; }

.co-error-banner ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}

/* ============================================================
   Confirmation page  (.conf-*)
   ============================================================ */

.conf-page {
    padding: 3rem 0 5rem;
    min-height: 60vh;
}

.conf-box {
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--cream-200);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
}

/* States */
.conf-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
}

.conf-icon--success { background: #d1fae5; color: #059669; }
.conf-icon--pending { background: #fef9c3; color: #ca8a04; }
.conf-icon--failed  { background: #fee2e2; color: #dc2626; }

.conf-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 0.5rem;
}

.conf-subtitle {
    color: var(--text-muted);
    margin: 0 0 2rem;
}

.conf-order-number {
    display: inline-block;
    background: var(--cream-100);
    border: 1px solid var(--cream-200);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    font-family: monospace;
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 2rem;
}

.conf-note {
    background: var(--cream-50);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: 2rem;
    text-align: left;
}

.conf-note p { margin: 0; }
.conf-note p + p { margin-top: 0.5rem; }

/* Summary inside confirmation */
.conf-summary {
    border-top: 1px solid var(--cream-200);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    text-align: left;
}

.conf-summary-title {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1rem;
}

.conf-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    font-size: var(--font-size-sm);
    padding: 0.35rem 0;
}

.conf-item-name { color: var(--dark); flex: 1; }
.conf-item-qty  { color: var(--text-muted); white-space: nowrap; }
.conf-item-price { font-weight: 600; white-space: nowrap; }

.conf-totals {
    border-top: 1px solid var(--cream-200);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

.conf-total-row {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-sm);
    padding: 0.25rem 0;
    color: var(--text-muted);
}

.conf-total-row--grand {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--dark);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--cream-200);
}

.conf-actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

/* Spinner in pending state */
.conf-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--cream-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes conf-spin {
    to { transform: rotate(360deg); }
}

.conf-spinner { animation: conf-spin 0.8s linear infinite; }

@media (max-width: 768px) {
    .conf-box {
        padding: 1.75rem 1.25rem;
    }

    .conf-title {
        font-size: var(--font-size-xl);
    }
}

/* ============================================================
   Phase 3 — Real-time stock checks
   ============================================================ */

/* ---- Checkout: stock warning banner ----------------------- */
.co-stock-banner {
    background: #fffbeb;
    border: 1px solid #f5c842;
    border-radius: var(--radius-md, 8px);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: var(--font-size-sm);
    color: #7a5c00;
    line-height: 1.5;
}
.co-stock-banner strong { color: #5a4000; }
.co-stock-banner ul { margin: 6px 0 0 18px; padding: 0; }
.co-stock-banner li { margin-bottom: 2px; }

/* ---- Checkout: remove button on each summary item --------- */
.co-summary-remove {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--cream-400);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
    padding: 0;
}
.co-summary-remove:hover {
    color: #ef4444;
    background: #fef2f2;
}
.co-summary-remove:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ---- Checkout: faded unavailable summary item ------------- */
.co-summary-item--unavailable {
    opacity: 0.45;
    position: relative;
}
.co-summary-item--unavailable .co-summary-title::after {
    content: ' — niet meer op voorraad';
    font-size: 11px;
    font-weight: 600;
    color: #dc2626;
}
/* Keep the remove button fully visible even on faded unavailable items */
.co-summary-item--unavailable .co-summary-remove {
    opacity: 1;
}

/* ---- Shop grid: unavailable badge on card image ----------- */
.product-card-img-wrap { position: relative; }

.product-card-unavailable-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 2;
    line-height: 1.4;
}

/* ---- Product detail: unavailable button state ------------- */
.product-btn-cart.is-unavailable {
    background: var(--cream-300, #d1c7b8);
    color: var(--cream-600, #78716c);
    cursor: not-allowed;
    pointer-events: none;
}
/* Revert the shop.css mobile fix that was added to the wrong file */
