/* Preorder badge — joins Minimog's native .product-badges stack.
   Shape, size, padding, position and stacking are all inherited from the
   theme (driven by the `shop_badges_style` option); only the badge colour
   is defined here. #0f172a keeps it consistent with the child-theme palette. */
.product-badges .preorder {
    --p-badge-bg: #0f172a;
    --p-badge-text: #fff;
}

/* Preorder availability notice. */
.preorder-info-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    border-radius: 8px;
    margin: 8px 0;
    color: #475569;
    font-size: 14px;
    line-height: 1.5;
}

.preorder-info-banner::before {
    content: "";
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E") no-repeat center / contain;
}

.preorder-info-banner strong {
    color: #0f172a;
    font-weight: 600;
}

/* The Better Loyalty points box renders directly above this banner (both hook
   woocommerce_single_product_summary at priority 15). Its <p> carries a default
   bottom margin that opens a large gap — collapse it so the two sit close.
   Simple products output the <p> directly; variable products wrap it in a div.
   Scoped with :has() so the loyalty box is unaffected on non-preorder products. */
.better-loyalty-product-points:has( + .preorder-info-banner ),
.better-loyalty-product-points-wrapper:has( + .preorder-info-banner ) .better-loyalty-product-points {
    margin-bottom: 0 !important;
}

.preorder-checkout-options {
    background: transparent;
    border: 1px solid #e2e8f0;
    padding: 0;
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
}

.preorder-checkout-options h3 {
    margin: 0 !important;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    padding: 16px 20px 0 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.preorder-notice-highlight {
    background: #fefce8;
    border-left: 4px solid #facc15;
    color: #854d0e;
    margin: 12px 20px 20px 20px !important;
    padding: 10px 15px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
}

.preorder-checkout-options label {
    display: flex !important;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #334155;
    margin: 0 !important;
}

.preorder-checkout-options label:hover {
    background: #f8fafc;
}

.preorder-checkout-options input[type="radio"] {
    margin: 0 12px 0 0 !important;
    width: 16px;
    height: 16px;
}

/* ===== [preorder_products] grid + AJAX pagination ===== */

.preorder-products-wrapper {
    position: relative;
    min-height: 120px;
}

/* Loading state — dim the grid behind a light veil and show a spinner. */
.preorder-products-wrapper.preorder-loading {
    pointer-events: none;
}

.preorder-products-wrapper.preorder-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    z-index: 2;
}

.preorder-products-wrapper.preorder-loading::after {
    content: "";
    position: absolute;
    top: 60px;
    left: 50%;
    width: 34px;
    height: 34px;
    margin-left: -17px;
    border: 3px solid #e2e8f0;
    border-top-color: #0f172a;
    border-radius: 50%;
    animation: preorder-spin 0.7s linear infinite;
    z-index: 3;
}

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

/* Numbered pagination — self-contained styling in the preorder palette so it
   looks correct even where the theme does not style .woocommerce-pagination. */
.preorder-pagination {
    margin-top: 32px;
    text-align: center;
}

.preorder-pagination ul.page-numbers {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    border: 0;
}

.preorder-pagination ul.page-numbers li {
    margin: 0;
    list-style: none;
}

.preorder-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.preorder-pagination a.page-numbers:hover {
    border-color: #0f172a;
    color: #0f172a;
}

.preorder-pagination .page-numbers.current {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

.preorder-pagination .page-numbers.dots {
    border-color: transparent;
    background: transparent;
}

/* ===== [preorder_products] promo banner ===== */

.preorder-banner {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(28px, 5vw, 60px);
    overflow: hidden;
    min-height: 400px;
    padding: clamp(32px, 6vw, 64px);
    margin-bottom: 32px;
    border-radius: 14px;
    background: #F6F6F6;
    color: #0f172a;
}

.preorder-banner--no-slider {
    min-height: 0;
    padding: clamp(24px, 4vw, 40px);
}

/* --- Left: incentive copy --- */
.preorder-banner-content {
    flex: 1 1 50%;
    min-width: 0;
}

.preorder-banner--no-slider .preorder-banner-content {
    flex-basis: 100%;
}

.preorder-banner-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #64748b;
}

