/* Trade-in calculator (Figma "Калькулятор Trade-in" 1920 / "М. Калькулятор Trade-in" 393) */
.calculator {
    color: var(--chernyy);
}

.calculator__header {
    margin-bottom: 30px;
}

.calculator__subtitle {
    margin: 0 0 10px;
    font-weight: 700;
    font-size: 16px;
    line-height: 150%;
}

.calculator__text {
    font-weight: 500;
    font-size: clamp(15px, 12.86px + 0.36vw, 18px);
    line-height: 140%;
    color: var(--seryy);
}

.calculator__menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---- cards ---- */
.calculator__card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background: var(--belyy);
    box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.07);
}

.calculator__select {
    gap: 0;
}

.calculator__card-title {
    margin: 0;
    font-weight: 500;
    font-size: 16px;
    line-height: 150%;
}

/* ---- Model / Memory dropdowns ---- */
.calculator__select-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    font: 500 16px/150% var(--font-family);
    color: var(--chernyy);
    text-align: left;
    cursor: pointer;
}

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

.calculator__select-arrow {
    flex: none;
    width: 14px;
    height: auto;
    transition: transform 0.15s;
}

.calculator__select.is-open .calculator__select-arrow {
    transform: rotate(180deg);
}

.calculator__popup {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: var(--belyy);
    box-shadow: 0 20px 30px 0 rgba(0, 0, 0, 0.1);
}

.calculator__popup[hidden] {
    display: none;
}

.calculator__search {
    width: 100%;
    padding: 13px 15px;
    border: 0;
    border-radius: 0;
    background: var(--svetlo-seryy);
    font: 500 15px/20px var(--font-family);
    color: var(--chernyy);
    -webkit-appearance: none;
    appearance: none;
}

.calculator__search::placeholder {
    color: var(--seryy);
}

.calculator__search:focus {
    outline: none;
}

.calculator__options {
    display: flex;
    flex-direction: column;
    max-height: 300px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.calculator__option {
    padding: 10px 0;
    border: 0;
    background: none;
    font: 500 15px/140% var(--font-family);
    color: var(--chernyy);
    text-align: left;
    cursor: pointer;
}

.calculator__option:hover {
    color: var(--firmennyy);
}

.calculator__option.is-selected {
    font-weight: 700;
}

.calculator__empty {
    margin: 0;
    padding: 10px 0;
    font: 500 15px/140% var(--font-family);
    color: var(--seryy);
}

/* ---- condition / box ---- */
.calculator__setting-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
}

.calculator__setting-option {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px;
    border: 1.5px solid var(--temno-belyy);
    background: none;
    font-family: var(--font-family);
    color: var(--chernyy);
    text-align: center;
    cursor: pointer;
}

.calculator__setting-option:hover,
.calculator__setting-option.active {
    border-color: var(--seryy);
}

.calculator__setting-options--row .calculator__setting-option {
    align-items: flex-start;
    justify-content: center;
    padding: 13px 15px;
    text-align: left;
}

.calculator__option-label {
    font-weight: 500;
    font-size: clamp(15px, 12.86px + 0.36vw, 18px);
    line-height: 140%;
}

.calculator__option-clu {
    font-weight: 400;
    font-size: clamp(11px, 1vw + 6px, 15px);
    line-height: 100%;
    color: var(--seryy);
}

/* ---- summary ---- */
.calculator__summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    padding: 15px;
    background: var(--belyy);
    box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.07);
}

.calculator__summary-title {
    font-weight: 500;
    font-size: 16px;
    line-height: 150%;
}

.calculator__summary-value {
    font-weight: 600;
    font-size: clamp(20px, 5vw, 30px);
    line-height: 120%;
    text-transform: uppercase;
    color: var(--firmennyy);
}

@media (min-width: 768px) {
    .calculator__header {
        max-width: 785px;
    }

    .calculator__subtitle {
        margin-bottom: 20px;
        font-size: 18px;
        font-weight: 500;
    }

    .calculator__menu {
        gap: 15px;
    }

    .calculator__card {
        gap: 20px;
        padding: 20px;
    }

    .calculator__select {
        gap: 0;
    }

    .calculator__card-title,
    .calculator__select-btn {
        font-size: 18px;
    }

    .calculator__setting-options {
        display: flex;
        gap: 10px;
    }

    .calculator__setting-option {
        flex: 1;
        gap: 5px;
        padding: 13px;
    }

    .calculator__setting-options--row .calculator__setting-option {
        padding: 13px 15px;
    }

    .calculator__popup {
        padding: 20px;
    }

    .calculator__summary {
        gap: 20px;
        margin-top: 15px;
        padding: 20px;
    }

    .calculator__summary-title {
        font-size: 20px;
        line-height: 125%;
    }
}

@media (min-width: 1200px) {
    .calculator__header {
        margin-bottom: 30px;
    }

    /* Figma "Калькулятор Trade-in": subtitle sits right under the title */
    .calculator__header .title {
        margin-bottom: 0;
    }

    /* Figma: chip note is 14px Regular on one line ("Несколько микроцарапин"), chip ~200×71 */
    .calculator__option-clu {
        font-size: 14px;
        font-weight: 400;
        white-space: nowrap;
    }

    .calculator__card-title,
    .calculator__select-btn {
        font-size: 20px;
    }

    .calculator__menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
        align-items: start;
    }

    .calculator__summary {
        max-width: 745px;
        margin: 20px auto 0; /* Figma: 20px below the option cards */
        gap: 10px;
        align-items: center;
        text-align: center;
    }
}
