/* ========================================================
   Kafela Product Configurator – Styles
   Inspired by handdn.com bespoke watch strap configurator
   ======================================================== */

/* ═══════════════════════════════════════
   CONFIGURATOR LAYOUT OVERRIDE
   Move title + excerpt to gallery column
   (only when configurator is active)
   ═══════════════════════════════════════ */

/* Info block rendered under gallery images in the left column. */
.kafela-cfg-gallery-info {
    margin-top: 20px;
    padding: 0 5px;
}

.kafela-cfg-gallery-info .product-title {
    font-size: 22px;
    font-weight: 700;
    color: #1d2327;
    margin-bottom: 8px;
}

.kafela-cfg-gallery-info .price {
    font-size: 18px;
    margin-bottom: 12px;
}

.kafela-cfg-gallery-info .woocommerce-product-details__short-description {
    font-size: 14px;
    line-height: 1.6;
    color: #444;
}

/* Hide the originals in the right summary column when configurator is active.
   We duplicate title, price + excerpt into the gallery column instead. */
.has-kafela-configurator .product-info .product-title.product_title,
.has-kafela-configurator .product-info .price-wrapper,
.has-kafela-configurator .product-info p.price,
.has-kafela-configurator .product-info .woocommerce-product-details__short-description,
.has-kafela-configurator .product-info .product-short-description,
.has-kafela-configurator .product-info .star-rating-container,
.has-kafela-configurator .product-info .is-divider,
.has-kafela-configurator .product-info .woocommerce-breadcrumb,
.has-kafela-configurator .product-info .list-check-fa,
.has-kafela-configurator .product-info .stock {
    display: none !important;
}

/* ─── Wrapper ─── */
.kafela-configurator-wrap {
    padding: 0 0 20px;
    margin: 0 0 15px;
}

.kafela-cfg-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color, #6f1236);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color, #6f1236);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Individual Field Block ─── */
.kafela-cfg-field {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eee;
}

.kafela-cfg-field:last-of-type {
    border-bottom: none;
}

/* Hidden by conditional logic */
.kafela-cfg-field.kafela-cfg-hidden {
    display: none;
}

