/* Roofing Calculator Plugin Styles - Optimized for Conversion */

.roofing-calculator__success-note {
    color: #166534;
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid rgba(22, 163, 74, 0.3);
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: 12px;
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
}

.roofing-calculator__error-note {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: 12px;
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
}

.roofing-calculator {
    max-width: 600px; /* Reduced for better focus */
    margin: 20px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px; /* Reduced for modern look */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); /* Softer shadow */
    border: 2px solid #374151; /* Darker border for better definition */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; /* System fonts for performance */
}

/* Title and description optimized for hierarchy */
.roofing-calculator__title {
    color: #111827 !important;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 12px;
    font-size: 2.2em;
    letter-spacing: -0.025em;
    text-align: center;
}

.roofing-calculator__description {
    color: #4b5563 !important;
    line-height: 1.6;
    margin-bottom: 28px;
    font-size: 1.1em;
    text-align: center;
}

.roofing-calculator__step {
    display: none;
    padding: 24px;
    background: #fafbfc; /* Lighter background for better contrast */
    border-radius: 8px; /* Reduced for modern look */
    margin-bottom: 20px;
    border: 1px solid #d1d5db; /* Darker border to match main container */
}

.roofing-calculator__step.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

.roofing-calculator__label {
    display: block;
    margin-bottom: 8px;
    color: #1a1a1a !important; /* Darker for better contrast */
    font-weight: 600;
    font-size: 0.95em; /* Slightly smaller for hierarchy */
    letter-spacing: -0.2px;
    line-height: 1.4;
}

.roofing-calculator__input {
    width: 100%;
    padding: 14px 16px; /* Increased padding for better touch targets */
    border: 2px solid #d1d5db; /* Better contrast border */
    border-radius: 6px; /* Reduced for modern look */
    margin-bottom: 20px;
    background: #ffffff;
    transition: all 0.2s ease; /* Faster transition for responsiveness */
    font-size: 16px; /* Minimum 16px for mobile accessibility */
    color: #1a1a1a;
    box-sizing: border-box;
    line-height: 1.5;
}

.roofing-calculator__input::placeholder {
    color: #aaa;
}

.roofing-calculator__input:focus {
    outline: none;
    border-color: #C8B16B;
    box-shadow: 0 0 0 3px rgba(200, 177, 107, 0.15); /* Increased opacity for better visibility */
    background: #ffffff;
    transform: translateY(-1px); /* Subtle lift effect */
}

.roofing-calculator__radio-group {
    display: flex;
    gap: 12px; /* Increased gap for better separation */
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.roofing-calculator__radio-label {
    flex: 1;
    min-width: 140px;
    position: relative;
    padding: 14px 16px; /* Increased padding for better touch targets */
    background: #ffffff;
    border-radius: 6px; /* Reduced for modern look */
    cursor: pointer;
    transition: all 0.2s ease; /* Faster transition */
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #1a1a1a;
    font-size: 15px; /* Better readability */
    font-weight: 500;
    line-height: 1.4;
}

.roofing-calculator__radio-label span {
    color: #333 !important;
}

.roofing-calculator__radio-input {
    -webkit-appearance: none;
    appearance: none;
    width: 18px; /* Slightly smaller for better proportion */
    height: 18px;
    border: 2px solid #cbd5e1; /* Better contrast */
    border-radius: 50%;
    outline: none;
    margin: 0;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    background-color: white;
    flex-shrink: 0; /* Prevent shrinking */
}

.roofing-calculator__radio-input:checked {
    border-color: #C8B16B;
    background: #C8B16B;
}

.roofing-calculator__radio-input:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px; /* Slightly smaller for better proportion */
    height: 6px;
    background: white;
    border-radius: 50%;
}

.roofing-calculator__radio-label:hover {
    background: #f8fafc; /* Lighter hover state */
    border-color: #C8B16B;
    transform: translateY(-1px); /* Subtle lift effect */
    box-shadow: 0 2px 8px rgba(200, 177, 107, 0.1); /* Subtle shadow */
}

