/**
 * Home Questionnaire Popup Styles
 */

/* Popup Overlay & Container */
.hq-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

/* Hide GHL chat widget when popup is open */
.hq-popup:not([style*="display: none"]) ~ #lc_text-widget--btn,
body:has(.hq-popup:not([style*="display: none"])) #lc_text-widget--btn {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.hq-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.hq-popup-container {
    position: relative;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    background: white;
    border-radius: 20px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Progress Bar with Step Indicator */
.hq-progress-bar {
    height: 10px;
    background: #e5e5e5;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hq-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #00a651 0%, #00c961 100%);
    width: 0%;
    transition: width 0.5s ease;
}

.hq-step-text {
    position: relative;
    z-index: 1;
    font-size: 10px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    mix-blend-mode: difference;
    filter: invert(1);
}

/* Header */
.hq-popup-header {
    display: grid;
    grid-template-columns: 0.5fr 2fr 0.5fr;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
    background: white;
    gap: 10px;
}

.hq-header-left {
    display: flex;
    justify-content: flex-start;
}

.hq-header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.hq-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.hq-popup-logo {
    height: 20px;
    display: block;
    flex-shrink: 0;
}

.hq-popup-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #333;
    white-space: normal;
    line-height: 1.3;
}

.hq-header-left .mhf-btn-back {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #00a651;
    transition: color 0.2s;
    padding: 0;
    width: 32px;
    height: 32px;
}

.hq-header-left .mhf-btn-back:hover {
    color: #008040;
}

.hq-close {
    background: transparent;
    border: none;
    font-size: 54px;
    line-height: 0;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    padding: 0;
    width: 32px;
    height: 32px;
}

.hq-close:hover {
    color: #e74c3c;
}

/* Restart Dropdown Menu */
.mhf-restart-wrapper {
    position: relative;
    display: inline-block;
}

.mhf-restart {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    transition: all 0.2s;
    padding: 0;
    width: 32px;
    height: 32px;
}

.mhf-restart:hover {
    color: #00a651;
    transform: rotate(-30deg);
}

.mhf-restart-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 10000;
}

.mhf-restart-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mhf-restart-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
}

.mhf-restart-menu-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.mhf-restart-menu-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.mhf-restart-menu-item:hover {
    background: #f8f9fa;
}

.mhf-restart-menu-item.danger:hover {
    background: #fee;
    color: #c00;
}

/* Content */
.hq-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.hq-slide {
    display: none;
    animation: hqFadeIn 0.5s ease;
}

.hq-slide.hq-slide-active {
    display: block;
}

@keyframes hqFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hq-step-indicator {
    display: none;
}

.hq-slide h3 {
    color: #333;
    font-size: 26px;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.hq-subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 16px;
}

/* Option Cards */
.hq-option-grid {
    display: grid;
    gap: 15px;
    margin-bottom: 30px;
}

.hq-option-card {
    padding: 15px;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.hq-option-card:hover {
    border-color: #00a651;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 166, 81, 0.2);
}

.hq-option-card.selected {
    border-color: #00a651;
    background: #f0f8f4;
}

.hq-option-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.hq-option-icon {
    font-size: 24px;
    margin-right: 12px;
}

.hq-option-title {
    font-weight: 600;
    font-size: 18px;
    color: #333;
    margin-top: 8px;
}

.hq-option-description {
    color: #666;
    font-size: 15px;
    margin-left: 36px;
    line-height: 1.5;
}

/* Form Elements */
.hq-form-group {
    margin-bottom: 25px;
}

.hq-form-group label {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-weight: 600;
    font-size: 18px;
}

.hq-input {
    width: 100%;
    padding: 14px 18px !important;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    font-size: 18px !important;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.hq-input:focus {
    outline: none;
    border-color: #00a651;
}

/* Range Slider */
.hq-range-slider {
    width: 100%;
    margin: 15px 0;
    cursor: pointer;
    height: 6px;
    border-radius: 3px;
    background: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    --slider-percentage: 0%;
    padding: 15px 0;
}

.hq-range-slider:focus {
    outline: none;
    box-shadow: none;
}

.hq-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #888;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    margin-top: -13px;
    z-index: 10;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.hq-range-slider::-moz-range-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #888;
    cursor: grab;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.hq-range-slider.touched::-webkit-slider-thumb,
.hq-range-slider:active::-webkit-slider-thumb {
    background: #00a651;
    box-shadow: 0 2px 10px rgba(0, 166, 81, 0.5);
}

.hq-range-slider.touched::-moz-range-thumb,
.hq-range-slider:active::-moz-range-thumb {
    background: #00a651;
    box-shadow: 0 2px 10px rgba(0, 166, 81, 0.5);
}

.hq-range-slider:active::-webkit-slider-thumb {
    cursor: grabbing;
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.6);
}

.hq-range-slider:active::-moz-range-thumb {
    cursor: grabbing;
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.6);
}

