/* Disable ALL scroll behaviors that might cause jumping */
html, body, * {
    scroll-behavior: auto !important;
}

/* Prevent focus from causing scroll */
*:focus {
    scroll-margin: 0 !important;
    scroll-padding: 0 !important;
}

/* Price Calculator Frontend Styles */

.price-calculator-wrapper {
    max-width: 900px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    scroll-behavior: auto !important;
}

/* Prevent ALL calculator elements from causing scroll on focus */
.price-calculator-wrapper *:focus {
    outline-offset: -2px;
    scroll-margin: 0 !important;
    scroll-padding: 0 !important;
}

/* Force all inputs to not scroll into view on focus */
.price-calculator-wrapper input:focus,
.price-calculator-wrapper button:focus,
.price-calculator-wrapper label:focus {
    scroll-margin-top: 0 !important;
    scroll-margin-bottom: 0 !important;
}

/* Prevent label clicks from causing any visual jumps */
.choice-label {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* Hide inputs completely to prevent focus-based scrolling */
.choice-item input[type="radio"],
.choice-item input[type="checkbox"] {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.price-calculator-progress {
    margin-bottom: 40px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #ffa800;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin: 0;
}

.calculator-step {
    /* Remove animation to prevent any jumping */
}

.step-title {
    font-size: 28px;
    margin-bottom: 30px;
    color: #000000 !important;
    text-align: center;
}

/* Form Fields - 2x2 Grid Layout */
.form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 30px;
    max-width: 900px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    min-height: 24px;
}

.form-group .required {
    color: #d63638;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #2271b1;
}

/* Choices Grid */
.choice-item {
    position: relative;
    width: 100%;
    /* No transitions to prevent jumping */
}

/* Stabilize choice grid to prevent reflow when items hide/show */
.choices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    min-height: 280px; /* Prevent layout shift */
}

/* Prevent layout shift when showing/hiding elements */
.choice-item[style*="display: none"] {
    display: none !important;
}

.choice-label {
    display: block;
    padding: 0;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    position: relative;
    overflow: hidden;
    height: 250px;
    min-height: 250px;
    max-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.choice-label:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.choice-item input:checked + .choice-label {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border-color: #2271b1;
}

.choice-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    border-radius: 12px;
}

.choice-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.choice-content {
    text-align: center;
    padding: 15px;
}

.choice-title {
    display: none;
    font-size: 18px;
    margin: 0;
    color: #333;
}

.choice-subtitle {
    font-size: 13px;
    margin: 5px 0 0 0;
    line-height: 1.3;
    opacity: 0.85;
    display: none;
}

.choice-content-centered .choice-subtitle {
    display: block !important;
    font-size: 12px;
    margin-top: 5px;
}

.choice-price {
    display: inline-block;
    padding: 6px 12px;
    background: #2271b1;
    color: white;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    margin-top: 8px;
}

.choice-checkmark {
    display: none !important;
}

/* Choice icon styling */
.choice-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1;
    flex-shrink: 0;
}

/* Styled choice label (when using icon instead of image) */
.choice-label-styled {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 250px !important;
    min-height: 250px !important;
    max-height: 250px !important;
    padding: 40px 20px !important;
    box-sizing: border-box;
    border-width: 3px !important;
    border-style: solid !important;
}

/* Center content when using styled icon */
.choice-content-centered {
    text-align: center;
    width: 100%;
    margin-top: 0;
    padding: 0;
    flex-shrink: 0;
}

