/*
 * The product picker of the wish form (Homepage/default.latte, www/js/wish-product-picker.js): the steps of adding a wish, the list of
 * the products found on Heureka, the confirmation and the box of the product the wish is tied to. The frames are .form-section (the
 * yellow of the form and its dark variant are there already). The [hidden] rules are needed: the display set below would win over it.
 */
.product-picker[hidden],
.product-picker [hidden],
.product-chosen[hidden],
.product-chosen [hidden],
.product-chosen-row[hidden] {
    display: none !important;
}

/* 1 Hledání · 2 Potvrzení · 3 Podrobnosti */
.picker-steps {
    display: flex;
    gap: .5rem;
    margin: 0 0 .75rem;
    padding: 0;
    list-style: none;
    font-size: .9rem;
}

.picker-steps li {
    display: flex;
    align-items: center;
    gap: .35rem;
    opacity: .6;
}

.picker-steps li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-weight: 700;
    font-size: .8rem;
}

.picker-steps li.is-current,
.picker-steps li.is-done {
    opacity: 1;
}

.picker-steps li.is-current {
    font-weight: 700;
}

.picker-steps li.is-current span {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.picker-steps li.is-done span {
    background: #2f9e44;
    border-color: #2f9e44;
    color: #fff;
}

.picker-title {
    margin: 0 0 .25rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.picker-title:focus {
    outline: none;
}

.picker-help {
    margin-bottom: .6rem;
    font-size: .9rem;
}

.picker-message {
    min-height: 1.4rem;
    margin: .5rem 0 .25rem;
    font-size: .9rem;
}

.picker-message.is-error {
    color: #c62828;
}

/* the products found: one under another, a whole row is the button (easy to hit on a phone) */
.picker-results {
    display: grid;
    gap: .4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* the words suggested while typing (picker-suggest.js): a list that drops from the field over what is under it; a whole row is a target (easy to hit on a phone) */
.picker-search-box {
    position: relative;
}

.picker-suggestions {
    position: absolute;
    z-index: 30;
    top: 100%;
    right: 0;
    left: 0;
    max-height: min(20rem, 60vh);
    margin: .2rem 0 0;
    padding: .25rem;
    overflow-y: auto;
    list-style: none;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .2);
    border-radius: 8px;
    box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .15);
}

.picker-suggestion {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .6rem;
    border-radius: 6px;
    cursor: pointer;
}

.picker-suggestion:hover,
.picker-suggestion[aria-selected="true"] {
    background: rgba(20, 50, 92, .14);
}

.picker-suggestion-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.picker-suggestion-kind {
    flex: none;
    font-size: .75rem;
    opacity: .75;
}

html[data-theme="dark"] .picker-suggestions {
    background: var(--dark-surface-2);
    border-color: var(--dark-border);
    box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .5);
}

html[data-theme="dark"] .picker-suggestion:hover,
html[data-theme="dark"] .picker-suggestion[aria-selected="true"] {
    background: rgba(255, 255, 255, .14);
}

/* the line between the products that have all the words typed and the similar ones; the colour is the text's, so it reads in both themes */
.picker-similar {
    margin-top: .4rem;
    font-size: .9rem;
    font-weight: 600;
}

.picker-result {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .4rem .6rem;
    border: 1px solid rgba(0, 0, 0, .2);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.picker-result:hover,
.picker-result:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .15rem rgba(20, 50, 92, .25);
}

.picker-result img,
.picker-candidate img,
.product-chosen img {
    flex: none;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}

.picker-result-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.picker-result-text b {
    overflow-wrap: anywhere;
}

/* the ways out of the search: quiet, they are not what most people want */
.picker-escapes {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: .4rem;
    margin-top: .5rem;
}

.picker-escapes .btn {
    white-space: normal;
    text-align: left;
}

/* the address of a product that our catalogue has not, pasted by hand */
.picker-paste {
    margin-top: .5rem;
}

.picker-paste[hidden] {
    display: none;
}

.picker-candidate {
    display: flex;
    gap: .75rem;
    align-items: center;
    margin-bottom: .75rem;
}

.picker-choices {
    margin: 0 0 .75rem;
    padding: 0;
    border: 0;
}

.picker-legend {
    margin-bottom: .35rem;
    font-size: 1rem;
    font-weight: 700;
}

.product-chosen {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
}

.product-chosen-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    width: 100%;
}

.product-chosen-text {
    flex: 1 1 12rem;
    min-width: 0;
}

.product-chosen-text b {
    overflow-wrap: anywhere;
}

.product-chosen-actions {
    display: flex;
    align-items: center;
    gap: .25rem;
}

@media (max-width: 575.98px) {
    /* the search: the field on the whole width and the button under it (side by side they left no room for the text) */
    .product-picker .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .product-picker .input-group > .form-control {
        width: 100%;
        border-radius: .25rem !important;
    }

    .product-picker .input-group-append {
        margin: .5rem 0 0;
    }

    .product-picker .input-group-append .btn {
        width: 100%;
        border-radius: .25rem !important;
    }

    .picker-steps li:not(.is-current) {
        font-size: 0;
    }

    .picker-steps li:not(.is-current) span {
        font-size: .8rem;
    }

    .picker-candidate img {
        width: 72px;
        height: 72px;
    }
}

html[data-theme="dark"] .picker-result {
    background: var(--dark-surface-2);
    border-color: var(--dark-border);
}

html[data-theme="dark"] .picker-message.is-error {
    color: #ff8a80;
}

/* "Načíst další" under the products found: the whole width, easy to hit; light blue, as a part of the search (not the grey of the ways out of it) */
.picker-more {
    display: block;
    width: 100%;
    margin-top: .6rem;
    background-color: #d6e6fa;
    border-color: #a9c6ec;
    color: #14325c;
}

.picker-more:hover,
.picker-more:focus {
    background-color: #c3d9f5;
    border-color: #8fb4e6;
    color: #14325c;
}

/* the question above the green button: it is the way for a product that is on Heureka and not in our search */
.picker-offer {
    margin-top: 1rem;
    color: #34465a;
    font-size: .9rem;
    font-weight: 600;
}

/* a phone: the ways out of the search are buttons as wide as the page, one under another */
@media (max-width: 575.98px) {
    .picker-escapes {
        flex-direction: column;
        align-items: stretch;
    }

    .picker-escapes .btn {
        width: 100%;
        text-align: center;
    }
}

/* "nebo bez Heureky": a word above the grey button, on a line of its own */
.picker-or {
    flex: 0 0 100%;
    margin-top: .25rem;
    color: #6b6a64;
    font-size: .85rem;
}

.picker-or[hidden],
.picker-escapes .btn[hidden] {
    display: none;
}

@media (max-width: 575.98px) {
    .picker-or {
        flex: 0 0 auto;
        text-align: center;
    }
}
