/* =========================================
   PREMIUM ESTIMATOR STYLES (v3.0)
   ========================================= */

/* Use Brand Fonts */
.estimator-app {
    font-family: 'Inter', sans-serif;
}

/* Override hover effect for the main estimator card */
#estimator-app.card:hover {
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border: 1px solid #e2e8f0 !important;
}

h1,
h2,
h3,
h4,
.price-tag,
.step-title {
    font-family: 'Outfit', sans-serif;
}

/* ===== 1. Progress Bar (Stepper) ===== */
.progress-container {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Connecting Line */
.progress-container::before {
    content: '';
    position: absolute;
    top: 15px;
    /* Half of circle height */
    left: 0;
    width: 100%;
    height: 3px;
    background: #e2e8f0;
    z-index: 0;
}

/* Progress Fill (Animated via JS width) */
.progress-fill {
    content: '';
    position: absolute;
    top: 15px;
    left: 0;
    height: 3px;
    background: #2563eb;
    z-index: 0;
    transition: width 0.4s ease;
}

.step-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    flex: 1;
}

/* The Circle */
.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

/* The Label */
.step-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #94a3b8;
    transition: color 0.3s ease;
    text-align: center;
}

/* Active State */
.step-item.active .step-circle {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.step-item.active .step-title {
    color: #2563eb;
    font-weight: 700;
}

/* Completed State */
.step-item.completed .step-circle {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.step-item.completed .step-title {
    color: #0f172a;
}

/* Premium Price Badge */
.premium-price-badge {
    background-color: #eff6ff;
    /* blue-50 */
    color: #2563eb;
    /* blue-600 */
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.95rem;
    /* Standardized size */
    display: inline-block;
    border: 1px solid #dbeafe;
}

/* ERROR STATE (Validation Feedback) */
.step-item.error .step-circle {
    border-color: #ef4444 !important;
    /* Red-500 */
    color: #ef4444 !important;
    background: #fef2f2 !important;
    /* Red-50 */
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

.step-item.error .step-title {
    color: #ef4444 !important;
    font-weight: 600;
}

@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);
    }
}

/* ===== 2. Premium Add-on Cards ===== */
.addon-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Hover Effect */
.addon-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

/* SELECTED STATE (Critical for Intuition) */
.addon-card.selected {
    background-color: #eff6ff;
    /* Light Blue BG */
    border-color: #2563eb;
    /* Blue Border */
    box-shadow: 0 0 0 1px #2563eb;
    /* Extra definition */
}

/* Checkbox (Hidden via basic appearance, replaced by custom) */
.custom-checkbox {
    appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

/* Selected State - only for the CHECKED input, not just because parent is selected */
.custom-checkbox:checked {
    background: #2563eb;
    border-color: #2563eb;
}

.custom-checkbox:checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

/* Content Layout */
.addon-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.2rem;
}

/* Apply same Gap to Sub-addons (so Main and Sub are identical) */
.sub-addon-item>.flex {
    gap: 0.2rem;
}

.addon-info {
    flex: 1;
}

.addon-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.addon-price {
    font-weight: 600;
    color: #2563eb;
    font-size: 0.95rem;
    /* Standardized size */
    background: #eff6ff;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    /* Match badge pill shape */
    display: inline-block;
}

/* Unified Description Styling */
.addon-desc,
.sub-addon-item p {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    /* Slightly smaller as requested */
    color: #64748b;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* Initially hide main desc, sub-desc is managed by HTML structure/classes */
.addon-desc {
    display: none;
}

/* Sub-Addon Title - Global Tweak */
.sub-addon-item label {
    font-size: 0.95rem;
    /* Smaller than main title */
    font-weight: 600;
    /* Bold */
    line-height: 1.25;
    /* Tighter spacing */
    color: #334155;
    display: block;
    /* Ensure block for consistent spacing */
    margin-bottom: 0.25rem;
}

/* Show description when card is selected */
.addon-card.selected .addon-desc {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ===== 3. Modern Inputs ===== */
.estimator-input,
.estimator-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 1rem;
    color: #1e293b;
    background: #fff;
    transition: all 0.2s;
    outline: none;
}

.estimator-input:focus,
.estimator-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #334155;
    font-size: 0.95rem;
}

/* ERROR STATE FOR INPUTS */
.estimator-input.input-error,
.estimator-select.input-error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

/* ===== 4. Helper Classes ===== */
.hidden {
    display: none !important;
}

.step-content {
    display: none;
}

