/**
 * Consultation Top Bar Styles
 * A compact, single-line consultation bar shown at the top of the page
 * content. Sits in the normal document flow — never repositions or
 * resizes anything else on the page (no fixed positioning, no touching
 * the theme's header).
 *
 * The bar starts as a single call-to-action line; clicking/tapping it
 * anywhere reveals the compact form fields underneath.
 *
 * All rules below are scoped to #cw-topbar-bar and use !important —
 * this is intentional and necessary: many themes/page builders apply
 * strong global styles to bare input/button elements, which would
 * otherwise silently override this bar's appearance regardless of
 * stylesheet load order.
 *
 * @package Consultation_Widget
 * @since 1.2.0
 */

#cw-topbar-bar,
#cw-topbar-bar * {
    box-sizing: border-box !important;
}

#cw-topbar-bar {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    flex-basis: 100% !important;
    align-self: stretch !important;
    grid-column: 1 / -1 !important;
    order: 999999 !important;
    margin: 0 !important;
    background: linear-gradient(100deg, #1F5D4C 0%, #163F33 55%, #14181A 130%) !important;
    padding: 10px 20px !important;
    box-shadow: 0 2px 10px rgba(20, 24, 26, 0.25) !important;
    border: none !important;
    border-bottom: 2px solid #D4AF37 !important;
}

/* ==========================================
   Form layer (always present underneath)
   ========================================== */
#cw-topbar-bar form.cw-topbar-form {
    display: flex !important;
    position: relative !important;
    max-width: 1180px !important;
    width: 100% !important;
    margin: 0 auto !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* ==========================================
   Call-to-action layer — a translucent panel
   over the form, so the fields show through
   and it's obvious there's more underneath.
   Tapping/clicking it anywhere reveals the
   form fully.
   ========================================== */
#cw-topbar-bar .cw-topbar-cta {
    position: absolute !important;
    inset: 0 !important;
    z-index: 20 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: var(--cw-topbar-cta-font, 14px) !important;
    line-height: 1.5 !important;
    text-align: center !important;
    cursor: pointer !important;
    padding: 0 14px !important;
    background: linear-gradient(100deg, rgba(31, 93, 76, var(--cw-topbar-cta-opacity, 0.52)) 0%, rgba(22, 63, 51, var(--cw-topbar-cta-opacity, 0.52)) 55%, rgba(20, 24, 26, var(--cw-topbar-cta-opacity, 0.52)) 130%) !important;
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
    border: none !important;
    border-radius: 0 !important;
    transition: opacity 0.25s ease !important;
    animation: cw-topbar-cta-pulse 2.4s ease-in-out infinite !important;
}

#cw-topbar-bar .cw-topbar-cta:hover {
    background: linear-gradient(100deg, rgba(31, 93, 76, calc(var(--cw-topbar-cta-opacity, 0.52) + 0.13)) 0%, rgba(22, 63, 51, calc(var(--cw-topbar-cta-opacity, 0.52) + 0.13)) 55%, rgba(20, 24, 26, calc(var(--cw-topbar-cta-opacity, 0.52) + 0.13)) 130%) !important;
}

#cw-topbar-bar .cw-topbar-cta::before {
    content: '✦';
    color: #D4AF37;
    font-size: 12px;
}

#cw-topbar-bar .cw-topbar-cta-arrow {
    display: inline-block !important;
    color: #D4AF37 !important;
    font-size: 16px !important;
    line-height: 1 !important;
    animation: cw-topbar-arrow-bounce 1.4s ease-in-out infinite !important;
}

@keyframes cw-topbar-cta-pulse {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(212, 175, 55, 0.5); }
    50% { box-shadow: inset 0 0 0 2px rgba(212, 175, 55, 0.5); }
}

@keyframes cw-topbar-arrow-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

#cw-topbar-bar.cw-topbar-expanded .cw-topbar-cta {
    opacity: 0 !important;
    pointer-events: none !important;
}

