/* ----------------------------------------------------
   Premium Calculator System - Fixed & Optimized
   ---------------------------------------------------- */

#calculator {
    position: relative;
    z-index: 10;
}

/* 1. Calculator Container (Glass Card) */
.glass-calculator-card {
    background: rgba(22, 17, 13, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: visible;
    /* Changed to visible for dropdowns */
    position: relative;
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .glass-calculator-card {
        flex-direction: row;
        min-height: 550px;
    }
}

/* 2. Left Panel: Configurator */
.calc-config-panel {
    flex: 1;
    padding: 32px;
    position: relative;
    z-index: 20;
    /* Higher than estimate panel */
}

.calc-section-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    color: #fff;
}

.calc-icon-circle {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: rgba(123, 79, 42, 0.15);
    border: 1px solid rgba(123, 79, 42, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wood);
    box-shadow: 0 0 15px rgba(123, 79, 42, 0.15);
}

/* 3. Right Panel: Estimate Display */
.calc-estimate-panel {
    width: 100%;
    background: #0f0c0a;
    position: relative;
    overflow: hidden;
    padding: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 10;
}

@media (min-width: 1024px) {
    .calc-estimate-panel {
        width: 380px;
        flex-shrink: 0;
        border-top: none;
        border-left: 1px solid rgba(255, 255, 255, 0.05);
    }
}

/* Decorative Background in Estimate Panel */
.calc-estimate-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    background: var(--wood);
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.08;
    pointer-events: none;
    animation: pulseSlow 5s infinite alternate;
}

@keyframes pulseSlow {
    0% {
        opacity: 0.05;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0.12;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* 4. Field System (Floating Labels) */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 640px) {
    .calc-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px 20px;
    }
}

@media (min-width: 1024px) {
    .calc-grid.columns-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.calc-field-group {
    position: relative;
    margin-bottom: 0;
    /* Handled by grid gap */
}

/* Input Box Container */
.calc-input-box {
    position: relative;
    width: 100%;
    min-height: 56px;
    /* Changed from fixed height */
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.calc-input-box:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.calc-input-box:focus-within {
    border-color: var(--wood);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 1px var(--wood), inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

/* Icon */
.calc-input-icon {
    width: 24px;
    height: 24px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    transition: color 0.3s;
}

.calc-input-box:focus-within .calc-input-icon {
    color: var(--wood);
}

/* Floating Label */
.calc-floating-label {
    position: absolute;
    left: 52px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: #9ca3af;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left top;
    z-index: 10;
}

/* Animate Label */
.calc-input:focus~.calc-floating-label,
.calc-input:not(:placeholder-shown)~.calc-floating-label,
.calc-select-wrapper.has-value .calc-floating-label {
    transform: translateY(-14px) scale(0.75);
    color: var(--wood);
    top: 36%;
}

/* Input Field */
.calc-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    width: 100%;
    height: 100%;
    font-size: 1.1rem;
    font-weight: 500;
    padding-top: 16px;
    padding-bottom: 2px;
    font-family: inherit;
    z-index: 5;
    -webkit-appearance: none;
    appearance: none;
}

.calc-input::placeholder {
    color: transparent;
}

/* Unit Toggle */
.calc-unit-group {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 3px;
    margin-left: 8px;
    flex-shrink: 0;
}

.calc-unit-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.calc-unit-btn.active {
    background: var(--wood);
    color: #1a1a1a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.calc-unit-btn:hover:not(.active) {
    color: #d1d5db;
}

/* 5. Dropdowns (Fixed Overlap) */
.calc-select-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 16px;
    z-index: 10;
}

.calc-select-wrapper.open {
    z-index: 9999;
}

/* Arrow */
.calc-select-trigger .arrow,
.calc-arrow {
    transition: transform 0.3s;
    color: #6b7280;
}

.calc-select-wrapper.open .arrow,
.calc-select-wrapper.open .calc-arrow {
    transform: rotate(180deg);
    color: var(--wood);
}

/* Dropdown Menu */
.calc-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #1a1614;
    /* Solid background */
    border: 1px solid rgba(123, 79, 42, 0.3);
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 320px;
    overflow-y: auto;
}

.calc-select-wrapper.open .calc-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.calc-option {
    padding: 14px 16px;
    cursor: pointer;
    color: #d1d5db;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.1s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
}

.calc-option:hover {
    background: rgba(123, 79, 42, 0.2);
    color: white;
}

.calc-option.selected {
    color: var(--wood);
    background: rgba(123, 79, 42, 0.1);
    font-weight: 600;
}

/* 6. Helper & Error Messages */
.calc-message-area {
    position: absolute;
    bottom: -20px;
    left: 4px;
    right: 4px;
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    pointer-events: none;
}

.calc-error {
    color: #ef4444;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s;
    font-weight: 500;
}

.calc-input-box.invalid {
    border-color: #ef4444;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

.calc-input-box.invalid~.calc-message-area .calc-error {
    opacity: 1;
    transform: translateY(0);
}

.calc-helper-text {
    color: #6b7280;
    font-family: monospace;
    opacity: 0.8;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* 7. Estimate Output */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(123, 79, 42, 0.15);
    border: 1px solid rgba(123, 79, 42, 0.3);
    color: var(--wood);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 100px;
    margin-bottom: 24px;
    letter-spacing: 0.1em;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--wood);
    box-shadow: 0 0 10px var(--wood);
    animation: pulseRed 2s infinite;
}

.price-display {
    font-size: 3.5rem;
    line-height: 1;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

@media (min-width: 1280px) {
    .price-display {
        font-size: 4rem;
    }
}

.currency-symbol {
    font-size: 2rem;
    margin-top: 8px;
    font-weight: 500;
    color: #9ca3af;
}

.breakdown-list {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #9ca3af;
}

.breakdown-row span:last-child {
    color: white;
    font-weight: 500;
}

.trust-row {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    padding-top: 32px;
}

.trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #6b7280;
    text-align: center;
    letter-spacing: 0.05em;
}

/* Animations */
.calc-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.calc-reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.calc-input:invalid {
    border-color: #ef4444;
}