/* ─── Zaun Konfigurator – Styles using ACSS variables ─────────────────── */
/* Depends on Automatic CSS (automatic.css) being loaded by Bricks Builder */

/* ─── Main Layout ─────────────────────────────────────────────────────── */
.zk-main-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-l);
    align-items: start;
}

@media (max-width: 992px) {
    .zk-main-layout {
        grid-template-columns: 1fr;
    }
}

/* ─── Progress Bar ────────────────────────────────────────────────────── */
.zk-progress {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-m);
}
.zk-dot-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    color: var(--neutral-semi-light, #a6a6a6);
}
.zk-dot-wrap.active {
    color: var(--primary);
    font-weight: 600;
}
.zk-dot-wrap.done {
    color: var(--success);
}
.zk-dot {
    width: 5rem;
    height: 5rem;
    border-radius: var(--radius-50);
    border: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    background: var(--white);
    flex-shrink: 0;
    transition: all var(--transition-duration, 0.3s)
        var(--transition-timing, ease-in-out);
}
.zk-dot-wrap.active .zk-dot {
    border-color: var(--primary);
    background: var(--primary-ultra-light);
    color: var(--primary);
}
.zk-dot-wrap.done .zk-dot {
    border-color: var(--success);
    background: var(--success-ultra-light, #eafaee);
    color: var(--success);
}
.zk-line {
    height: 1.5px;
    flex: 1;
    background: var(--neutral-light, #d9d9d9);
    margin: 0 6px;
    transition: background var(--transition-duration, 0.3s)
        var(--transition-timing, ease-in-out);
}
.zk-line.done {
    background: var(--success);
}
.zk-step-label {
    color: var(--neutral-semi-light, #a6a6a6);
    margin-left: 10px;
    white-space: nowrap;
}

/* ─── Panels ──────────────────────────────────────────────────────────── */
.zk-panel {
    background: var(--white);
    box-shadow: var(--box-shadow-l);
    border-radius: var(--radius-s, 10px);
    padding: var(--space-xs, 1.896rem) var(--space-s, 2.133rem);
    margin-bottom: var(--space-xs, 1.896rem);
}
.zk-panel-title {
    font-size: var(--text-xs);
    font-weight: var(--heading-font-weight, 700);
    text-transform: uppercase;
    color: var(--secondary);
    margin-bottom: var(--space-xs, 1.896rem);
}

/* ─── Tiles ───────────────────────────────────────────────────────────── */
.tile-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--content-gap, var(--space-m));
}
.tile {
    padding: var(--btn-padding-block) var(--btn-padding-inline);
    border-radius: var(--radius-s, 10px);
    border: var(--border, 1px solid rgba(0, 0, 0, 0.2));
    font-size: var(--text-s);
    cursor: pointer;
    background: var(--white);
    color: var(--text-color, var(--text-dark));
    transition: var(--transition);
    user-select: none;
}
.tile:hover {
    border-color: var(--primary);
}
.tile.selected {
    border-color: var(--primary);
    background: var(--primary-ultra-light);
    color: var(--primary-semi-dark, #3e6b74);
    font-weight: 600;
}
.tile.unavail {
    opacity: 0.3;
    pointer-events: none;
    text-decoration: line-through;
}

/* ─── Color Tiles ─────────────────────────────────────────────────────── */
.color-tile {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-s, 10px);
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: border-color var(--transition-duration, 0.3s)
        var(--transition-timing, ease-in-out);
    position: relative;
    overflow: hidden;
}
.color-tile.selected {
    border-color: var(--primary);
}
.color-tile.unavail {
    opacity: 0.3;
    pointer-events: none;
}
.color-tile .ct-x {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: rgba(0, 0, 0, 0.5);
}

/* ─── Quantity Controls ───────────────────────────────────────────────── */
.qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 0;
}
.qty-label {
    font-size: var(--text-s);
    color: var(--text-color, var(--text-dark));
}
.qty-sub {
    font-size: var(--text-xs);
    color: var(--neutral-semi-light, #a6a6a6);
    margin-top: 2px;
}
.qty-ctrl {
    display: flex;
    align-items: center;
    gap: 10px;
}
.qty-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-50, 50%);
    border: var(--border, 1px solid rgba(0, 0, 0, 0.2));
    background: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: var(--secondary, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-duration, 0.3s)
        var(--transition-timing, ease-in-out);
}
.qty-btn:hover {
    background: var(--neutral-ultra-light, #f2f2f2);
}
.qty-num {
    font-size: var(--text-s);
    font-weight: 600;
    min-width: 26px;
    text-align: center;
}
.qty-auto {
    font-size: var(--text-s);
    font-weight: 600;
    min-width: 26px;
    text-align: center;
    color: var(--neutral-semi-light, #a6a6a6);
}
.zk-divider {
    height: var(--divider-size, 1px);
    background: var(--neutral-ultra-light, #f2f2f2);
    margin: 2px 0;
}

/* ─── Length Input ────────────────────────────────────────────────────── */
.len-input {
    width: 88px;
    padding: var(--btn-padding-block) var(--btn-padding-inline);
    font-size: var(--text-s);
    font-weight: 600;
    border: var(--border, 1px solid rgba(0, 0, 0, 0.2));
    border-radius: var(--radius-s, 10px);
    text-align: center;
    background: var(--white);
    color: var(--text-color, var(--text-dark));
}
.len-input:focus {
    outline: none;
    border-color: var(--primary);
}
.len-unit {
    font-size: var(--text-s);
    color: var(--secondary-semi-light, #a6a6a6);
}

/* ─── Summary / Done ──────────────────────────────────────────────────── */
.zk-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-radius: var(--radius-s);
    overflow: hidden;
    margin-bottom: var(--space-m);
}

.zk-summary-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-m);
    background: var(--neutral-ultra-light, #fbfbfb);
    border-right: 1px solid var(--primary-ultra-light);
    border-bottom: 1px solid var(--primary-ultra-light);
}

.zk-summary-card:nth-child(even) {
    border-right: none;
}

/* Remove bottom border for the last two cards if even number, but simple way is fine */
.zk-summary-card:nth-last-child(-n + 2) {
    /* This works only roughly, overflow hidden on grid handles outer edges */
}

.zk-summary-card__title {
    color: var(--primary);
    font-weight: 700;
    font-size: var(--text-m,);
    margin-bottom: var(--space-xs);
}

.zk-summary-card__value {
    color: var(--text-dark);
    font-size: var(--text-m);
}

.zk-summary-card__info {
    font-size: var(--text-xs);
    color: var(--primary-semi-light);
    cursor: help;
}

.done-badge {
    background: var(--primary-ultra-light);
    color: var(--primary);
    font-size: var(--text-xs);
    padding: 3px 10px;
    border-radius: var(--radius-circle);
    font-weight: 600;
}

/* ─── Navigation ──────────────────────────────────────────────────────── */
.zk-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-xs, 1.896rem);
}
.btn-primary {
    padding: var(--btn-padding-block) var(--btn-padding-inline);
    border-radius: var(--btn-border-radius, var(--radius-circle));
    background: var(--primary);
    color: var(--white);
    border: none;
    cursor: pointer;
    font-size: var(--text-s);
    min-width: var(--btn-min-width);
    text-align: center;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-hover);
}
.btn-primary:disabled {
    opacity: 0.4;
    cursor: default;
}
.btn-ghost {
    padding: var(--btn-padding-block) var(--btn-padding-inline);
    border-radius: var(--btn-border-radius, var(--radius-circle));
    border: var(--btn-outline-border-width, 0.25rem) solid var(--primary);
    background: none;
    color: var(--primary);
    cursor: pointer;
    font-size: var(--text-s);
    transition: var(--transition);
}
.btn-ghost:hover {
    background: var(--primary-ultra-light);
}