.roofing-calculator__radio-label:hover span {
    color: #1a1a1a !important;
}

.roofing-calculator__button-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.roofing-calculator__back {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    border-radius: 10px;
    font-size: 0.95em;
}

.roofing-calculator__back:hover {
    background: #f8f9fa;
    color: #333;
}

.roofing-calculator__button {
    flex: 1;
    padding: 16px 20px; /* Increased padding for better touch targets */
    background: #C8B16B;
    color: white !important;
    border: none;
    border-radius: 6px; /* Reduced for modern look */
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 16px; /* Minimum 16px for mobile accessibility */
    line-height: 1.4;
    text-align: center;
    min-height: 48px; /* Minimum touch target size */
}

.roofing-calculator__button:hover {
    background: #B8A15B;
    transform: translateY(-2px); /* More pronounced lift */
    box-shadow: 0 6px 20px rgba(200, 177, 107, 0.25); /* Stronger shadow for better feedback */
}

.roofing-calculator__button:active {
    transform: translateY(0); /* Press effect */
    box-shadow: 0 2px 8px rgba(200, 177, 107, 0.2);
}

.roofing-calculator__error {
    color: #ff6b6b !important;
    margin-top: 8px;
    display: none;
    font-size: 0.95em;
    background: rgba(255, 107, 107, 0.35);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.1);
}

.roofing-calculator__estimate {
    text-align: center;
    font-size: 1.8em; /* Larger for impact */
    color: #C8B16B;
    margin: 24px 0;
    padding: 24px;
    background: #fefefe; /* Subtle background */
    border-radius: 8px;
    display: none;
    font-weight: 700;
    letter-spacing: -0.5px;
    border: 2px solid #C8B16B; /* Border for emphasis */
    box-shadow: 0 4px 16px rgba(200, 177, 107, 0.15);
    line-height: 1.2;
}

.roofing-calculator__estimate.visible {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

.roofing-calculator__cta-container {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-direction: column;
    align-items: center;
}

.roofing-calculator__contact {
    display: none;
    text-align: center;
    text-decoration: none !important;
    background: #C8B16B;
    color: white !important;
    margin-top: 10px;
    font-weight: 600;
    padding: 12px 25px;
    border-radius: 10px;
    transition: all 0.3s ease;
    letter-spacing: -0.3px;
    width: 100%;
    max-width: 350px;
    font-size: 0.95em;
}

.roofing-calculator__contact.visible {
    display: inline-block;
}

.roofing-calculator__contact:hover {
    text-decoration: none !important;
    background: #B8A15B;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(200, 177, 107, 0.15);
}

.roofing-calculator__reset {
    display: none;
    text-decoration: none;
    color: #333;
    padding: 12px 25px;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 600;
    border: 2px solid #e0e0e0;
    background: white;
    cursor: pointer;
    width: 100%;
    max-width: 350px;
    font-size: 0.95em;
}

.roofing-calculator__reset.visible {
    display: inline-block;
}

.roofing-calculator__reset:hover {
    background: #f8f9fa;
    color: #333;
    transform: scale(1.05);
    border-color: #C8B16B;
}

/* Loading Button State */
.roofing-calculator__button--loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.roofing-calculator__button--loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Estimate Summary */
.roofing-calculator__summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    margin-bottom: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    font-size: 0.9em;
    color: #374151;
    text-align: left;
}

.roofing-calculator__summary-item {
    line-height: 1.5;
}

.roofing-calculator__summary-item strong {
    color: #1a1a1a;
}

/* Cost Range Display */
.roofing-calculator__cost-range {
    font-size: 1.6em;
    font-weight: 700;
    color: #C8B16B;
    text-align: center;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-top: 8px;
}

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

/* Selected Card State for Radio Options */
.roofing-calculator__radio-label:has(.roofing-calculator__radio-input:checked) {
    border-color: #C8B16B;
    background: rgba(200, 177, 107, 0.08);
    box-shadow: 0 0 0 2px rgba(200, 177, 107, 0.2);
}