#cw-topbar-bar input.cw-topbar-input {
    flex: 1 1 100px !important;
    min-width: 80px !important;
    width: auto !important;
    height: auto !important;
    padding: 9px 14px !important;
    margin: 0 !important;
    font-size: var(--cw-topbar-input-font, 11px) !important;
    line-height: 1.4 !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    border-radius: 999px !important;
    outline: none !important;
    box-shadow: none !important;
    transition: background-color 0.2s ease, border-color 0.2s ease !important;
}

#cw-topbar-bar input.cw-topbar-name,
#cw-topbar-bar input.cw-phone-input.cw-topbar-input {
    flex: 0.6 1 80px !important;
}

#cw-topbar-bar input.cw-topbar-input::placeholder {
    color: rgba(255, 255, 255, 0.75) !important;
    opacity: 1 !important;
}

#cw-topbar-bar input.cw-topbar-input:focus {
    background: rgba(255, 255, 255, 0.22) !important;
    border-color: #D4AF37 !important;
}

#cw-topbar-bar input.cw-topbar-message {
    flex: 3 1 220px !important;
}

#cw-topbar-bar button.cw-topbar-button {
    flex: 0 0 auto !important;
    width: auto !important;
    height: auto !important;
    padding: 8px 18px !important;
    margin: 0 !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    font-weight: 700 !important;
    color: #14181A !important;
    background: linear-gradient(120deg, #D4AF37, #EAC85A) !important;
    border: none !important;
    border-radius: 999px !important;
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.35) !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, box-shadow 0.2s ease !important;
}

#cw-topbar-bar button.cw-topbar-button:hover,
#cw-topbar-bar button.cw-topbar-button:focus {
    background: linear-gradient(120deg, #B8952E, #D4AF37) !important;
    transform: translateY(-1px) scale(1.06);
    box-shadow: 0 5px 14px rgba(212, 175, 55, 0.45) !important;
}

#cw-topbar-bar .cw-form-message {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: 0 !important;
    margin: 8px 0 0 !important;
    padding: 8px 14px !important;
    font-size: 12px !important;
    z-index: 10 !important;
}

/* ==========================================
   Mobile — everything forced onto ONE line,
   as small as needed. Readability is not a
   concern here; the browser's own native zoom
   (these font sizes sit under 16px) is what
   makes the field usable once tapped.
   ========================================== */
@media (max-width: 782px) {
    #cw-topbar-bar {
        padding: 8px 8px !important;
    }

    #cw-topbar-bar .cw-topbar-cta {
        padding: 5px 10px !important;
        gap: 5px !important;
    }

    #cw-topbar-bar .cw-topbar-cta-arrow {
        font-size: 14px !important;
    }

    #cw-topbar-bar form.cw-topbar-form {
        flex-wrap: nowrap !important;
        gap: 3px !important;
    }

    #cw-topbar-bar input.cw-topbar-input {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        padding: 5px 6px !important;
        font-size: var(--cw-topbar-input-font, 8px) !important;
        border-radius: 6px !important;
    }

    #cw-topbar-bar input.cw-topbar-name,
    #cw-topbar-bar input.cw-phone-input.cw-topbar-input {
        flex: 0.6 1 0 !important;
    }

    #cw-topbar-bar input.cw-topbar-message {
        flex: 2.2 1 0 !important;
    }

    #cw-topbar-bar button.cw-topbar-button {
        flex: 0 0 auto !important;
        padding: 5px 8px !important;
        font-size: 10px !important;
        border-radius: 6px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    #cw-topbar-bar button.cw-topbar-button,
    #cw-topbar-bar input.cw-topbar-input,
    #cw-topbar-bar .cw-topbar-cta,
    #cw-topbar-bar .cw-topbar-cta-arrow {
        transition: none !important;
        animation: none !important;
    }
}