/* ─── Loading / Error / Animations ────────────────────────────────────── */
.zk-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--neutral-semi-light, #a6a6a6);
    font-size: var(--text-s);
    padding: 8px 0;
}
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--neutral-light, #d9d9d9);
    border-top-color: var(--primary);
    border-radius: var(--radius-50, 50%);
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.zk-err {
    color: var(--danger, #dc3545);
    font-size: var(--text-xs);
    margin-top: 8px;
}
.fade-in {
    animation: fi 0.22s ease;
}
@keyframes fi {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.warn-box {
    background: var(--warning-ultra-light9e6);
    border: 1px solid var(--warning, #ffc10a);
    border-radius: var(--radius-s, 10px);
    padding: var(--space-xs, 1.896rem);
    font-size: var(--text-xs);
    color: var(--warning-semi-dark, #b38600);
    margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* Product Image Gallery – Main image + thumbnail strip                  */
/* ═══════════════════════════════════════════════════════════════════════ */
.zk-gallery {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs, 1.896rem);
}

/* ─── Main / featured image ───────────────────────────────────────────── */
.zk-gallery__main {
    position: relative;
    border-radius: var(--radius-s, 10px);
    overflow: hidden;
    background: var(--neutral-ultra-light, #f2f2f2);
    aspect-ratio: 4 / 3;
    cursor: zoom-in;
}

.zk-gallery__main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-duration, 0.3s)
        var(--transition-timing, ease-in-out);
}

.zk-gallery__main:hover img {
    transform: scale(1.03);
}

/* Navigation arrows on the main image */
.zk-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-50, 50%);
    border: none;
    background: var(--primary);
    color: var(--white);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background var(--transition-duration, 0.3s)
            var(--transition-timing, ease-in-out),
        opacity var(--transition-duration, 0.3s);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    opacity: 0.85;
}
.zk-gallery__nav:hover {
    background: var(--primary-hover);
    opacity: 1;
}
.zk-gallery__nav--prev {
    left: 10px;
}
.zk-gallery__nav--next {
    right: 10px;
}

/* ─── Thumbnail strip ─────────────────────────────────────────────────── */
.zk-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: var(--space-xs, 0.8rem);
}