/* JS fallback for browsers without :has() */
.roofing-calculator__radio-label.selected {
    border-color: #C8B16B;
    background: rgba(200, 177, 107, 0.08);
    box-shadow: 0 0 0 2px rgba(200, 177, 107, 0.2);
}

/* Pitch Hint Text (replaces hover tooltips) */
.roofing-calculator__pitch-hint {
    display: block;
    width: 100%;
    color: #6b7280;
    font-size: 0.8em;
    font-weight: 400;
    margin-top: 2px;
    line-height: 1.3;
}

/* Progress Indicator */
.roofing-calculator__progress {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
    border: none;
    transform: none;
}

.progress-step__number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #e5e7eb;
}

.progress-step__label {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.progress-step__connector {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    margin-top: 16px;
    min-width: 24px;
    max-width: 60px;
    transition: background 0.3s ease;
}

.progress-step.active .progress-step__number {
    background: #C8B16B;
    border-color: #C8B16B;
    color: white;
    box-shadow: 0 0 0 3px rgba(200, 177, 107, 0.2);
}

.progress-step.active .progress-step__label {
    color: #C8B16B;
    font-weight: 600;
}

.progress-step.completed .progress-step__number {
    background: #C8B16B;
    border-color: #C8B16B;
    color: white;
    font-size: 0;
}

.progress-step.completed .progress-step__number::after {
    content: '\2713';
    font-size: 14px;
}

.progress-step.completed .progress-step__label {
    color: #C8B16B;
}

.progress-step.completed + .progress-step__connector {
    background: #C8B16B;
}

/* Helper Text */
.roofing-calculator__helper {
    color: #6b7280 !important; /* Better contrast gray */
    font-size: 14px; /* Slightly larger for readability */
    margin-top: -8px;
    margin-bottom: 16px;
    font-style: normal; /* Remove italic for better readability */
    line-height: 1.4;
}

/* Hide elements specific to certain roof types */
.roofing-calculator__pitch-options,
.roofing-calculator__metal-options,
.roofing-calculator__shingle-options,
.roofing-calculator__flat-options {
    display: none;
}

/* Address Row Layout */
.roofing-calculator__address-row {
    display: flex;
    gap: 12px;
    margin-bottom: 4px;
}

.roofing-calculator__address-field {
    display: flex;
    flex-direction: column;
}

.roofing-calculator__address-field--city {
    flex: 2;
}

.roofing-calculator__address-field--state {
    flex: 1;
    min-width: 80px;
}

.roofing-calculator__address-field--zip {
    flex: 1;
    min-width: 90px;
}

.roofing-calculator__select {
    appearance: auto;
    cursor: pointer;
    padding-top: 0;
    padding-bottom: 0;
    height: 52px; /* matches input height: (14+14)px padding + 16px font * 1.5 line-height ≈ 52px */
    line-height: normal;
}

/* ── Step Headings ─────────────────────────────────────────── */
.roofing-calculator__step-heading {
    font-size: 1.05em;
    font-weight: 700;
    color: #111827;
    margin: 0 0 18px 0;
    line-height: 1.3;
    letter-spacing: -0.2px;
}

/* ── Roof Type Cards (Step 1 — column layout with icon) ─────── */
.roofing-calculator__roof-cards {
    gap: 12px;
}

.roofing-calculator__roof-cards .roofing-calculator__radio-label {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 22px 14px 18px;
    gap: 10px;
    min-width: 0;
}

/* Hide native radio circle for roof type cards — card border is the indicator */
.roofing-calculator__roof-cards .roofing-calculator__radio-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.roofing-calculator__card-icon {
    width: 52px;
    height: 52px;
    color: #C8B16B;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.roofing-calculator__card-icon svg {
    width: 100%;
    height: 100%;
}

.roofing-calculator__roof-cards .roofing-calculator__radio-label:hover .roofing-calculator__card-icon {
    transform: scale(1.08);
}

/* ── Card Body / Title / Desc ────────────────────────────────── */
.roofing-calculator__card-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.roofing-calculator__card-title {
    display: block;
    font-size: 0.95em;
    color: #111827;
    font-weight: 700;
    line-height: 1.3;
}

.roofing-calculator__card-desc {
    display: block;
    font-size: 0.78em;
    color: #6b7280;
    font-weight: 400;
    line-height: 1.3;
}

/* Compact (non-roof-card) labels: card body fills remaining space */
.roofing-calculator__radio-label:not(.roofing-calculator__roof-cards *) .roofing-calculator__card-body {
    flex: 1;
}

/* ── Trust Badge (Step 4) ────────────────────────────────────── */
.roofing-calculator__trust {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #9ca3af;
    font-size: 0.78em;
    font-weight: 500;
    margin-top: -6px;
    margin-bottom: 14px;
    line-height: 1.4;
}

.roofing-calculator__trust svg {
    flex-shrink: 0;
    color: #9ca3af;
}

/* ── Estimate Display — improved hierarchy ───────────────────── */
.roofing-calculator__estimate-heading {
    font-size: 0.6em;   /* relative to estimate container's 1.8em */
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.roofing-calculator__estimate-subtext {
    font-size: 0.45em;
    color: #9ca3af;
    font-weight: 400;
    margin: 2px 0 16px 0;
    line-height: 1.4;
    letter-spacing: 0;
}

/* Summary label (small uppercase key above value) */
.roofing-calculator__summary-label {
    display: block;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 1px;
}

.roofing-calculator__summary-item {
    line-height: 1.4;
    font-size: 0.85em;
}

/* Responsive — Tablet */
@media screen and (max-width: 1024px) {
    .roofing-calculator {
        padding: 25px;
    }

    .roofing-calculator__title {
        font-size: 1.9em;
    }

    .progress-step__connector {
        min-width: 16px;
        max-width: 40px;
    }
}

/* Responsive — Mobile */
@media screen and (max-width: 768px) {
    .roofing-calculator {
        padding: 20px;
        margin: 15px;
    }

    .roofing-calculator__title {
        font-size: 1.6em;
    }

    .roofing-calculator__description {
        font-size: 0.9em;
        margin-bottom: 1.2em;
    }

    .roofing-calculator__step {
        padding: 15px;
    }

    /* Non-roof-card groups stack vertically on mobile */
    .roofing-calculator__radio-group:not(.roofing-calculator__roof-cards) {
        flex-direction: column;
        gap: 10px;
    }

    .roofing-calculator__radio-label {
        min-width: unset;
        width: 100%;
    }

    /* Roof type cards stay side-by-side but shrink */
    .roofing-calculator__roof-cards {
        gap: 8px;
    }

    .roofing-calculator__roof-cards .roofing-calculator__radio-label {
        padding: 16px 8px 14px;
        gap: 8px;
    }

    .roofing-calculator__card-icon {
        width: 40px;
        height: 40px;
    }

    .roofing-calculator__button-container {
        flex-direction: column;
        gap: 10px;
    }

    .roofing-calculator__button,
    .roofing-calculator__back {
        width: 100%;
        margin: 0;
        padding: 14px 20px;
    }

    .roofing-calculator__estimate {
        font-size: 1.2em;
        padding: 15px;
    }

    .roofing-calculator__cost-range {
        font-size: 1.3em;
    }

    .roofing-calculator__summary {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .roofing-calculator__contact,
    .roofing-calculator__reset {
        max-width: none;
        width: 90%;
    }

    /* Address row stacks on mobile */
    .roofing-calculator__address-row {
        flex-direction: column;
        gap: 4px;
    }

    /* Progress bar: hide labels on small screens */
    .progress-step__label {
        font-size: 10px;
    }

    .progress-step__number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .progress-step__connector {
        min-width: 12px;
        max-width: 30px;
    }
}