/**
 * Rental Calculator page styles
 * Extracted from Views/Home/NewRentalCalculator.cshtml
 */

/* Page layout */
.calc-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 32px 80px;
}

.calc-page__hero {
    text-align: center;
    margin-bottom: 48px;
}

.calc-page__tag {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--sam-red);
    margin-bottom: 12px;
}

.calc-page__title {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.1;
    margin: 0 0 14px;
}

.calc-page__desc {
    font-size: var(--text-md);
    color: var(--sam-brown-dark);
    max-width: 520px;
    margin: 0 auto;
}

/* One centred line of selling points under the intro, each with a leading
   middle dot; wraps onto further lines on narrow screens. */
.calc-page__usps {
    list-style: none;
    margin: var(--s-4) 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--s-1) var(--s-3);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--sam-dark);
}

.calc-page__usps li::before {
    content: "·";
    margin-right: var(--s-3);
    color: var(--sam-red);
    font-weight: 700;
}

/* Calculator grid */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 28px;
    align-items: start;
}

/* Form card - scoped to calculator */
.calc-card {
    background: var(--sam-white);
    border: 1px solid var(--sam-light);
    border-radius: var(--radius-xl);
    padding: 28px;
    margin-bottom: 20px;
}

.calc-card__title {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.01em;
    margin: 0 0 20px;
}

/* Calculator fields */
.calc-field {
    margin-bottom: 20px;
}

.calc-field__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    gap: 12px;
    flex-wrap: wrap;
}

.calc-field__label {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--sam-brown-dark);
    text-transform: uppercase;
    letter-spacing: .06em;
    flex: 1;
    min-width: 0;
}

.calc-field__value {
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.calc-field__value span {
    font-size: var(--text-sm);
    color: var(--sam-medium);
    font-weight: 500;
}

.calc-field__hint {
    font-size: 12px;
    color: var(--sam-medium);
    margin-top: 5px;
}

/* Input styling */
.calc-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--sam-light);
    border-radius: 10px;
    font: inherit;
    font-size: 15px;
}

.calc-input--with-icon {
    padding-right: 42px;
}

/* Select pickers. The native <select> popup is drawn by the browser/OS, not
   the page, so it ignores our CSS and can come out wider than the field
   (e.g. under browser zoom or fractional display scaling) and spill over the
   result card. Where customizable selects are supported, render the picker
   in-page instead and pin it to the field's width; elsewhere the native popup
   stays as the fallback. Picker look mirrors .calc-autocomplete. */
@supports (appearance: base-select) {
    select.calc-input,
    select.calc-input::picker(select) {
        appearance: base-select;
    }

    select.calc-input {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: var(--sam-white);
        color: var(--text-primary);
        cursor: pointer;
    }

    select.calc-input::picker-icon {
        color: var(--sam-brown-dark);
        transition: rotate 0.15s;
    }

    select.calc-input:open::picker-icon {
        rotate: 180deg;
    }

    select.calc-input::picker(select) {
        box-sizing: border-box;
        width: anchor-size(width);
        max-height: 300px;
        margin-block: 4px;
        padding: 0;
        background: var(--sam-white);
        border: 1.5px solid var(--sam-light);
        border-radius: 10px;
        box-shadow: var(--shadow-2);
    }

    select.calc-input option {
        padding: 12px 14px;
        transition: background 0.15s;
    }

    select.calc-input option::checkmark {
        display: none;
    }

    select.calc-input option:checked {
        font-weight: 700;
    }

    select.calc-input option:hover,
    select.calc-input option:focus-visible {
        background: var(--sam-brown-light);
    }

    /* Inset the focus ring; the picker clips an outset one at its edges. */
    select.calc-input option:focus-visible {
        outline-offset: -2px;
    }
}

/* Autocomplete wrapper - must be position:relative for dropdown positioning */
.calc-field__autocomplete-wrap {
    position: relative;
}

/* Input wrapper for loader positioning */
.calc-input-wrap {
    position: relative;
}

.calc-input__loader {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    color: var(--sam-medium);
}

.calc-input__loader.is-loading {
    display: flex;
}

.calc-input__spinner {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 32;
    stroke-dashoffset: 12;
    animation: calc-spin 0.8s linear infinite;
}