.preorder-banner-eyebrow svg {
    width: 15px;
    height: 15px;
}

.preorder-banner-headline {
    font-size: clamp(26px, 3.2vw, 40px);
    font-weight: 800;
    line-height: 1.14;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.preorder-banner-subtext {
    max-width: 44ch;
    margin: 16px 0 0;
    font-size: 15px;
    line-height: 1.6;
    color: #475569;
}

/* Discount percentage — highlighted with a dark theme to match the new light banner. */
.preorder-banner-accent {
    display: inline-block;
    padding: 0 9px;
    border-radius: 6px;
    background: #0f172a;
    color: #fff;
}

/* --- Right: product slider --- */
.preorder-banner-slider {
    display: flex;
    flex: 0 1 42%;
    min-width: 320px;
    flex-direction: column;
    gap: 16px;
}

.preorder-slider-viewport {
    position: relative;
    overflow: hidden;
}

.preorder-slider-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.preorder-slide {
    box-sizing: border-box;
    flex: 0 0 100%;
    padding: 0 8px;
    text-decoration: none;
}

.preorder-slide-card {
    display: flex;
    align-items: center;
    gap: clamp(20px, 3vw, 32px);
    padding: clamp(24px, 2.5vw, 36px);
    border-radius: 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.preorder-slide:hover .preorder-slide-card {
    transform: translateY(-2px);
}

.preorder-slide-media {
    flex: 0 0 auto;
    width: clamp(100px, 12vw, 140px);
    height: clamp(100px, 12vw, 140px);
    overflow: hidden;
    border-radius: 12px;
    background: #f1f5f9;
}

.preorder-slide-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preorder-slide-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.preorder-slide-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: #0f172a;
}

.preorder-slide-price {
    font-size: 16px;
    color: #475569;
}

.preorder-slide-price ins {
    text-decoration: none;
    font-weight: 700;
    color: #0f172a;
}

.preorder-slide-price del {
    margin-right: 6px;
    color: #94a3b8;
}

.preorder-slide-cta {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.preorder-slide-cta::after {
    content: " \2192";
}

/* --- Slider dots --- */
.preorder-slider-dots {
    display: flex;
    gap: 8px;
    padding-left: 8px;
    margin-top: 4px;
}

.preorder-slider-dot {
    width: 6px;
    height: 6px;
    padding: 0;
    margin: 0;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.15);
    cursor: pointer;
    transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
    -webkit-appearance: none;
}

.preorder-slider-dot:hover,
.preorder-slider-dot:focus,
.preorder-slider-dot:active {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: rgba(15, 23, 42, 0.3);
}

.preorder-slider-dot.is-active {
    width: 20px;
    border-radius: 4px;
    background: #0f172a;
}

@media (prefers-reduced-motion: reduce) {
    .preorder-slider-track {
        transition: none;
    }
}

@media (max-width: 860px) {
    .preorder-banner {
        flex-direction: column;
        align-items: stretch;
        min-height: 0;
        gap: 32px;
        padding: 32px 24px;
    }

    .preorder-banner-content,
    .preorder-banner-slider {
        flex: 1 1 auto;
        min-width: 0;
    }

    .preorder-slider-dots {
        justify-content: center;
        padding-left: 0;
    }
}

@media (max-width: 480px) {
    .preorder-banner {
        padding: 24px 16px;
        gap: 24px;
    }

    .preorder-banner-headline {
        font-size: 24px;
    }

    .preorder-slide-card {
        padding: 16px;
        gap: 14px;
    }

    .preorder-slide-media {
        width: 80px;
        height: 80px;
    }

    .preorder-slide-name {
        font-size: 15px;
    }
}

/* Empty state — shown when there are no visible preorder products. */
.preorder-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 48px 24px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.preorder-empty-icon {
    margin-bottom: 4px;
    color: #cbd5e1;
}

.preorder-empty-icon svg {
    width: 40px;
    height: 40px;
}

.preorder-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.preorder-empty-text {
    max-width: 380px;
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}