.hq-range-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(to right, #00a651 0%, #00a651 var(--slider-percentage, 0%), #e0e0e0 var(--slider-percentage, 0%), #e0e0e0 100%);
    border-radius: 3px;
}

.hq-range-slider::-moz-range-track {
    height: 6px;
    background: linear-gradient(to right, #00a651 0%, #00a651 var(--slider-percentage, 0%), #e0e0e0 var(--slider-percentage, 0%), #e0e0e0 100%);
    border-radius: 3px;
}

.hq-budget-display {
    font-size: 36px;
    color: #00a651;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
}

.hq-range-labels {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}

/* Checkbox Grid */
.hq-checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
}

.hq-checkbox-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.hq-checkbox-item:hover {
    background: #f9f9f9;
    border-color: #00a651;
}

.hq-checkbox-item input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.hq-checkbox-item span {
    font-size: 15px;
    color: #333;
}

/* Insight Box */
.hq-insight-box {
    background: #f0f8f4;
    border-left: 4px solid #00a651;
    padding: 20px;
    margin: 25px 0;
    border-radius: 8px;
}

.hq-insight-box h4 {
    color: #00a651;
    font-size: 16px;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.hq-insight-box p {
    color: #555;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

/* Warning Box */
.hq-warning-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin: 20px 0;
    border-radius: 8px;
}

.hq-warning-box strong {
    color: #856404;
}

/* Estimate Summary */
.hq-estimate-summary {
    display: grid;
    gap: 20px;
    margin: 30px 0;
}

.hq-estimate-card {
    background: white;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.hq-estimate-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.hq-estimate-card.hq-estimate-total {
    background: linear-gradient(135deg, #00a651 0%, #00c961 100%);
    border-color: #00a651;
}

.hq-estimate-card.hq-estimate-total .hq-estimate-label,
.hq-estimate-card.hq-estimate-total .hq-estimate-value {
    color: white;
}

.hq-estimate-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.hq-estimate-label {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.hq-estimate-value {
    font-size: 32px;
    color: #00a651;
    font-weight: bold;
}

/* Success Slide */
.hq-slide-success {
    text-align: center;
}

.hq-success-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

/* Footer */
.hq-popup-footer {
    padding: 20px 30px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    flex-shrink: 0;
    background: white;
}

.hq-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hq-btn-back {
    background: #f5f5f5;
    color: #666;
}

.hq-btn-back:hover {
    background: #e5e5e5;
}

.hq-btn-continue,
.hq-btn-primary {
    background: #00a651;
    color: white;
    flex: 1;
    transition: all 0.3s ease;
}

.hq-btn-continue:not(.hq-btn-disabled),
.hq-btn-primary:not(.hq-btn-disabled) {
    background: #00a651;
    color: white;
}

.hq-btn-continue:hover:not(.hq-btn-disabled),
.hq-btn-primary:hover:not(.hq-btn-disabled) {
    background: #008541;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 166, 81, 0.3);
}

.hq-btn-continue.hq-btn-disabled,
.hq-btn-primary.hq-btn-disabled {
    background: #cccccc !important;
    color: #888888 !important;
    cursor: not-allowed !important;
    opacity: 1;
}

.hq-btn-continue.hq-btn-disabled:hover,
.hq-btn-primary.hq-btn-disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .hq-popup {
        padding: 10px;
    }
    
    .hq-popup-container {
        width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .hq-popup-header {
        padding: 10px 15px;
        grid-template-columns: auto 1fr auto;
        gap: 8px;
    }
    
    /* Hide left column when back button is not visible */
    .hq-popup-header:has(.mhf-btn-back[style*="display: none"]) {
        grid-template-columns: 1fr auto;
    }
    
    .hq-popup-header:has(.mhf-btn-back[style*="display: none"]) .hq-header-left {
        display: none;
    }
    
    .hq-popup-header:has(.mhf-btn-back[style*="display: none"]) .hq-header-center {
        justify-content: flex-start;
    }
    
    .hq-popup-logo {
        height: 18px;
    }
    
    .hq-popup-header h2 {
        font-size: 16px;
        line-height: 1.2;
    }
    
    .hq-popup-content {
        padding: 20px;
    }
    
    .hq-slide h3 {
        font-size: 22px;
    }
    
    .hq-checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    .hq-popup-footer {
        padding: 15px 20px;
    }
    
    .hq-budget-display {
        font-size: 28px;
    }
}
