/* Calculator Page Styles */

.calc-title-bar {
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    padding: 12px 30px;
    margin-bottom: 15px;
}

.calc-title-bar h1 {
    font-family: 'CrystalBetUni';
    font-weight: bold;
    font-size: 15px;
    color: #181b1f;
    margin: 0;
}

.calc-content-area {
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    padding: 30px;
    min-height: 500px;
}

/* Tabs */
.calc-tabs {
    display: flex;
    align-items: center;
    gap: 40px;
    border-bottom: 1px solid #e6e6e6;
    margin-bottom: 30px;
    position: relative;
}

.calc-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.calc-tab .tab-label {
    font-family: 'CrystalBetUni';
    font-weight: bold;
    font-size: 18px;
    color: #181b1f;
}

.calc-tab:not(.active) .tab-label {
    font-weight: 500;
    opacity: 0.8;
}

.calc-tab .tab-icon {
    height: 18px;
    opacity: 0.5;
}

.calc-tab.active .tab-icon {
    opacity: 1;
}

.calc-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 4px;
    background: transparent;
    border-radius: 50px;
}

.calc-tab.active::after {
    background: #181b1f;
}

/* Form Layout */
.calc-form-area {
    display: flex;
    gap: 40px;
}

.calc-form-left {
    flex: 1;
    min-width: 0;
}

.calc-form-right {
    width: 412px;
    flex-shrink: 0;
}

/* Section Labels */
.calc-section-label {
    font-family: 'CrystalNU4';
    font-weight: normal;
    font-size: 14px;
    color: #686c71;
    margin-bottom: 12px;
    display: block;
}

/* Info icon + tooltip */
.calc-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #686c71;
    color: #fff;
    font-family: 'CrystalBetUni';
    font-size: 10px;
    font-style: italic;
    line-height: 1;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
}

.calc-info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #303438;
    color: #fff;
    font-family: 'CrystalNU4';
    font-style: normal;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.4;
    padding: 10px 14px;
    border-radius: 10px;
    width: 260px;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 50;
}

.calc-info-icon:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Toggle Buttons */
.calc-toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}

.calc-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    height: 54px;
    padding: 0 28px;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.1);
    background: transparent;
    font-family: 'CrystalNU4';
    font-weight: normal;
    font-size: 15px;
    color: #181b1f;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background-color 0.15s;
    white-space: nowrap;
}

.calc-toggle-btn:hover {
    border-color: rgba(0,0,0,0.25);
}

.calc-toggle-btn.active {
    border-color: #ffe100;
    background: #f5f5f5;
}

.calc-toggle-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Dropdowns */
.calc-dropdowns-row {
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
}

.calc-dropdown-group {
    flex: 1;
    min-width: 0;
}

.calc-select-wrap {
    position: relative;
}

.calc-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 54px;
    padding: 0 40px 0 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 16px;
    background: transparent;
    font-family: 'CrystalNU4';
    font-weight: normal;
    font-size: 15px;
    color: #181b1f;
    cursor: pointer;
    outline: none;
}

.calc-select:focus {
    border-color: rgba(0,0,0,0.3);
}

.calc-select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 11px;
    height: 6px;
    pointer-events: none;
}

.calc-select-arrow svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Disabled field (e.g. engine when electric) */
.calc-field-disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Custom Dropdown */
.calc-custom-select {
    position: relative;
}

.calc-custom-select .calc-select {
    display: none;
}

.calc-cs-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 16px;
    background: transparent;
    font-family: 'CrystalNU4';
    font-weight: normal;
    font-size: 15px;
    color: #181b1f;
    cursor: pointer;
    user-select: none;
}

.calc-cs-trigger.open {
    border-color: rgba(0,0,0,0.3);
}

