/*
 * Sdílené komponenty konfigurátorů WoodyPox
 *  - stoly a doplňky: config.html + js/config.js
 *  - epoxidové podlahy: podlahy.html + js/floors.js (+ css/floors.css)
 * Navazuje na css/style.css (proměnné --primary, --light, --dark).
 */
:root {
    --wp-ok: #2e8b57;
    --wp-warn: #c77d1a;
}

html {
    /* aby automatický scroll (fokus pole, scrollIntoView) neschoval obsah pod přilepenou navigaci */
    scroll-padding-top: var(--wp-nav-h, 75px);
}

.cfg-kicker {
    font-size: .75rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: .6rem;
}

/*** Krokovník ***/
.cfg-stepper {
    display: flex;
    margin-bottom: 1.5rem;
}

.cfg-stepper button {
    flex: 1;
    background: transparent;
    border: 0;
    border-bottom: 3px solid #e3e3e3;
    padding: .6rem .25rem .6rem 0;
    text-align: left;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #9a9a9a;
    transition: .3s;
    cursor: default;
}

.cfg-stepper button .num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    margin-right: .4rem;
    border-radius: 50%;
    background: #e3e3e3;
    color: #fff;
    font-size: .7rem;
}

.cfg-stepper button.is-active {
    color: var(--dark);
    border-color: var(--primary);
}

.cfg-stepper button.is-active .num,
.cfg-stepper button.is-done .num {
    background: var(--primary);
}

.cfg-stepper button.is-done {
    color: var(--primary);
    border-color: var(--primary);
    cursor: pointer;
}

.cfg-stepper button .label {
    display: none;
}

@media (min-width: 576px) {
    .cfg-stepper button .label {
        display: inline;
    }
}

/* dlouhá cesta (6 kroků): v užším sloupci popisek jen u aktivního kroku, ostatní jen čísla */
@media (max-width: 1199.98px) {
    .cfg-stepper.has-many button:not(.is-active) .label {
        display: none;
    }
}

/*** Volba – karta s náhledem a popisem ***/
.cfg-option {
    position: relative;
    display: block;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.cfg-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cfg-option .cfg-option-body {
    display: flex;
    gap: .9rem;
    align-items: center;
    height: 100%;
    padding: .9rem 1rem;
    background: #fff;
    border: 2px solid transparent;
    transition: .3s;
}

.cfg-option .cfg-option-swatch {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    background: var(--strip, var(--light));
}

.cfg-option .cfg-option-swatch.is-photo {
    background-size: cover;
    background-position: center;
}

.cfg-option .cfg-option-body strong {
    display: block;
    color: var(--dark);
    line-height: 1.25;
}

.cfg-option .cfg-option-body small {
    color: #6c757d;
}

.cfg-option:hover .cfg-option-body {
    border-color: rgba(171, 116, 66, .45);
}

.cfg-option input:checked + .cfg-option-body {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.cfg-option input:focus-visible + .cfg-option-body {
    outline: 3px solid rgba(171, 116, 66, .5);
    outline-offset: 2px;
}

/*** Dlaždice (vzorník barev, tvary, hrany, podnože) ***/
.cfg-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: .75rem;
}

.cfg-swatches.is-wide {
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}

.cfg-swatch {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
}

.cfg-swatch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cfg-swatch .tile {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--swatch, var(--light));
    background-position: center;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
    transition: transform .3s, box-shadow .3s;
}

.cfg-swatches.is-wide .tile {
    aspect-ratio: 4 / 3;
}

.cfg-swatch .tile::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, rgba(255, 255, 255, .3) 0%, rgba(255, 255, 255, 0) 40%, rgba(0, 0, 0, .1) 100%);
}

.cfg-swatch .tile.is-photo::after {
    display: none;
}

.cfg-swatch:hover .tile {
    transform: translateY(-2px);
    box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .15);
}

.cfg-swatch input:checked + .tile {
    box-shadow: 0 0 0 3px var(--primary);
}

