/**
 * GoHighLevel form embed — OrhifyTech responsive integration
 * Forms live inside a capped scroll area so they never overlap other sections.
 */

/* ── Base card ── */
.ghl-form-card {
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.5rem rgba(9, 30, 62, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    isolation: isolate;
}

.ghl-form-card__header {
    background: var(--primary, #06A3DA);
    padding: 0.85rem 1.15rem;
    flex-shrink: 0;
}

.ghl-form-card__header h4,
.ghl-form-card__header h5 {
    color: #fff;
    font-family: 'Rubik', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    margin: 0;
}

.ghl-form-card__body {
    padding: 0;
    margin: 0;
    overflow: hidden;
    flex: 0 0 auto;
    position: relative;
}

/* Scroll viewport — prevents overlap with sections below */
.ghl-form-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--primary, #06A3DA) #eef9ff;
}

.ghl-form-scroll::-webkit-scrollbar {
    width: 6px;
}

.ghl-form-scroll::-webkit-scrollbar-track {
    background: #eef9ff;
}

.ghl-form-scroll::-webkit-scrollbar-thumb {
    background: var(--primary, #06A3DA);
    border-radius: 3px;
}

/* Per-variant max heights (visible area) */
.ghl-form-scroll--hero    { max-height: 400px; }
.ghl-form-scroll--quote   { max-height: 420px; }
.ghl-form-scroll--contact { max-height: 480px; }
.ghl-form-scroll--default { max-height: 440px; }

.ghl-form-embed {
    width: 100%;
    overflow: visible;
    line-height: normal;
    background: #fff;
}

/* Loading spinner */
.ghl-form-embed:not(.ghl-form-ready) {
    min-height: 100px;
    background: var(--light, #EEF9FF);
}

.ghl-form-embed:not(.ghl-form-ready)::after {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    margin: 34px auto;
    border: 3px solid var(--primary, #06A3DA);
    border-top-color: transparent;
    border-radius: 50%;
    animation: ghl-spin 0.7s linear infinite;
}

@keyframes ghl-spin {
    to { transform: rotate(360deg); }
}

.ghl-form-embed:not(.ghl-form-ready) iframe {
    opacity: 0;
    height: 0 !important;
    visibility: hidden;
}

.ghl-form-embed.ghl-form-ready::after {
    display: none;
}

.ghl-form-embed.ghl-form-ready iframe {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease;
}

/* Override GHL injected wrappers */
.ghl-form-card .ep-iFrameContainer,
.ghl-form-card .ep-wrapper,
.ghl-form-card .ep-inline {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #fff !important;
    position: relative !important;
    z-index: 1 !important;
}

.ghl-form-embed iframe {
    display: block;
    width: 100% !important;
    max-width: 100%;
    border: none !important;
    background: #fff;
}

/* Section wrappers — contain forms in document flow */
.ghl-quote-section {
    overflow: visible;
    position: relative;
    z-index: 0;
}

.ghl-quote-form-col,
.carousel-caption .form-container {
    max-width: 100%;
    overflow: hidden;
    position: relative;
}

/* ── Hero carousel ── */
.ghl-form-card--hero {
    border-radius: 14px;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.18);
}

#header-carousel {
    overflow: hidden;
}

#header-carousel .carousel-item {
    min-height: 520px;
}

#header-carousel .carousel-item img {
    min-height: 520px;
    object-fit: cover;
}

#header-carousel .ghl-form-card,
#header-carousel .ghl-form-embed,
#header-carousel .ep-iFrameContainer,
#header-carousel .ep-wrapper,
#header-carousel .ep-inline {
    position: relative !important;
    z-index: 1 !important;
}

@media (min-width: 992px) {
    #header-carousel .carousel-item {
        min-height: 600px;
    }

    #header-carousel .carousel-item img {
        min-height: 600px;
    }

    #header-carousel .carousel-caption {
        padding-top: 105px;
        padding-bottom: 35px;
        align-items: flex-start;
    }

    #header-carousel .carousel-caption .row {
        align-items: flex-start !important;
    }

    #header-carousel .form-container {
        margin-top: 0 !important;
        max-width: 540px;
        margin-left: auto;
    }

    .ghl-form-scroll--hero {
        max-height: 390px;
    }
}

@media (max-width: 991.98px) {
    #header-carousel .carousel-caption {
        padding-top: 85px;
        padding-bottom: 25px;
        align-items: flex-start;
        position: relative;
    }

    #header-carousel .carousel-item {
        min-height: auto;
    }

    #header-carousel .carousel-item img {
        min-height: 480px;
    }

    .carousel-caption .form-container {
        margin-top: 1rem !important;
    }

    .ghl-form-scroll--hero {
        max-height: 360px;
    }
}

@media (max-width: 575.98px) {
    .ghl-form-card--hero {
        border-radius: 10px;
    }

    .ghl-form-card--hero .ghl-form-card__header {
        padding: 0.7rem 1rem;
    }

    .ghl-form-scroll--hero {
        max-height: 340px;
    }

    .ghl-form-scroll--quote {
        max-height: 360px;
    }
}

/* ── Quote sections — side-by-side with text on desktop ── */
.ghl-quote-row {
    display: flex;
    flex-wrap: wrap;
}

.ghl-quote-form-col {
    align-self: flex-start;
    max-width: 100%;
}

@media (min-width: 992px) {
    .ghl-quote-row {
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .ghl-quote-form-col {
        position: relative;
        top: 0;
    }

    .ghl-quote-form-col .ghl-form-card {
        width: 100%;
    }

    .ghl-quote-form-col .ghl-form-card,
    .ghl-quote-form-col .ghl-form-scroll,
    .ghl-quote-form-col .ghl-form-embed,
    .ghl-quote-form-col .ep-iFrameContainer,
    .ghl-quote-form-col .ep-wrapper {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        float: none !important;
    }
}

.ghl-form-card--quote {
    background: #fff;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid rgba(9, 30, 62, 0.06);
    margin-bottom: 0;
}

.ghl-form-card--quote .ghl-form-card__header {
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    padding: 1.1rem 1.25rem 0.85rem;
}

.ghl-form-card--quote .ghl-form-card__header h4 {
    color: var(--primary, #06A3DA);
    font-family: 'Rubik', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    text-align: left;
}

.ghl-form-card--quote .ghl-form-card__header h4::before {
    content: '';
    display: block;
    width: 45px;
    height: 3px;
    background: var(--primary, #06A3DA);
    border-radius: 2px;
    margin-bottom: 0.4rem;
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .ghl-form-scroll--quote {
        max-height: 400px;
    }
}

/* ── Contact page ── */
.contact-form-map-row {
    align-items: flex-start;
}

.contact-form-map-row > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.contact-map-wrap {
    width: 100%;
    height: 440px;
    max-height: 440px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.5rem rgba(9, 30, 62, 0.1);
}

.contact-map-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

@media (max-width: 991.98px) {
    .ghl-form-scroll--contact {
        max-height: 420px;
    }

    .contact-map-wrap {
        height: 300px;
        max-height: 300px;
        margin-top: 1rem;
    }
}

@media (max-width: 575.98px) {
    .ghl-form-scroll--contact {
        max-height: 380px;
    }

    .contact-map-wrap {
        height: 260px;
        max-height: 260px;
    }
}
