/* ============================================================
   Clubband Products v2
   Styles for [clubband-products] and [clubband-product]
   ============================================================ */

/* ---- Tabs ---- */
.clubband-products-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #000;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.clubband-products-tab {
    padding: 12px 28px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-family: "Bebas Neue", sans-serif;
    font-size: 18px;
    letter-spacing: 1px;
    cursor: pointer;
    color: #888;
    transition: color 0.2s ease, border-color 0.2s ease;
    text-transform: uppercase;
}

.clubband-products-tab:hover {
    color: #000;
}

.clubband-products-tab-active {
    color: #000;
    border-bottom-color: #000;
}

/* ---- Loading ---- */
.clubband-products-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 14px;
}

.clubband-products-loading p {
    font-family: "Montserrat", sans-serif;
    font-size: 14px;
    color: #888;
    margin: 0;
}

.clubband-products-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #eee;
    border-top-color: #000;
    border-radius: 50%;
    animation: cbv2Spin 0.75s linear infinite;
}

@keyframes cbv2Spin {
    to { transform: rotate(360deg); }
}

/* ---- Error ---- */
.clubband-products-error {
    padding: 24px;
    text-align: center;
    color: #888;
    font-family: "Montserrat", sans-serif;
    font-size: 14px;
}

/* ---- Empty message ---- */
.clubband-products-empty {
    text-align: center;
    padding: 32px;
    color: #888;
    font-size: 14px;
    font-family: "Montserrat", sans-serif;
    grid-column: 1 / -1; /* spans all grid columns */
}

/* ==============================================================
   GRID MODE
   ============================================================== */

.clubband-products-mode-grid .clubband-products-cards {
    display: grid;
    grid-template-columns: repeat( var(--cb-products-columns, 3), 1fr );
    gap: 24px;
}

@media (max-width: 1024px) {
    .clubband-products-mode-grid .clubband-products-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .clubband-products-mode-grid .clubband-products-cards {
        grid-template-columns: 1fr;
    }
}

/* ==============================================================
   SLIDER MODE
   ============================================================== */

.clubband-products-mode-slider .clubband-products-slider-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.clubband-products-mode-slider .clubband-slider-track {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;       /* Firefox */
    flex: 1;
    padding-bottom: 4px;        /* Prevent clip on box-shadow */
}

.clubband-products-mode-slider .clubband-slider-track::-webkit-scrollbar {
    display: none;              /* Webkit */
}

/* Each card snaps to start.
   --cb-gap-total is set by PHP in the wrapper's inline style (safe, pre-calculated).
   Formula: (100% − total-gap-px) ÷ columns  — plain division, works in all browsers. */
.clubband-products-mode-slider .clubband-slider-track .clubband-products-card {
    scroll-snap-align: start;
    flex: 0 0 auto;
    width: calc( (100% - var(--cb-gap-total, 48px)) / var(--cb-products-columns, 3) );
    min-width: 220px;
    max-width: 480px;
    box-sizing: border-box;
}

/* Slider navigation buttons */
.clubband-slider-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: #000;
    color: #fff;
    border: none;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    font-family: "Bebas Neue", sans-serif;
    user-select: none;
}

.clubband-slider-btn:hover {
    background: #333;
}

.clubband-slider-prev {
    margin-right: 12px;
}

.clubband-slider-next {
    margin-left: 12px;
}

/* Arrow disabled state – set by JS when at start/end or no overflow */
.clubband-slider-btn:disabled,
.clubband-slider-btn[disabled] {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

/* Hide both arrows when slider has no overflow at all */
.clubband-products-no-overflow .clubband-slider-btn {
    display: none;
}

/* ==============================================================
   PRODUCT CARD  (shared between grid and slider)
   ============================================================== */

.clubband-products-card {
    background: #fff;
    border: 1px solid #000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.clubband-products-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
    transform: translateY(-3px);
}

/* --- Card Media (image or video) --- */
.clubband-products-card-media {
    width: 100%;
    overflow: hidden;
    background: #f2f2f2;
    aspect-ratio: 16 / 9;
}

.clubband-products-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.clubband-products-card:hover .clubband-products-card-media img,
.clubband-products-card:hover .clubband-products-card-media video {
    transform: scale(1.04);
}

/* Base video styling */
.clubband-product-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
    background: #000;
}