.cfg-swatch input:checked + .tile::before {
    content: "\f00c";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    z-index: 1;
    right: .35rem;
    bottom: .35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    font-size: .75rem;
    background: var(--primary);
    color: #fff;
}

.cfg-swatch input:focus-visible + .tile {
    outline: 3px solid rgba(171, 116, 66, .5);
    outline-offset: 2px;
}

.cfg-swatch .name {
    display: block;
    margin-top: .4rem;
    font-size: .78rem;
    line-height: 1.25;
    text-align: center;
    color: var(--dark);
}

.cfg-swatch.is-custom .tile {
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(#ececec 0 25%, #fff 0 50%) 50% / 16px 16px;
    color: var(--primary);
    font-size: 1.4rem;
}

.cfg-swatch.is-custom .tile::after {
    display: none;
}

/*** Segmentový přepínač ***/
.cfg-segment {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: #fff;
}

.cfg-segment label {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.cfg-segment input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cfg-segment .seg {
    display: block;
    padding: .55rem 1rem;
    font-size: .9rem;
    font-weight: 500;
    color: var(--dark);
    transition: .3s;
}

.cfg-segment label:hover .seg {
    background: var(--light);
}

.cfg-segment input:checked + .seg {
    background: var(--dark);
    color: #fff;
}

.cfg-segment input:focus-visible + .seg {
    outline: 3px solid rgba(171, 116, 66, .5);
    outline-offset: 2px;
}

/*** Formulářové prvky ***/
.cfg-form .form-control,
.cfg-form .form-select {
    height: 55px;
    border: 0;
}

.cfg-form textarea.form-control {
    height: auto;
    min-height: 110px;
}

.cfg-form .form-control.is-invalid,
.cfg-form .form-select.is-invalid {
    box-shadow: inset 0 0 0 2px #dc3545;
}

.cfg-form .form-label {
    font-weight: 500;
    color: var(--dark);
    margin-bottom: .4rem;
}

.cfg-input-unit {
    position: relative;
}

.cfg-input-unit .form-control {
    padding-right: 3rem;
}

.cfg-input-unit .unit {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-weight: 500;
    pointer-events: none;
}

.cfg-quick {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .5rem;
}

.cfg-quick button {
    background: #fff;
    border: 1px solid #e3e3e3;
    color: var(--dark);
    font-size: .8rem;
    padding: .3rem .7rem;
    transition: .3s;
}

.cfg-quick button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cfg-step-error {
    display: none;
    color: #dc3545;
    font-size: .9rem;
    margin-top: .75rem;
}

.cfg-step-error.is-visible {
    display: block;
}

.cfg-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/*** Náhled + souhrn ***/
.cfg-preview-inner {
    background: #fff;
}

.cfg-photo {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #fff;
    border: 1px solid #ececec;
}

.cfg-photo img {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    width: calc(100% - 2.5rem);
    height: calc(100% - 2.5rem);
    object-fit: contain;
}

.cfg-photo-caption {
    position: absolute;
    z-index: 2;
    left: 1rem;
    bottom: 1rem;
    max-width: calc(100% - 2rem);
    padding: .45rem .8rem;
    background: rgba(53, 53, 53, .85);
    color: #fff;
    font-size: .82rem;
    line-height: 1.3;
}

.cfg-summary {
    padding: 1.25rem 1.5rem 1.5rem;
}

.cfg-summary dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .45rem 1rem;
    margin: 0;
    font-size: .92rem;
}

.cfg-summary dt {
    font-weight: 500;
    color: #6c757d;
}

.cfg-summary dd {
    margin: 0;
    text-align: right;
    font-weight: 600;
    color: var(--dark);
}

.cfg-estimate {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.cfg-estimate .amount {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 1.6rem;
    color: var(--primary);
    line-height: 1.1;
}

.cfg-summary-compact {
    display: none;
}

@media (max-width: 991.98px) {
    html {
        /* na mobilu navíc pod přilepený náhled */
        scroll-padding-top: calc(var(--wp-nav-h, 75px) + 205px);
    }

    .cfg-preview-wrap {
        position: -webkit-sticky;
        position: sticky;
        top: var(--wp-nav-h, 75px);
        z-index: 1010;
        background: #fff;
        border-bottom: 1px solid rgba(0, 0, 0, .075);
    }

    .cfg-photo {
        aspect-ratio: auto;
        height: 150px;
        border: 0;
    }

    .cfg-photo img {
        top: .5rem;
        left: .5rem;
        width: calc(100% - 1rem);
        height: calc(100% - 1rem);
    }

    .cfg-photo-caption {
        display: none;
    }

    .cfg-summary {
        display: none;
    }

    .cfg-summary-compact {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        min-height: 54px;
        padding: .6rem 1rem;
        font-size: .85rem;
        color: var(--dark);
    }

    .cfg-summary-compact .amount {
        font-family: 'Roboto', sans-serif;
        font-weight: 700;
        color: var(--primary);
        white-space: nowrap;
    }
}

@media (min-width: 992px) {
    .cfg-preview-wrap {
        position: -webkit-sticky;
        position: sticky;
        top: calc(var(--wp-nav-h, 75px) + 1.5rem);
    }
}

/*** Průběh zakázky ***/
.cfg-process-item {
    height: 100%;
    padding: 1.5rem;
    background: #fff;
    border: 5px solid var(--light);
    text-align: center;
}

.cfg-process-item .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    margin: 0 auto 1rem;
    background: var(--light);
}

.cfg-process-item .step-no {
    font-family: 'Roboto', sans-serif;
    font-weight: 900;
    font-size: 2.6rem;
    line-height: 1;
    color: #e6e6e6;
    margin-bottom: .5rem;
}

/*** Široké monitory – konfigurátor má vlastní širší kontejner a větší prvky ***/
@media (min-width: 1400px) {
    .container.cfg-container {
        max-width: 1500px;
    }
}

@media (min-width: 1600px) {
    .container.cfg-container {
        max-width: 1680px;
        font-size: 1.08rem;
    }

    .cfg-container .h5,
    .cfg-container legend.h5 {
        font-size: 1.45rem;
    }

    .cfg-container .bg-light.p-lg-5 {
        padding: 3.5rem !important;
    }

    .cfg-stepper button {
        padding: .8rem .25rem .8rem 0;
        font-size: .86rem;
    }

    .cfg-stepper button .num {
        width: 1.9rem;
        height: 1.9rem;
        margin-right: .5rem;
        font-size: .85rem;
    }

    .cfg-option .cfg-option-body {
        gap: 1.1rem;
        padding: 1.1rem 1.25rem;
    }

    .cfg-option .cfg-option-swatch {
        width: 76px;
        height: 76px;
    }

    .cfg-swatches {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;
    }

    .cfg-swatches.is-wide {
        grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    }

    .cfg-swatch .name {
        font-size: .9rem;
    }

    .cfg-segment .seg {
        padding: .7rem 1.3rem;
        font-size: 1rem;
    }

    .cfg-form .form-control,
    .cfg-form .form-select {
        height: 62px;
        font-size: 1.05rem;
    }

    .cfg-form textarea.form-control {
        min-height: 130px;
    }

    .cfg-form .btn,
    .cfg-quick button {
        font-size: 1.02rem;
    }

    .cfg-summary {
        padding: 1.5rem 1.75rem 1.75rem;
    }

    .cfg-summary dl {
        font-size: 1.05rem;
        gap: .55rem 1rem;
    }

    .cfg-estimate .amount {
        font-size: 2rem;
    }

    .cfg-photo-caption,
    .floor-room .floor-caption {
        font-size: .95rem;
    }
}

@media (min-width: 2000px) {
    .container.cfg-container {
        max-width: 1880px;
    }
}

/*** Skupiny ve vzorníku (nadpis přes celou šířku mřížky) ***/
.cfg-swatch-group {
    grid-column: 1 / -1;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid #e6e6e6;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #6c757d;
}

.cfg-swatch-group:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