.step-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Price Summary Box - Premium "Surprise Me" Style */
.price-summary {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    /* Soft Blue Gradient */
    border: 1px solid #bfdbfe;
    /* Blue-200 */
    border-radius: 1rem;
    padding: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 3rem;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.15), 0 8px 10px -6px rgba(37, 99, 235, 0.1);
    /* Blue-tinted shadow */
    position: relative;
    overflow: hidden;
}

/* Optional: Add a subtle top highlight line */
.price-summary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
}

/* Enlarge text for better impact */
.price-summary .text-sm {
    font-size: 1.05rem !important;
    /* Larger Label */
}

.price-summary .text-3xl {
    font-size: 2.5rem !important;
    /* Larger Value */
}

.price-summary .text-xl {
    font-size: 1.5rem !important;
    /* Larger Value (Final Step) */
}

/* No overrides needed for light mode - standard text colors apply */

/* New Note Box (Site Condition Description) */
.note-box {
    background-color: #f1f5f9;
    border-left: 4px solid #3b82f6;
    /* Blue accent */
    color: #475569;
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    margin-top: 1rem;
    line-height: 1.5;
    display: none;
    /* Hidden by default, toggled by JS */
}

@media (min-width: 768px) {
    .price-summary {
        text-align: left;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* ===== Mobile Specifics ===== */
@media (max-width: 768px) {

    /* Mobile Layout Fix: Main Header */
    /* Checkbox + content must be side-by-side */
    .addon-header {
        flex-direction: row;
        align-items: flex-start;
    }

    /* The content area (Title/Badge + Price) */
    .addon-info {
        display: block;
        min-width: 0;
        /* CRITICAL: Prevent flex item from expanding beyond parent */
    }

    /* Inside addon-info: Title Group (Left) and Price Pill (Right) */
    .addon-info>div.flex {
        flex-direction: row;
        /* Side-by-side again */
        align-items: flex-start;
        width: 100%;
    }

    .addon-info .flex-col {
        /* Title Group (Title + Badge) */
        flex: 1;
        min-width: 0;
        /* CRITICAL: Allows text to wrap instead of overflowing container */
        margin-right: 0.2rem;
        /* Reduced from 0.5rem */
        width: auto;
    }

    .addon-title {
        font-size: 1rem;
        margin-bottom: 0.1rem;
        display: block;
        white-space: normal;
        /* Wrap text */
        line-height: 1.25;
        word-wrap: normal;
        word-break: normal;
        /* Don't split words mid-line */
        overflow-wrap: normal;
        /* Don't force break long words */
    }

    /* Price Pill - Always Top Right */
    .price-info-pill {
        flex-shrink: 0;
        /* Never shrink the price */
        margin-left: 0;
        align-self: flex-start;
        margin-top: 0;
        /* Remove pill styling on mobile to save space */
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        gap: 0.25rem !important;
    }

    .recommended-badge {
        display: inline-block;
        margin-top: 0;
        /* Tighten up spacing as requested */
    }

    .progress-container {
        margin-bottom: 2rem;
        padding: 0 0.5rem;
        /* Reduced outer padding */
    }

    .step-title {
        display: none;
        /* Hide step labels on mobile to save space */
    }

    /* Reduce card padding on mobile to maximize space */
    .addon-card {
        padding: 1rem 0.5rem;
        /* Further reduced from 0.75rem */
    }

    .card {
        padding: 1rem;
        /* Compact padding */
    }

    /* Ensure checkbox stays top-left aligned */
    .addon-header>.custom-checkbox {
        margin-top: 0.2rem;
    }

    /* Reduce horizontal gap between checkbox and title/content */
    /* --- Sub-addons Fix (Row with Wrapping) --- */
    /* User requested Price on Right, Title Wrapping */
    .sub-addon-item .ml-3.flex-1>.flex {
        flex-direction: row;
        /* Back to side-by-side */
        align-items: flex-start;
        justify-content: space-between;
        /* Ensure separation */
    }

    /* Sub-addon Label (Title) */
    .sub-addon-item label {
        flex: 1;
        /* Take up available space */
        min-width: 0;
        /* Allow shrinking below content size to force wrap */
        white-space: normal;
        /* Force wrap */
        padding-right: 0.25rem;
        /* Gap between text and pill */
        margin-bottom: 0;
        word-wrap: normal;
        word-break: normal;
        /* Don't split words mid-line */
        overflow-wrap: normal;
        /* Ensure wrapping of long words if needed */

        /* Adjusted Typography per request */
        font-size: 0.95rem;
        /* Smaller than main title */
        font-weight: 600;
        /* Keep bold */
        line-height: 1.2;
        /* Tighter newline spacing */
        color: #1e293b;
        /* Ensure dark enough text */
    }

    /* Unified Description Styling */
    .addon-desc,
    .sub-addon-item p {
        font-family: 'Inter', sans-serif;
        /* Same font type */
        font-size: 0.85rem;
        /* Unify size */
        color: #64748b;
        /* slate-500 */
        line-height: 1.4;
        margin-top: 0.25rem;
    }

    .sub-addon-item .price-info-pill {
        flex-shrink: 0;
        /* CRITICAL: Never shrink the price pill */
        margin-left: 0;
        margin-top: 0;
        align-self: flex-start;
        /* Also remove styling for sub-items */
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
    }

    /* Constrain Quantity Select Width */
    .estimator-select {
        width: 100%;
        /* Default full */
    }

    /* Make select inside cards more compact on mobile to avoid "huge white box" look */
    .addon-info .estimator-select,
    .sub-addon-item .estimator-select {
        width: auto !important;
        min-width: 100px;
        max-width: 150px;
        display: block;
    }
}

/* Animation Utilities */
/* Spinner and Popup styles moved to style.css for global reuse */
/* ===== 5. New Features (Recommended Badge, Info Popup, Price Pill) ===== */

/* Recommended Badge */
.recommended-badge {
    background-color: #0d9488;
    /* Teal-600 */
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    margin-top: 0.5rem;
    display: inline-block;
    /* Becomes distinct block under title */
    box-shadow: 0 2px 4px rgba(13, 148, 136, 0.2);
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.02em;
    align-self: flex-start;
}

/* Price Info Pill */
.price-info-pill {
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    /* Tighter gap */
    flex-shrink: 0;
    margin-left: 0.5rem;
    height: fit-content;
}

.price-info-pill.small {
    padding: 0.15rem 0.4rem 0.15rem 0.6rem;
}

.price-info-pill .price-tag {
    font-weight: 700;
    color: #2563eb;
    /* Blue-600 */
    font-size: 0.95rem;
}

/* Info Icon Button (? inside pill) */
.info-btn {
    background: #fff;
    border: 1px solid #cbd5e1;
    /* Slate-300 */
    color: #64748b;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    /* Circle */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.info-btn:hover {
    background: #f1f5f9;
    color: #3b82f6;
    border-color: #3b82f6;
}

.info-btn i {
    pointer-events: none;
}

/* Guide Tooltip - White Theme */
.info-guide-tooltip {
    position: absolute;
    /* Dynamic positioning via JS */
    z-index: 50;
    background: #ffffff;
    color: #334155;
    /* Slate-700 */
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    width: max-content;
    max-width: 260px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    transform: translateY(10px);
    border: 1px solid #f1f5f9;
}

.info-guide-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #ffffff;
    top: -8px;
    right: 20px;
    filter: drop-shadow(0 -1px 1px rgba(0, 0, 0, 0.05));
    /* Subtle shadow for top alignment */
}

.tooltip-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tooltip-content p {
    margin: 0;
    line-height: 1.5;
    font-weight: 500;
    color: #475569;
}

.tooltip-content button {
    background: #4f46e5;
    /* Indigo-600 */
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-end;
    transition: background 0.2s;
}

.tooltip-content button:hover {
    background: #4338ca;
    /* Indigo-700 */
}

/* Modal Styling */
.info-modal-overlay {
    display: flex;
    visibility: hidden;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.info-modal-overlay.show {
    visibility: visible;
    opacity: 1;
}

.info-modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.info-modal-overlay.show .info-modal-content {
    transform: scale(1);
}

.info-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.info-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    font-family: 'Outfit', sans-serif;
}

.info-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.info-modal-close:hover {
    background: #f1f5f9;
    color: #ef4444;
}

.info-modal-body {
    padding: 1.5rem;
}

.info-modal-desc {
    font-size: 1rem;
    color: #334155;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.info-modal-gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.info-modal-gallery img {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

@media (min-width: 640px) {
    .info-modal-gallery {
        grid-template-columns: 1fr 1fr;
    }
}

/* Utility for badge stacking since Tailwind might be missing */
.flex-col {
    display: flex;
    flex-direction: column;
}

.items-start {
    align-items: flex-start;
}

.pr-2 {
    padding-right: 0.5rem;
}

.ml-3 {
    margin-left: 0.75rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.w-full {
    width: 100%;
}

.flex-1 {
    flex: 1;
}