/* TT Earnings Estimator Styles */

.tt-earnings-estimator {
    --tt-form-gap: 24px;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 48px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

/* Layout: Stacked (top/bottom). */
.elementor-widget-tt-earnings-estimator .tt-earnings-estimator--mode-stacked {
    flex-direction: column !important;
    align-items: stretch;
}

.elementor-widget-tt-earnings-estimator .tt-earnings-estimator--mode-stacked > .tt-earnings-estimator__left,
.elementor-widget-tt-earnings-estimator .tt-earnings-estimator--mode-stacked > .tt-earnings-estimator__right {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    align-self: stretch;
}

.elementor-widget-tt-earnings-estimator .tt-earnings-estimator--mode-stacked > .tt-earnings-estimator__divider {
    width: 100% !important;
    height: 1px;
    flex: 0 0 1px;
}

/* Layout: Overlay (result replaces form). */
/*
 * Absolute-positioning swap strategy:
 * - The currently visible module stays in-flow and decides the container's height.
 * - The hidden module is absolutely positioned (inset:0) and removed from layout.
 * - Toggling the .is-result-active class swaps which one is in-flow vs absolute,
 *   so the container always shrink-wraps to the visible module's height —
 *   no clipping, no double-height stacking, no flex/grid quirks.
 */
.elementor-widget-tt-earnings-estimator .tt-earnings-estimator--mode-overlay {
    position: relative;
    display: block !important;
    flex-direction: initial !important;
    gap: 0 !important;
}

.elementor-widget-tt-earnings-estimator .tt-earnings-estimator--mode-overlay > .tt-earnings-estimator__divider {
    display: none !important;
}

.elementor-widget-tt-earnings-estimator .tt-earnings-estimator--mode-overlay > .tt-earnings-estimator__left,
.elementor-widget-tt-earnings-estimator .tt-earnings-estimator--mode-overlay > .tt-earnings-estimator__right {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    flex: initial !important;
}

/* Default: form is in-flow (decides container height); result is absolutely positioned overlay (hidden). */
.tt-earnings-estimator--mode-overlay > .tt-earnings-estimator__left {
    position: relative;
    z-index: 1;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s linear 0s;
}

.tt-earnings-estimator--mode-overlay > .tt-earnings-estimator__right {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
    pointer-events: none;
    background-color: inherit;
}

/* Active: result is in-flow (decides container height); form is absolutely positioned (hidden). */
.tt-earnings-estimator--mode-overlay.is-result-active > .tt-earnings-estimator__left {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.tt-earnings-estimator--mode-overlay.is-result-active > .tt-earnings-estimator__right {
    position: relative;
    inset: auto;
    z-index: 2;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0s;
    pointer-events: auto;
}

/* Left Column */
.tt-earnings-estimator__left {
    flex: 1 1 45%;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    transition: opacity 0.25s ease;
}

.tt-earnings-estimator__left-title {
    margin: 0 0 40px;
    font-size: 32px;
    font-weight: 400;
    line-height: 1.3;
    color: #1a1a1a;
}

/* Form Container — switched to 12-col grid for responsive field widths. */
.tt-earnings-estimator__form {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    row-gap: var(--tt-form-gap, 24px);
    column-gap: 24px;
    align-items: start;
    box-sizing: border-box;
}

/* Field — span columns based on width var (rounded to nearest 12-col span). */
.tt-earnings-estimator__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Default: full width. Span overridden below by width vars. */
    grid-column: span 12;
    min-width: 0;
}

/* Map percentage → 12-col span, by media query. */
.tt-earnings-estimator__field { grid-column: span var(--span-d, 12); }
@media (max-width: 1024px) {
    .tt-earnings-estimator__field { grid-column: span var(--span-t, 12); }
}
@media (max-width: 767px) {
    .tt-earnings-estimator__field { grid-column: span var(--span-m, 12); }
}

/* CSS does not support arithmetic on vars in grid-column-span,
   so we expose helper classes via inline style fallback (computed in PHP).
   The PHP outputs --w-d/--w-t/--w-m as percentages; below derives spans. */
.tt-earnings-estimator__field {
    --span-d: 12;
    --span-t: 12;
    --span-m: 12;
}
.tt-earnings-estimator__field[style*="--w-d:50%"]  { --span-d: 6; }
.tt-earnings-estimator__field[style*="--w-d:33%"]  { --span-d: 4; }
.tt-earnings-estimator__field[style*="--w-d:25%"]  { --span-d: 3; }
.tt-earnings-estimator__field[style*="--w-t:50%"]  { --span-t: 6; }
.tt-earnings-estimator__field[style*="--w-t:33%"]  { --span-t: 4; }
.tt-earnings-estimator__field[style*="--w-t:25%"]  { --span-t: 3; }
.tt-earnings-estimator__field[style*="--w-m:50%"]  { --span-m: 6; }
.tt-earnings-estimator__field[style*="--w-m:33%"]  { --span-m: 4; }
.tt-earnings-estimator__field[style*="--w-m:25%"]  { --span-m: 3; }

/* Estimate button — participates in grid like a field, spans controlled by --span-d/t/m. */
.tt-earnings-estimator__form > .tt-earnings-estimator__estimate-btn {
    --span-d: 12;
    --span-t: 12;
    --span-m: 12;
    grid-column: span var(--span-d, 12);
}
@media (max-width: 1024px) {
    .tt-earnings-estimator__form > .tt-earnings-estimator__estimate-btn {
        grid-column: span var(--span-t, 12);
    }
}
@media (max-width: 767px) {
    .tt-earnings-estimator__form > .tt-earnings-estimator__estimate-btn {
        grid-column: span var(--span-m, 12);
    }
}

/* Richtext display field. */
.tt-earnings-estimator__field--type-richtext {
    gap: 0;
}
.tt-earnings-estimator__richtext {
    line-height: 1.6;
    color: inherit;
}
.tt-earnings-estimator__richtext > :first-child { margin-top: 0; }
.tt-earnings-estimator__richtext > :last-child  { margin-bottom: 0; }

.tt-earnings-estimator__label {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.4;
}

.elementor-widget-tt-earnings-estimator .tt-earnings-estimator__form .tt-earnings-estimator__field .tt-earnings-estimator__input,
.elementor-widget-tt-earnings-estimator .tt-earnings-estimator__form .tt-earnings-estimator__field .tt-earnings-estimator__select {
    width: 100%;
    padding: 10px 5px;
    font-size: 14px;
    font-family: inherit;
    color: #999999;
    background-color: transparent !important;
    border: none;
    border-bottom: 1px solid #9d94944a;
    border-radius: 0;
    outline: none;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    line-height: 1.4;
    min-height: auto;
}

.elementor-widget-tt-earnings-estimator .tt-earnings-estimator__form .tt-earnings-estimator__field .tt-earnings-estimator__input::placeholder {
    font-size: inherit;
    color: #999999;
    opacity: 1;
}

.tt-earnings-estimator__select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23999999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.tt-earnings-estimator__select option:first-child {
    color: #999999;
}

/* Error Message */
.tt-earnings-estimator__error {
    display: none;
    font-size: 12px;
    color: #d93025;
    margin-top: 4px;
    line-height: 1.4;
}

.tt-earnings-estimator__field.is-error .tt-earnings-estimator__error {
    display: block;
}

.tt-earnings-estimator__field.is-error .tt-earnings-estimator__input,
.tt-earnings-estimator__field.is-error .tt-earnings-estimator__select {
    border-bottom-color: #d93025;
}

/* Estimate Button */
.tt-earnings-estimator__estimate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 16px 32px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: #1a1a1a;
    background-color: #c4a882;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-sizing: border-box;
}