/* --- Inner Slider --- */
.clubband-inner-slider-wrapper {
    position: relative;
    display: flex; /* keep context for absolute children */
}

.clubband-inner-slider-track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.clubband-inner-slider-track::-webkit-scrollbar {
    display: none;
}

.clubband-inner-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    scroll-snap-align: start;
}

.clubband-inner-slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.8);
    color: #000;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.2s ease, opacity 0.2s ease;
    opacity: 0; /* Hide by default, show on hover */
}

.clubband-products-card:hover .clubband-inner-slider-btn {
    opacity: 1;
}

.clubband-inner-slider-btn:hover {
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.clubband-inner-prev {
    left: 8px;
}

.clubband-inner-next {
    right: 8px;
}

/* Video embed wrapper */
.clubband-products-card-media--video {
    aspect-ratio: 16 / 9;
}

.clubband-products-card-video-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;  /* 16:9 intrinsic ratio */
}

.clubband-products-card-video-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Card Body --- */
.clubband-products-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px;
    gap: 10px;
}

.clubband-products-card-name {
    font-family: "Bebas Neue", sans-serif;
    font-size: 22px;
    font-weight: 400;
    letter-spacing: 1px;
    color: #000;
    margin: 0;
    line-height: 1.2;
}

.clubband-products-card-desc {
    font-family: "Montserrat", sans-serif;
    font-size: 14px;
    color: #555;
    line-height: 1.65;
    margin: 0;
    flex: 1;
}

/* --- Card Footer --- */
.clubband-products-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

.clubband-products-card-price {
    font-family: "Bebas Neue", sans-serif;
    font-size: 28px;
    font-weight: 400;
    letter-spacing: 1px;
    color: #000;
    white-space: nowrap;
}

.clubband-products-card-footer .clubband-add-btn {
    flex: 1;
    min-width: 90px;
    padding: 12px 16px;
    font-size: 16px;
}

/* ==============================================================
   SINGLE PRODUCT  [clubband-product]
   ============================================================== */

.clubband-product-single {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-family: "Montserrat", sans-serif;
}

.clubband-product-single-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}

.clubband-product-single-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.clubband-product-single-price {
    font-family: "Bebas Neue", sans-serif;
    font-size: 32px;
    font-weight: 400;
    letter-spacing: 1px;
    color: #000;
    white-space: nowrap;
    line-height: 1;
}

/* Override add-btn sizing for inline context */
.clubband-product-single-btn.clubband-add-btn {
    width: auto !important;
    display: inline-flex !important;
    padding: 14px 28px !important;
    font-size: 18px !important;
}

.clubband-product-single-error p {
    color: #aaa;
    font-size: 13px;
    margin: 0;
    font-family: "Montserrat", sans-serif;
}

/* ==============================================================
   RICH PACKAGE CARD THEME
   CRM descriptions provide only the short .cb-package-* markup.
   ============================================================== */

.clubband-products-wrapper {
    --cb-package-olive: #41413e;
    --cb-package-olive-soft: #d8d8d4;
    --cb-package-charcoal: #242421;
    --cb-package-cream: #f7f7f5;
}

.clubband-products-wrapper .clubband-products-card {
    background: #fff;
    border: 1px solid #111;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(25, 25, 20, 0.06);
}

.clubband-products-wrapper .clubband-products-card:hover {
    box-shadow: 0 12px 32px rgba(25, 25, 20, 0.11);
    transform: translateY(-3px);
}

.clubband-products-wrapper .clubband-products-card-media {
    border-radius: 15px 15px 0 0;
}

.clubband-products-wrapper .clubband-products-card-body {
    padding: 20px 22px;
    gap: 12px;
}

.clubband-products-wrapper .clubband-products-card-name {
    font-family: "Montserrat", sans-serif;
    font-size: 25px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    color: var(--cb-package-charcoal);
    text-align: center;
    text-transform: none;
}

.clubband-products-wrapper .clubband-products-card-desc {
    color: #5e5c57;
    font-family: "Montserrat", sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
}

.cb-package-features,
.cbf {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin-bottom: 10px;
}