/* Range slider */
.calc-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    accent-color: var(--color-action);
    cursor: pointer;
    margin: 0;
}

.calc-range::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
}

/* Chip buttons */
.chip-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip-btn {
    padding: 8px 16px;
    border: 1.5px solid var(--sam-light);
    border-radius: var(--radius-pill);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    background: var(--sam-white);
    color: var(--sam-brown-dark);
    transition: all .12s;
}

.chip-btn:hover {
    border-color: var(--text-primary);
}

.chip-btn.on {
    background: var(--sam-dark);
    color: #fff;
    border-color: var(--text-primary);
}

/* Toggle row */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--sam-light);
}

.toggle-row:last-child {
    border-bottom: none;
}

.toggle-row .label {
    font-size: 14px;
    font-weight: 600;
}

.toggle-row .sub {
    font-size: 12.5px;
    color: var(--sam-medium);
}

/* Toggle switch */
.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle .track {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--sam-light);
    transition: background .2s;
    position: relative;
    flex-shrink: 0;
}

.toggle input:checked ~ .track {
    background: var(--sam-dark);
}

.toggle .thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-1);
    transition: transform .2s;
}

.toggle input:checked ~ .track .thumb {
    transform: translateX(20px);
}

/* Result column layout */
.calc-result-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Result card */
.result-card {
    background: var(--sam-dark);
    border-radius: var(--radius-xl);
    padding: 28px;
    color: #fff;
}

.result-card__label {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .5);
    margin-bottom: 8px;
}

.result-card__price {
    font-size: var(--text-3xl);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-bottom: 4px;
    color: #fff;
}

.result-card__period {
    font-size: var(--text-base);
    color: rgba(255, 255, 255, .5);
    margin-bottom: 24px;
}

/* Breakdown rows */
.result-card__breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.result-card__row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.result-card__row-key {
    color: rgba(255, 255, 255, .6);
}

.result-card__row-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.result-card__row--total {
    border-top: 1px solid rgba(255, 255, 255, .12);
    padding-top: 10px;
    font-size: var(--text-base);
}

.result-card__row--total .result-card__row-key {
    color: rgba(255, 255, 255, .9);
}

.result-card__row--total .result-card__row-value {
    color: var(--sam-red);
    font-size: 18px;
}

/* Comparison bar */
.result-card__comp-bar {
    margin-bottom: 20px;
}

.result-card__comp-label {
    font-size: 12px;
    color: rgba(255, 255, 255, .5);
    margin-bottom: 6px;
}

.result-card__bar-track {
    height: 6px;
    background: rgba(255, 255, 255, .12);
    border-radius: 3px;
    overflow: hidden;
}

.result-card__bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--sam-red);
    transition: width .5s ease;
}

.result-card__bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, .35);
    margin-top: 4px;
}

/* Result card button */
.result-card__btn {
    width: 100%;
    justify-content: center;
    margin-top: 20px;
    background: var(--sam-red);
}

/* Comparables */
.comps {
    margin-top: 4px;
}

.comps__title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255, 255, 255, .4);
    margin-bottom: 12px;
}

.comp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.comp-row:last-child {
    border-bottom: none;
}

.comp-row__thumb {
    width: 36px;
    height: 28px;
    border-radius: 5px;
    flex-shrink: 0;
}

.comp-row__info {
    flex: 1;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .65);
}

.comp-row__info b {
    color: #fff;
    display: block;
    font-size: var(--text-sm);
}

.comp-row__price {
    font-size: var(--text-sm);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Placeholder card */
.result-placeholder {
    background: var(--sam-brown-light);
    border: 2px dashed var(--sam-light);
    border-radius: var(--radius-xl);
    padding: 48px 28px;
    text-align: center;
}

.result-placeholder__icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 109, 89, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--sam-red);
}

.result-placeholder__title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--sam-dark);
}

.result-placeholder__text {
    font-size: 14px;
    color: var(--sam-medium);
    margin: 0;
    line-height: 1.5;
}

