/* ============================================
   PANEL - full height side panel
   ============================================ */
[data-copilot-managed="true"] .contact-widget-popup[data-copilot-expanded="true"] {
    position: fixed;
    top: 60px;
    right: 0;
    bottom: 0;
    height: calc(100dvh - 60px) !important;
    max-height: calc(100dvh - 60px) !important;

    width: 370px;
    max-width: 100vw;
    max-height: none !important;

    background: #f4c400;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);

    display: flex;
    flex-direction: column;

    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;

    pointer-events: none;
    z-index: 99998;
}

/* ============================================
   PANEL OPEN STATE
   ============================================ */
[data-copilot-managed="true"].contact-widget-active .contact-widget-popup[data-copilot-expanded="true"] {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

/* ============================================
   HEADER - fixed at top
   ============================================ */
[data-copilot-managed="true"] .contact-widget-popup[data-copilot-expanded="true"] .contact-widget-popup-header {
    flex-shrink: 0;
}

/* ============================================
   SECTIONS CONTAINER - fills remaining space
   ============================================ */
[data-copilot-managed="true"] .contact-widget-popup[data-copilot-expanded="true"] .contact-widget-popup-sections {
    border: 1px solid #eee;
    background: #fff !important;
    padding: 6px;
    scrollbar-width: thin;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ============================================
   CHAT SECTION (first child) - fills
   ============================================ */
[data-copilot-managed="true"] .contact-widget-popup[data-copilot-expanded="true"] .contact-widget-popup-sections-section:first-child {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
}

/* ============================================
   SUPPORT SECTION (last child) - fixed at bottom
   ============================================ */
[data-copilot-managed="true"] .contact-widget-popup[data-copilot-expanded="true"] .contact-widget-popup-sections-section:last-child {
    flex-shrink: 0;
    margin: 0;
    padding-top: 5px !important;
}

/* ============================================
   WEBCHAT - fills chat section
   ============================================ */
[data-copilot-managed="true"] .contact-widget-popup[data-copilot-expanded="true"] #webchat {
    flex: 1;
    background: #fff;
    border: 1px solid #ddd;
    min-height: 0;
}

[data-copilot-managed="true"] #webchat iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   SUPPORT INTRO TEXT
   ============================================ */
[data-copilot-managed="true"] .contact-widget-popup[data-copilot-expanded="true"] .contact-widget-popup-sections-section-intro {
    margin: 0 0 6px;
    padding-bottom: 0px !important;
}

/* ============================================
   SUPPORT LINKS
   ============================================ */
[data-copilot-managed="true"] .contact-widget-popup[data-copilot-expanded="true"] .contact-widget-popup-sections-section-links {
    margin: 0;
}
.contact-widget-popup-sections-section-links .wp-block-button{
    justify-content: left !important;
    padding-left: 1em;
}

/* ============================================
   PLACEHOLDERS / ERRORS
   ============================================ */
[data-copilot-managed="true"] .chat-placeholder,
[data-copilot-managed="true"] .chat-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
    font-size: 15px;
    color: #444;
}

/* ============================================
   MOBILE
   ============================================ */

@media (max-width: 640px) {
    [data-copilot-managed="true"] .contact-widget-popup[data-copilot-expanded="true"] {
        width: 100vw;
    }

    /* Add side padding to chat + support sections on mobile */
    [data-copilot-managed="true"] .contact-widget-popup[data-copilot-expanded="true"] .contact-widget-popup-sections {
        padding-left: 12px;
        padding-right: 12px;
    }
}



/* ============================================
   PULSE ANIMATION ON LOAD
   ============================================ */
@keyframes copilot-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(251, 185, 59, 0.6);
    }
    70% {
        box-shadow: 0 0 0 18px rgba(251, 185, 59, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(251, 185, 59, 0);
    }
}

[data-copilot-managed="true"] .contact-widget-cta {
    animation: copilot-pulse 1.5s ease-out 2;
    animation-delay: 0.5s;
}