.zk-gallery__thumb {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-s, 6.67px);
    border: 2px solid transparent;
    background: var(--neutral-ultra-light, #f2f2f2);
    aspect-ratio: 4 / 3;
    cursor: pointer;
    transition:
        border-color var(--transition-duration, 0.3s)
            var(--transition-timing, ease-in-out),
        box-shadow var(--transition-duration, 0.3s);
}

.zk-gallery__thumb:hover {
    border-color: var(--primary-semi-light, #8bb8c1);
    box-shadow: 0 2px 10px var(--primary-trans-20, rgba(91, 153, 166, 0.2));
}

.zk-gallery__thumb.is--active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.zk-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-duration, 0.3s)
        var(--transition-timing, ease-in-out);
}

.zk-gallery__thumb:hover img {
    transform: scale(1.06);
}

/* ─── Gallery: no-images placeholder ──────────────────────────────────── */
.zk-gallery__empty {
    text-align: center;
    padding: var(--space-m) var(--space-xs, 1.896rem);
    color: var(--neutral-semi-light, #a6a6a6);
    font-size: var(--text-xs);
}

/* ─── Lightbox ────────────────────────────────────────────────────────── */
.zk-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
    cursor: zoom-out;
}

.zk-lightbox.is--active {
    opacity: 1;
    visibility: visible;
}

.zk-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-s, 10px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
    transform: scale(0.92);
    transition: transform 0.3s ease;
}

.zk-lightbox.is--active img {
    transform: scale(1);
}

.zk-lightbox__close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-50, 50%);
    border: none;
    background: var(--primary-trans-30, rgba(91, 153, 166, 0.3));
    color: var(--white);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-duration, 0.3s)
        var(--transition-timing, ease-in-out);
    backdrop-filter: blur(6px);
}

.zk-lightbox__close:hover {
    background: var(--primary-trans-50, rgba(91, 153, 166, 0.5));
}

/* ─── Responsive: stack on very small viewports ───────────────────────── */
@media (max-width: 400px) {
    .zk-gallery__thumbs {
        grid-template-columns: 1fr;
    }
}