.choice-content-centered .choice-title {
    display: block !important;
    margin: 0 0 10px 0 !important;
    font-size: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.choice-content-centered .choice-price {
    display: block;
    margin-top: 8px;
}

/* Ensure checkmark uses the icon color on styled choices */
.choice-item input:checked + .choice-label-styled {
    opacity: 1;
}

.choice-label-styled {
    position: relative;
}

/* Ensure unchecked choices don't show selected state */
.choice-item input:not(:checked) + .choice-label {
    border-color: #e0e0e0;
}

.choice-item input:not(:checked) + .choice-label .choice-checkmark {
    opacity: 0;
}

/* Navigation Buttons */
.calculator-navigation {
    display: flex;
    justify-content: flex-end;
    margin-top: 40px;
    gap: 15px;
}

.btn {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 0 0 auto;
    max-width: 200px;
}

.btn-back {
    background: #f0f0f0;
    color: #333;
}

.btn-next,
.btn-submit {
    background: #000000;
    color: white;
}

.btn-back:hover {
    background: #e0e0e0;
}

.btn-next:hover,
.btn-submit:hover {
    background: #ffa800;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 168, 0, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Hide only the Next button on single-choice steps, keep Back button */
.calculator-step:not(:has(.form-fields)) .btn-next {
    display: none;
}

/* Price Display */
.price-display {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2271b1;
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 200px;
}

.current-price {
    text-align: center;
}

.price-label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
    opacity: 0.9;
}

.price-value {
    font-size: 32px;
    font-weight: bold;
    display: inline-block;
}

.price-currency {
    font-size: 18px;
    margin-left: 5px;
}

.price-update {
    animation: priceUpdate 0.3s ease;
}

@keyframes priceUpdate {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Loading State */
.calculator-loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Result State */
.calculator-result {
    text-align: center;
    padding: 60px 20px;
}

.result-content h2 {
    color: #000000 !important;
    font-size: 32px;
    margin-bottom: 20px;
}

.result-message {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

/* Hide the empty price box on success page */
.estimated-price {
    display: none !important;
}

/* Hide price display when prices are disabled */
body.price-calc-hide-prices .price-display {
    display: none !important;
}

/* Hide total price display when disabled */
body.price-calc-hide-total .price-display {
    display: none !important;
}

/* Hide step progress text when disabled */
body.price-calc-hide-progress-text .progress-text {
    display: none !important;
}

/* Make title visible when hidden by CSS */
.choice-title:not([style*="display: none"]) {
    display: block !important;
    margin-bottom: 10px;
}

/* GDPR Acceptance Styling */
.gdpr-acceptance {
    margin: 30px 0 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.gdpr-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    gap: 12px;
}

.gdpr-label input[type="checkbox"] {
    margin-top: 4px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.gdpr-text {
    font-size: 15px;
    line-height: 1.5;
    color: #333;
}

.gdpr-text .required {
    color: #d63638;
}

/* ============================================
   RESPONSIVE FIXES FOR NARROW CONTAINERS
   ============================================ */

/* DIVI COLUMN DETECTION - Works at ALL screen sizes */
/* Target when inside ANY Divi column (no media query wrapper) */
.et_pb_column_1_2 .price-calculator-wrapper,
.et_pb_column_1_3 .price-calculator-wrapper,
.et_pb_column_2_3 .price-calculator-wrapper,
.et_pb_column_1_4 .price-calculator-wrapper,
.et_pb_column_3_4 .price-calculator-wrapper {
    max-width: 100% !important;
    padding: 20px !important;
    margin: 20px auto !important;
}

.et_pb_column_1_2 .choices-grid,
.et_pb_column_1_3 .choices-grid,
.et_pb_column_2_3 .choices-grid,
.et_pb_column_1_4 .choices-grid,
.et_pb_column_3_4 .choices-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
    min-height: auto !important;
}

/* SMALLER BOXES for Divi columns - applies at ALL screen sizes */
.et_pb_column_1_2 .choice-label,
.et_pb_column_1_3 .choice-label,
.et_pb_column_2_3 .choice-label,
.et_pb_column_1_4 .choice-label,
.et_pb_column_3_4 .choice-label {
    height: 160px !important;
    min-height: 160px !important;
    max-height: 160px !important;
}

.et_pb_column_1_2 .choice-label-styled,
.et_pb_column_1_3 .choice-label-styled,
.et_pb_column_2_3 .choice-label-styled,
.et_pb_column_1_4 .choice-label-styled,
.et_pb_column_3_4 .choice-label-styled {
    height: 160px !important;
    min-height: 160px !important;
    max-height: 160px !important;
    padding: 25px 15px !important;
}

.et_pb_column_1_2 .choice-image,
.et_pb_column_1_3 .choice-image,
.et_pb_column_2_3 .choice-image,
.et_pb_column_1_4 .choice-image,
.et_pb_column_3_4 .choice-image {
    height: 160px !important;
}

.et_pb_column_1_2 .choice-icon,
.et_pb_column_1_3 .choice-icon,
.et_pb_column_2_3 .choice-icon,
.et_pb_column_1_4 .choice-icon,
.et_pb_column_3_4 .choice-icon {
    font-size: 36px !important;
    margin-bottom: 12px !important;
}

.et_pb_column_1_2 .choice-content-centered .choice-title,
.et_pb_column_1_3 .choice-content-centered .choice-title,
.et_pb_column_2_3 .choice-content-centered .choice-title,
.et_pb_column_1_4 .choice-content-centered .choice-title,
.et_pb_column_3_4 .choice-content-centered .choice-title {
    font-size: 16px !important;
    margin: 0 0 8px 0 !important;
}

.et_pb_column_1_2 .choice-subtitle,
.et_pb_column_1_3 .choice-subtitle,
.et_pb_column_2_3 .choice-subtitle,
.et_pb_column_1_4 .choice-subtitle,
.et_pb_column_3_4 .choice-subtitle {
    font-size: 11px !important;
}

.et_pb_column_1_2 .step-title,
.et_pb_column_1_3 .step-title,
.et_pb_column_2_3 .step-title,
.et_pb_column_1_4 .step-title,
.et_pb_column_3_4 .step-title {
    font-size: 22px !important;
    margin-bottom: 20px !important;
}

.et_pb_column_1_2 .form-fields,
.et_pb_column_1_3 .form-fields,
.et_pb_column_2_3 .form-fields,
.et_pb_column_1_4 .form-fields,
.et_pb_column_3_4 .form-fields {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
}

.et_pb_column_1_2 .btn,
.et_pb_column_1_3 .btn,
.et_pb_column_2_3 .btn,
.et_pb_column_1_4 .btn,
.et_pb_column_3_4 .btn {
    padding: 12px 24px !important;
    font-size: 15px !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .price-calculator-wrapper {
        padding: 20px;
        margin: 20px;
    }
    
    .choices-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Reduce choice box height on mobile */
    .choice-label {
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
    }
    
    .choice-label-styled {
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
        padding: 20px 15px !important;
    }
    
    .choice-image {
        height: 120px;
    }
    
    .choice-icon {
        font-size: 32px;
        margin-bottom: 10px;
    }
    
    .choice-content-centered .choice-title {
        font-size: 16px !important;
    }
    
    .form-fields {
        grid-template-columns: 1fr;
    }
    
    .step-title {
        font-size: 24px;
    }
    
    .price-display {
        position: relative;
        bottom: auto;
        right: auto;
        margin: 30px auto 0;
        max-width: 300px;
    }
    
    /* CENTER ALL NAVIGATION BUTTONS ON MOBILE */
    .calculator-navigation {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 15px;
        margin-top: 40px;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
        flex: 0 0 auto;
        text-align: center;
    }
    
    .btn-back,
    .btn-next,
    .btn-submit {
        width: 100%;
        max-width: 280px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .choice-label {
        height: 140px !important;
        min-height: 140px !important;
        max-height: 140px !important;
    }
    
    .choice-label-styled {
        height: 140px !important;
        min-height: 140px !important;
        max-height: 140px !important;
        padding: 20px 12px !important;
    }
    
    .choice-image {
        height: 140px !important;
    }
    
    .choice-icon {
        font-size: 28px !important;
        margin-bottom: 8px !important;
    }
    
    .choice-content-centered .choice-title {
        font-size: 14px !important;
        margin: 0 0 5px 0 !important;
    }
    
    .step-title {
        font-size: 20px !important;
    }
}