.calc-cs-trigger-arrow {
    width: 11px;
    height: 6px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.calc-cs-trigger.open .calc-cs-trigger-arrow {
    transform: rotate(180deg);
}

.calc-cs-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 16px;
    padding: 6px 0;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.calc-cs-dropdown.open {
    display: block;
}

/* Custom thin scrollbar */
.calc-cs-dropdown::-webkit-scrollbar {
    width: 4px;
}

.calc-cs-dropdown::-webkit-scrollbar-track {
    background: transparent;
    margin: 10px 0;
}

.calc-cs-dropdown::-webkit-scrollbar-thumb {
    background: #303438;
    border-radius: 2px;
}

.calc-cs-dropdown {
    scrollbar-width: thin;
    scrollbar-color: #303438 transparent;
}

.calc-cs-option {
    padding: 8px 16px;
    font-family: 'CrystalNU4';
    font-weight: normal;
    font-size: 15px;
    color: #181b1f;
    cursor: pointer;
    user-select: none;
}

.calc-cs-option:hover {
    background: #f5f5f5;
}

.calc-cs-option.selected {
    font-weight: bold;
}

@media (max-width: 991px) {
    .calc-cs-trigger {
        height: 44px;
    }
}

/* Number Input (for moto engine cc) */
.calc-number-input {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 16px;
    background: transparent;
    font-family: 'CrystalNU4';
    font-weight: normal;
    font-size: 15px;
    color: #181b1f;
    outline: none;
}

.calc-number-input:focus {
    border-color: rgba(0,0,0,0.3);
}

/* Results Card (Desktop) */
.calc-results-card {
    background: #fff;
    border-radius: 34px;
    box-shadow: 0px 4px 18px 10px rgba(0,0,0,0.06);
    padding: 30px;
}

.calc-results-title {
    font-family: 'CrystalNU4';
    font-weight: normal;
    font-size: 15px;
    color: #181b1f;
    margin-bottom: 8px;
}

.calc-results-total {
    font-family: 'CrystalBetUni';
    font-weight: bold;
    font-size: 40px;
    color: #181b1f;
    margin-bottom: 16px;
    line-height: 1.2;
}

/* Result Line Items */
.calc-result-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.calc-result-item-label {
    font-family: 'CrystalNU4';
    font-weight: normal;
    font-size: 15px;
    color: #181b1f;
}

.calc-result-item-value {
    font-family: 'CrystalBetUni';
    font-weight: bold;
    font-size: 20px;
    color: #181b1f;
    white-space: nowrap;
    margin-left: 16px;
}

.calc-results-divider {
    border: none;
    border-top: 1px solid #e6e6e6;
    margin: 20px 0;
}

/* Tab Panels */
.calc-tab-panel {
    display: none;
}

.calc-tab-panel.active {
    display: block;
}

/* ===== MOBILE BOTTOM PANEL ===== */

/* Hidden on desktop */
.calc-mobile-bottom {
    display: none;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 991px) {
    .calc-content-area {
        padding: 16px;
        padding-bottom: 100px; /* space for mobile bottom bar */
    }

    .calc-form-area {
        flex-direction: column;
        gap: 24px;
    }

    /* Hide desktop results card on mobile */
    .calc-form-right {
        display: none !important;
    }

    /* Show mobile bottom panel */
    .calc-mobile-bottom {
        display: block;
    }

    .calc-toggle-btn {
        height: 44px;
        padding: 0 16px;
        font-size: 12px;
        min-width: 80px;
    }

    .calc-select {
        height: 44px;
    }

    .calc-number-input {
        height: 44px;
    }

    .calc-dropdowns-row {
        flex-direction: column;
        gap: 16px;
    }

    .calc-section-label {
        font-size: 12px;
    }

    /* Mobile tabs: icons only, no text */
    .calc-tab .tab-label {
        display: none;
    }

    .calc-tabs {
        gap: 0;
    }

    .calc-tab {
        flex: 1;
        justify-content: center;
        padding-bottom: 10px;
    }

    .calc-tab .tab-icon {
        height: 18px;
    }
}

@media (max-width: 575px) {
    .calc-title-bar {
        padding: 12px 16px;
    }

    .calc-content-area {
        padding: 12px;
        padding-bottom: 100px;
    }

    .calc-toggle-group {
        gap: 8px;
    }

    .calc-toggle-btn {
        min-width: 70px;
        padding: 0 12px;
    }
}

/* ===== MOBILE BOTTOM PANEL (Single element: collapses/expands) ===== */

.calc-mob-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1060;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.calc-mob-overlay.open {
    opacity: 1;
    visibility: visible;
}

.calc-mob-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1070;
    background: #fff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    padding: 20px 24px;
    transition: transform 0.3s ease;
}

/* --- Collapsed header row (always visible) --- */

.calc-mob-header {
    display: flex;
    align-items: center;
    gap: 12px;
    touch-action: manipulation;
}

.calc-mob-header-label {
    font-family: 'CrystalNU4';
    font-weight: normal;
    font-size: 14px;
    color: #181b1f;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.calc-mob-header-total {
    font-family: 'CrystalBetUni';
    font-weight: bold;
    font-size: 28px;
    color: #181b1f;
    line-height: 1.2;
    white-space: nowrap;
    flex-shrink: 0;
}

.calc-mob-toggle-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f5f5f5;
    border: 1px solid #e6e6e6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.calc-mob-toggle-btn svg {
    width: 11px;
    height: 6px;
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

/* --- Expand/collapse via max-height on details --- */

.calc-mob-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.calc-mob-panel .calc-mob-header {
    max-height: 80px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.25s ease 0.05s, opacity 0.15s ease;
}

.calc-mob-panel.open .calc-mob-header {
    max-height: 0;
    opacity: 0;
    transition: max-height 0.15s ease, opacity 0.1s ease;
}

.calc-mob-panel.open .calc-mob-details {
    max-height: 600px;
    overflow: visible;
}

/* Dragging class — disables ALL transitions during finger tracking */
.calc-mob-panel.dragging,
.calc-mob-panel.dragging * {
    transition: none !important;
}


/* --- Details content styling --- */

.calc-mob-close-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    margin-bottom: 12px;
}

.calc-mob-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f5f5f5;
    border: 1px solid #e6e6e6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.calc-mob-close-btn svg {
    width: 12px;
    height: 12px;
}

.calc-mob-details .calc-result-item {
    margin-bottom: 12px;
}

.calc-mob-details .calc-result-item-label {
    font-size: 14px;
    flex-shrink: 1;
    min-width: 0;
}

.calc-mob-details .calc-result-item-value {
    font-size: 20px;
    text-align: right;
}

.calc-mob-details .calc-results-divider {
    margin: 16px 0;
}

.calc-mob-details .calc-mob-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calc-mob-footer-label {
    font-family: 'CrystalNU4';
    font-weight: normal;
    font-size: 14px;
    color: #181b1f;
    max-width: 140px;
    line-height: 1.3;
}

.calc-mob-footer-total {
    font-family: 'CrystalBetUni';
    font-weight: bold;
    font-size: 28px;
    color: #181b1f;
}