/* ─── Labels ─── */
.kafela-cfg-label {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.kafela-cfg-required {
    color: #e74c3c;
    margin-left: 3px;
}

.kafela-cfg-desc {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px;
    line-height: 1.5;
}

.kafela-cfg-desc a {
    color: var(--primary-color, #1a1a2e);
    text-decoration: underline;
}

/* ═══════════════════════════════════════
   IMAGE SWATCHES  –  handdn.com style
   Large rectangular cards with zoom icon
   ═══════════════════════════════════════ */
.kafela-cfg-swatches--image {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.kafela-cfg-swatches--image::-webkit-scrollbar {
    height: 5px;
}

.kafela-cfg-swatches--image::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.kafela-cfg-swatches--image .kafela-cfg-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    flex: 0 0 auto;
    width: 200px;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
    scroll-snap-align: start;
}

.kafela-cfg-swatches--image .kafela-cfg-swatch input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* ── Swatch visual card ── */
.kafela-cfg-swatch-visual {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 4px;
    border: 2px solid #d0d0d0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    transition: all 0.25s ease;
    margin-bottom: 8px;
    position: relative;
}

.kafela-cfg-swatch-visual img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.kafela-cfg-swatch-placeholder {
    font-size: 28px;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── Zoom icon (top-left badge) ── */
.kafela-cfg-zoom-icon {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 30px;
    height: 30px;
    background: #1a1a2e;
    color: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 2;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.85;
    line-height: 1;
}

.kafela-cfg-zoom-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.kafela-cfg-zoom-icon svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* ── Selected state  ── */
.kafela-cfg-swatch input[type="radio"]:checked~.kafela-cfg-swatch-visual {
    border-color: #1a1a2e;
    border-width: 3px;
    box-shadow: none;
}

.kafela-cfg-swatch:hover .kafela-cfg-swatch-visual {
    border-color: #1a1a2e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ── Label below card ── */
.kafela-cfg-swatch-label {
    font-size: 13px;
    color: #333;
    line-height: 1.35;
    word-break: break-word;
    font-weight: 400;
}

.kafela-cfg-swatch input[type="radio"]:checked~.kafela-cfg-swatch-label {
    color: #1a1a2e;
    font-weight: 700;
}

.kafela-cfg-swatch-price {
    font-size: 11px;
    color: #e74c3c;
    font-weight: 600;
    margin-top: 2px;
}

/* ═══════════════════════════════════════
   COMPACT IMAGE SWATCHES
   Smaller square thumbnails (for Tip Shape, etc.)
   ═══════════════════════════════════════ */
.kafela-cfg-swatches--compact {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 12px;
}

.kafela-cfg-swatches--compact .kafela-cfg-swatch {
    width: 90px;
}

.kafela-cfg-swatches--compact .kafela-cfg-swatch-visual {
    aspect-ratio: 1 / 1;
    border-radius: 8px;
}

.kafela-cfg-swatches--compact .kafela-cfg-swatch-visual img {
    object-fit: cover;
    padding: 4px;
}

.kafela-cfg-swatches--compact .kafela-cfg-swatch-placeholder {
    font-size: 18px;
}

.kafela-cfg-swatches--compact .kafela-cfg-swatch-label {
    font-size: 11px;
}

/* ═══════════════════════════════════════
   IMAGE LIGHTBOX / POPUP
   ═══════════════════════════════════════ */
.kafela-cfg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.kafela-cfg-lightbox.kafela-cfg-lightbox--open {
    opacity: 1;
    visibility: visible;
}

.kafela-cfg-lightbox-inner {
    position: relative;
    max-width: 80vw;
    max-height: 85vh;
    text-align: center;
}

.kafela-cfg-lightbox-inner img {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.kafela-cfg-lightbox-caption {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin-top: 14px;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    background: rgba(26, 26, 46, 0.85);
    display: inline-block;
    padding: 8px 24px;
    border-radius: 4px;
}

.kafela-cfg-lightbox-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 36px;
    height: 36px;
    background: #fff;
    color: #1a1a2e;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
    line-height: 1;
}

.kafela-cfg-lightbox-close:hover {
    transform: scale(1.1);
}

/* ── Lightbox nav arrows ── */
.kafela-cfg-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    color: #1a1a2e;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    line-height: 1;
}

.kafela-cfg-lightbox-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.kafela-cfg-lightbox-prev {
    left: -60px;
}

.kafela-cfg-lightbox-next {
    right: -60px;
}


/* ═══════════════════════════════════════
   COLOR SWATCHES
   ═══════════════════════════════════════ */
.kafela-cfg-swatches--color {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.kafela-cfg-swatches--color .kafela-cfg-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    width: 60px;
    text-align: center;
    position: relative;
}

.kafela-cfg-swatches--color .kafela-cfg-swatch input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.kafela-cfg-color-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid #e0e0e0;
    transition: all 0.2s ease;
    margin-bottom: 5px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.kafela-cfg-swatch--color input[type="radio"]:checked~.kafela-cfg-color-circle {
    border-color: #1a1a2e;
    box-shadow: 0 0 0 3px #1a1a2e, inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.kafela-cfg-swatch--color:hover .kafela-cfg-color-circle {
    transform: scale(1.08);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.kafela-cfg-swatches--color .kafela-cfg-swatch-label {
    font-size: 10px;
    color: #666;
    line-height: 1.2;
}

.kafela-cfg-swatch--color input[type="radio"]:checked~.kafela-cfg-swatch-label {
    color: #1a1a2e;
    font-weight: 700;
}

/* ═══════════════════════════════════════
   DROPDOWN / SELECT
   ═══════════════════════════════════════ */
.kafela-cfg-select {
    width: 100%;
    height: fit-content;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.kafela-cfg-select:focus {
    outline: none;
    border-color: var(--primary-color, #1a1a2e);
    box-shadow: 0 0 0 2px rgba(111, 18, 54, 0.15);
}

/* ═══════════════════════════════════════
   TEXT INPUT
   ═══════════════════════════════════════ */
.kafela-cfg-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    transition: border-color 0.2s;
}

.kafela-cfg-input:focus {
    outline: none;
    border-color: var(--primary-color, #1a1a2e);
    box-shadow: 0 0 0 2px rgba(111, 18, 54, 0.15);
}

/* ═══════════════════════════════════════
   TEXTAREA
   ═══════════════════════════════════════ */
.kafela-cfg-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    resize: vertical;
    min-height: 70px;
    transition: border-color 0.2s;
}

.kafela-cfg-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #1a1a2e);
    box-shadow: 0 0 0 2px rgba(111, 18, 54, 0.15);
}

/* ═══════════════════════════════════════
   FILE UPLOAD
   ═══════════════════════════════════════ */
.kafela-cfg-file {
    width: 100%;
    padding: 10px;
    font-size: 13px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s;
}

.kafela-cfg-file:hover {
    border-color: var(--primary-color, #1a1a2e);
}

/* ═══════════════════════════════════════
   DYNAMIC PRICE DISPLAY
   ═══════════════════════════════════════ */
.kafela-cfg-price-display {
    margin-top: 20px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f8f1f4, #fdf6f9);
    border-radius: 10px;
    border: 1px solid #e8d5dd;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kafela-cfg-price-label {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.kafela-cfg-price-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color, #6f1236);
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 600px) {
    .kafela-cfg-swatches--image .kafela-cfg-swatch {
        width: 160px;
    }

    .kafela-cfg-swatches--color .kafela-cfg-swatch {
        width: 50px;
    }

    .kafela-cfg-color-circle {
        width: 36px;
        height: 36px;
    }

    .kafela-cfg-price-value {
        font-size: 18px;
    }

    .kafela-cfg-lightbox-prev {
        left: 10px;
    }

    .kafela-cfg-lightbox-next {
        right: 10px;
    }

    .kafela-cfg-lightbox-inner {
        max-width: 92vw;
    }
}