.tt-earnings-estimator__estimate-btn:hover {
    background-color: #b89a75;
    transform: translateY(-1px);
}

.tt-earnings-estimator__btn-text {
    line-height: 1;
}

.tt-earnings-estimator__btn-icon {
    flex-shrink: 0;
}

/* Divider */
.tt-earnings-estimator__divider {
    width: 1px;
    flex-shrink: 0;
    background-color: #e0e0e0;
    align-self: stretch;
}

/* Right Column */
.tt-earnings-estimator__right {
    flex: 1 1 45%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-self: stretch;
    position: relative;
}

/* Default Image */
.tt-earnings-estimator__image-wrap {
    width: 100%;
    overflow: hidden;
}

.tt-earnings-estimator__image-wrap.is-hidden {
    display: none;
}

.tt-earnings-estimator__image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.tt-earnings-estimator__result {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    justify-content: space-around;
    gap: 24px;
}

.tt-earnings-estimator__result[hidden] {
    display: none;
}

.tt-earnings-estimator__right-title {
    margin: 0;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.4;
    color: #1a1a1a;
}

/* Amount */
.tt-earnings-estimator__amount-wrap {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.tt-earnings-estimator__currency {
    font-size: 24px;
    font-weight: 400;
    color: #1a1a1a;
    line-height: 1;
    margin-top: 8px;
}

.tt-earnings-estimator__amount {
    font-size: 64px;
    font-weight: 400;
    color: #1a1a1a;
    line-height: 1;
    letter-spacing: -0.02em;
}

/* Toggle Tabs */
.tt-earnings-estimator__toggles {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tt-earnings-estimator__toggle {
    position: relative;
    padding: 0 0 4px;
    font-size: 14px;
    font-weight: 400;
    font-family: inherit;
    color: #888888;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.tt-earnings-estimator__toggle::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: transparent;
    transition: background-color 0.3s ease;
}

.tt-earnings-estimator__toggle.is-active {
    color: #1a1a1a;
}

.tt-earnings-estimator__toggle.is-active::after {
    background-color: #1a1a1a;
}

.tt-earnings-estimator__toggle:hover {
    color: #1a1a1a;
}

/* Submit Button */
.tt-earnings-estimator__submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    max-width: 280px;
    padding: 16px 32px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: #1a1a1a;
    background-color: #c4a882;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-sizing: border-box;
}

.tt-earnings-estimator__submit-btn:hover {
    background-color: #b89a75;
    transform: translateY(-1px);
}

.tt-earnings-estimator__submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

/* Back to Form button (overlay mode). */
.tt-earnings-estimator__back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 8px 0;
    font-size: 13px;
    font-family: inherit;
    color: #666666;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.tt-earnings-estimator__back-btn:hover {
    color: #1a1a1a;
}