.cb-package-feature,
.cbi {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border: 1px solid var(--cb-package-olive-soft);
    border-radius: 7px;
    background: #fdfcf8;
    color: var(--cb-package-charcoal);
    font-size: 11px;
    font-style: normal;
    font-weight: 500;
    line-height: 1.1;
    white-space: nowrap;
}

.cb-package-copy,
.cbc {
    display: block;
    text-align: left;
}

.clubband-products-wrapper .clubband-products-card-desc .cbc > strong {
    display: block;
    margin-bottom: 8px;
    color: var(--cb-package-olive);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.2;
    text-transform: uppercase;
}

.cb-package-popular,
.cbp {
    display: block;
    width: max-content;
    margin: -4px auto 12px;
    padding: 6px 11px;
    border-radius: 6px;
    background: var(--cb-package-olive);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
}

.clubband-products-wrapper .clubband-products-card-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 16px;
    padding-top: 4px;
    border-top: 0;
}

.clubband-products-wrapper .clubband-products-card-price {
    display: block;
    font-family: "Montserrat", sans-serif;
    font-size: 30px;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -1px;
    color: var(--cb-package-charcoal);
    text-align: left;
}

.clubband-products-wrapper .clubband-products-card-price::before {
    content: none;
    display: none;
}

.clubband-products-wrapper .clubband-products-card-footer .clubband-add-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 158px;
    min-height: 46px;
    padding: 11px 18px;
    border-radius: 999px;
    background: var(--cb-package-charcoal);
    border-color: var(--cb-package-charcoal);
    font-family: "Montserrat", sans-serif;
    font-size: 0;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.clubband-products-wrapper .clubband-products-card-footer .clubband-add-btn::after {
    content: "Add to quote";
    font-size: 14px;
}

.clubband-products-wrapper .clubband-products-card-footer .clubband-add-btn .clubband-btn-icon {
    font-family: "Montserrat", sans-serif;
    font-size: 15px;
}

.clubband-products-wrapper .clubband-products-card-footer .clubband-add-btn.clubband-added {
    background: var(--cb-package-cream);
    border-color: var(--cb-package-olive);
    color: var(--cb-package-olive);
}

.clubband-products-wrapper .clubband-products-card-footer .clubband-add-btn.clubband-added::after {
    content: "Added";
}

.clubband-products-wrapper .clubband-slider-btn {
    background: var(--cb-package-charcoal);
    border-radius: 10px;
}

.clubband-products-wrapper .clubband-slider-btn:hover {
    background: var(--cb-package-olive);
}

@media (max-width: 600px) {
    .clubband-products-wrapper .clubband-products-card-body {
        padding: 16px;
    }

    .clubband-products-wrapper .clubband-products-card-name {
        font-size: 23px;
    }

    .clubband-products-wrapper .clubband-products-card-footer {
        gap: 10px;
    }

    .clubband-products-wrapper .clubband-products-card-price {
        font-size: 28px;
    }

    .clubband-products-wrapper .clubband-products-card-footer .clubband-add-btn {
        min-width: 104px;
        padding-inline: 16px;
    }

    .clubband-products-wrapper .clubband-products-card-footer .clubband-add-btn::after {
        content: "Add";
    }

    .clubband-products-wrapper .clubband-products-card-footer .clubband-add-btn.clubband-added::after {
        content: "Added";
    }
}

/* Slider cards keep a comfortable, predictable width at each breakpoint. */
@media (max-width: 900px) {
    .clubband-products-mode-slider .clubband-slider-track .clubband-products-card {
        width: calc((100% - 24px) / 2);
        max-width: none;
    }
}

@media (max-width: 600px) {
    .clubband-products-mode-slider .clubband-slider-track .clubband-products-card {
        width: 100%;
        min-width: 100%;
        max-width: none;
    }

    .clubband-products-mode-slider .clubband-slider-track {
        gap: 14px;
    }

    .clubband-products-wrapper .clubband-slider-btn {
        width: 36px;
        height: 44px;
    }

    .clubband-products-wrapper .clubband-slider-prev {
        margin-right: 6px;
    }

    .clubband-products-wrapper .clubband-slider-next {
        margin-left: 6px;
    }
}