/* Trustpilot reviews - must not be sticky, stays behind result card */
.calc-reviews {
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

/* Ensure Trustpilot iframe doesn't inherit sticky behavior */
.calc-reviews iframe,
.calc-reviews > div {
    position: relative !important;
}

/* Autocomplete dropdown */
.calc-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid var(--sam-light);
    border-radius: 10px;
    margin-top: 4px;
    box-shadow: var(--shadow-2);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.calc-autocomplete.is-open {
    display: block;
}

.calc-autocomplete__item {
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.calc-autocomplete__item:hover,
.calc-autocomplete__item.is-active {
    background: var(--sam-brown-light);
}

/* Spinner animation */
.spinner {
    animation: calc-spin 1s linear infinite;
}

@keyframes calc-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 900px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }

    .calc-field__label {
        font-size: 11px;
        letter-spacing: .04em;
    }

    .calc-field__value {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .calc-page {
        padding: 24px 16px 60px;
    }

    .calc-page__title {
        font-size: 28px;
    }

    .calc-page__desc {
        font-size: 14px;
    }

    .calc-card {
        padding: 20px;
    }

    .calc-field__header {
        flex-direction: row;
        align-items: center;
    }

    .calc-field__label {
        font-size: 10px;
    }

    #rent-place-search::placeholder {
        font-size: 13px;
    }
}

/* Tweaks panel (dev mode) */
.calc-tweaks {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #fff;
    border: 1px solid var(--sam-light);
    border-radius: 14px;
    padding: 20px;
    width: 220px;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-3);
    z-index: 9999;
    font-size: 14px;
}

.calc-tweaks[hidden] {
    display: none;
}

.calc-tweaks:not([hidden]) {
    display: flex;
}

.calc-tweaks__title {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--sam-medium);
}

.calc-tweaks__text {
    font-size: 13px;
    color: var(--sam-brown-dark);
}

/* ── Below-the-calculator bands ──────────────────────────────────────────────
   .calc-page is a narrow (1100px) centred column; the Trygghetspaket block and
   the two promo cards are full-bleed sections that sit after it, so they get
   their own vertical rhythm rather than inheriting the calculator's. */
.calc-band {
    padding: 56px 0;
}

.calc-promos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4);
    align-items: stretch;
}

.calc-promo {
    display: flex;
    background: var(--sam-white);
    border: 1px solid var(--sam-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

/* Photo keeps a fixed share of the card so both cards stay the same height
   whichever copy is longer. */
.calc-promo__img {
    width: 38%;
    object-fit: cover;
    flex-shrink: 0;
}

.calc-promo__body {
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.calc-promo__title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.01em;
    margin: 0;
}

.calc-promo__text {
    font-size: var(--text-sm);
    color: var(--sam-brown-dark);
    margin: 0 0 6px;
}

.calc-promo--dark {
    background: var(--sam-dark);
    border-color: var(--sam-dark);
    color: var(--sam-white);
}

.calc-promo--dark .calc-promo__text {
    color: color-mix(in oklab, var(--sam-white) 78%, transparent);
}

/* "Har du frågor?" card directly under the FAQ list. */
.calc-faq__contact {
    margin-top: var(--s-5);
}

@media (max-width: 900px) {
    .calc-band {
        padding: 36px 0;
    }

    .calc-promos {
        grid-template-columns: 1fr;
    }

    /* Stacked, the photo becomes a banner rather than a tall side panel. */
    .calc-promo {
        flex-direction: column;
    }

    .calc-promo__img {
        width: 100%;
        height: 180px;
    }
}

/* ── Mobile density ──────────────────────────────────────────────────────────
   On one column the result card sits below the whole form, so every gap in the
   form is scroll between the visitor and "Rekommenderad hyra". The desktop
   rhythm is kept; the phone layout is tightened. */
@media (max-width: 900px) {
    .calc-page {
        padding-top: 24px;
    }

    .calc-page__hero {
        margin-bottom: 24px;
    }

    .calc-grid {
        gap: 16px;
    }

    .calc-card {
        padding: 20px;
        margin-bottom: 16px;
    }

    .calc-card__title {
        margin-bottom: 14px;
    }

    .calc-field {
        margin-bottom: 14px;
    }

    .calc-field__header {
        margin-bottom: 6px;
    }

    .calc-field:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    .calc-page {
        padding: 16px 16px 48px;
    }

    .calc-page__hero {
        margin-bottom: 20px;
    }

    .calc-card {
        padding: 16px;
    }

    .calc-promo__body {
        padding: 20px;
    }
}