.tt-earnings-estimator__notice {
    min-height: 20px;
    font-size: 13px;
    line-height: 1.5;
    color: #666666;
}

.tt-earnings-estimator__notice.is-success {
    color: #166534;
}

.tt-earnings-estimator__notice.is-error {
    color: #d93025;
}

/* Bottom Text */
.tt-earnings-estimator__bottom-text {
    margin: 0;
    font-size: 14px;
    color: #666666;
    line-height: 1.6;
    /* max-width: 360px; */
}

/* Responsive */
@media (max-width: 768px) {
    .tt-earnings-estimator:not(.tt-earnings-estimator--mode-overlay) {
        flex-direction: column;
        gap: 32px;
    }

    .tt-earnings-estimator:not(.tt-earnings-estimator--mode-overlay) .tt-earnings-estimator__left,
    .tt-earnings-estimator:not(.tt-earnings-estimator--mode-overlay) .tt-earnings-estimator__right {
        flex-basis: auto;
        width: 100%;
        align-self: auto;
    }

    .tt-earnings-estimator:not(.tt-earnings-estimator--mode-overlay) .tt-earnings-estimator__right,
    .tt-earnings-estimator:not(.tt-earnings-estimator--mode-overlay) .tt-earnings-estimator__result {
        justify-content: flex-start;
    }

    .tt-earnings-estimator:not(.tt-earnings-estimator--mode-overlay) .tt-earnings-estimator__divider {
        width: 100%;
        height: 1px;
    }

    .tt-earnings-estimator__amount {
        font-size: 48px;
    }
}

/* Google Places Autocomplete dropdown — keep above Elementor stacking contexts. */
.pac-container {
    z-index: 1000000 !important;
}
