#ezc-widget-container,
#ezc-widget-container * {
    box-sizing: border-box;
}

#ezc-widget-container {
    position: fixed;
    bottom: var(--ezc-bottom);
    bottom: max(var(--ezc-bottom), 96px);
    width: 60px;
    height: 60px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Positioning rules */
#ezc-widget-container.ezc-right {
    right: var(--ezc-side);
    right: max(var(--ezc-side), 16px);
}
#ezc-widget-container.ezc-left {
    left: var(--ezc-side);
    left: max(var(--ezc-side), 16px);
}

/* Auto Popup Styling */
#ezc-auto-popup {
    position: absolute;
    bottom: 76px;
    background: var(--ezc-bg-dark, #111);
    color: var(--ezc-text-light, #fff);
    padding: 11px 14px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.28);
    white-space: normal;
    max-width: min(280px, calc(100vw - 36px));
    width: max-content;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    border: 1px solid rgba(255,255,255,0.14);
    border-bottom: 3px solid var(--ezc-primary, #FFE300);
    text-align: left;
    line-height: 1.35;
    transform: translateY(6px);
    z-index: 1000000;
}

#ezc-auto-popup::after {
    content: "";
    position: absolute;
    bottom: -8px;
    width: 14px;
    height: 14px;
    background: var(--ezc-bg-dark, #111);
    border-right: 1px solid rgba(255,255,255,0.14);
    border-bottom: 1px solid rgba(255,255,255,0.14);
    transform: rotate(45deg);
}

#ezc-auto-popup.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

#ezc-widget-container.ezc-right #ezc-auto-popup {
    right: 0 !important;
    left: auto !important;
}
#ezc-widget-container.ezc-right #ezc-auto-popup::after {
    right: 22px;
}

#ezc-widget-container.ezc-left #ezc-auto-popup {
    left: 0 !important;
    right: auto !important;
}
#ezc-widget-container.ezc-left #ezc-auto-popup::after {
    left: 22px;
}

/* Floating Trigger Button */
#ezc-trigger-btn {
    position: relative;
    width: 60px;
    height: 60px;
    background: var(--ezc-primary);
    color: var(--ezc-text-dark);
    border-radius: 50%;
    text-align: center;
    line-height: 60px;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.38);
    transition: transform 0.2s, box-shadow 0.2s;
}
#ezc-trigger-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

/* Main Window */
#ezc-window {
    display: none;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: min(560px, calc(100vh - 190px));
    min-height: 320px;
    max-height: calc(100vh - 190px);
    background: var(--ezc-panel-bg);
    border: 1px solid #333;
    border-radius: 14px;
    box-shadow: 0 10px 34px rgba(0,0,0,0.58);
    position: absolute;
    bottom: 78px;
    overflow: hidden;
    flex-direction: column;
}
#ezc-widget-container.ezc-right #ezc-window { right: 0; }
#ezc-widget-container.ezc-left #ezc-window { left: 0; }
#ezc-widget-container.ezc-open #ezc-window { display: flex; }

/* Header */
.ezc-header {
    background: var(--ezc-bg-dark);
    color: var(--ezc-primary);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 16px;
    border-bottom: 2px solid var(--ezc-primary);
}
.ezc-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
#ezc-reset-chat {
    color: var(--ezc-text-light);
    font-size: 12px;
    text-decoration: none;
    opacity: 0.78;
}
#ezc-reset-chat:hover {
    color: var(--ezc-primary);
    opacity: 1;
}
#ezc-close {
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: var(--ezc-text-light);
}
#ezc-close:hover { color: var(--ezc-primary); }

/* Tabs */
.ezc-tabs {
    display: flex;
    background: var(--ezc-bg-dark);
}
.ezc-tab-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 12px;
    cursor: pointer;
    font-weight: 600;
    color: #888;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.ezc-tab-btn.active {
    color: var(--ezc-primary);
    border-bottom: 2px solid var(--ezc-primary);
    background: var(--ezc-panel-bg);
}

/* Chat Body */
.ezc-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--ezc-text-light);
}
.ezc-panel {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    padding: 15px;
}
.ezc-panel.active {
    display: flex;
}

/* Messages */
#ezc-chat-box {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 10px;
    padding-right: 5px;
}
.ezc-msg {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 12px;
    max-width: 88%;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.ezc-msg.system, .ezc-msg.ai {
    background: var(--ezc-msg-ai);
    color: var(--ezc-text-light);
    align-self: flex-start;
    margin-right: auto;
    border-left: 3px solid var(--ezc-primary);
}
.ezc-msg.user {
    background: var(--ezc-primary);
    color: var(--ezc-text-dark);
    align-self: flex-end;
    margin-left: auto;
    text-align: right;
    font-weight: 600;
}

/* Inputs */
.ezc-input-wrapper {
    display: flex;
    padding-top: 10px;
}
#ezc-input {
    flex: 1;
    min-width: 0;
    padding: 12px;
    background: var(--ezc-bg-dark);
    color: var(--ezc-text-light);
    border: 1px solid #444;
    border-radius: 8px;
    outline: none;
}
#ezc-input:focus { border-color: var(--ezc-primary); }
#ezc-send {
    background: var(--ezc-primary);
    color: var(--ezc-text-dark);
    border: none;
    font-weight: bold;
    padding: 0 15px;
    margin-left: 8px;
    border-radius: 8px;
    cursor: pointer;
}
#ezc-send:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Links Tab */
.ezc-links-container p {
    color: #ccc;
    font-size: 14px;
    line-height: 1.5;
}
.ezc-links-container .ezc-btn {
    display: block;
    text-align: center;
    padding: 14px;
    margin: 12px 0;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    letter-spacing: 0.5px;
}
.ezc-btn.wa { background: #25D366; color: #fff; }
.ezc-btn.fb { background: #1877F2; color: #fff; }
.ezc-btn.email { background: #555555; color: #fff; }

/* Reviews Tab Styling */
#ezc-tab-reviews {
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

#ezc-reviews-content {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    display: block;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 15px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.ezc-master-rating {
    text-align: center;
    padding: 14px 0;
    border-bottom: 1px solid #333;
    margin-bottom: 12px;
}
.ezc-master-rating h2 {
    font-size: 28px;
    margin: 0 0 5px 0;
    color: var(--ezc-text-light);
}
.ezc-master-rating p {
    margin: 0;
    font-size: 13px;
    color: #aaa;
}
.ezc-stars, .ezc-rev-stars {
    color: var(--ezc-primary);
    font-size: 16px;
}
.ezc-reviews-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: visible !important;
    padding-bottom: 18px;
}
.ezc-review-card {
    flex: 0 0 auto;
    background: #222;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--ezc-primary);
}
.ezc-rev-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--ezc-primary);
}
.ezc-rev-body {
    font-size: 13px;
    line-height: 1.45;
    color: #ccc;
    overflow-wrap: anywhere;
}


.ezc-review-warning {
    border-left-color: #ffcc00;
    background: rgba(255, 227, 0, 0.08);
}

/* Typing Indicator */
.ezc-typing-pulse {
    font-weight: bold;
    font-size: 18px;
    letter-spacing: 2px;
    animation: ezc-pulse 1.2s infinite;
}
@keyframes ezc-pulse {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

@media (max-width: 480px) {
    #ezc-widget-container {
        bottom: var(--ezc-bottom);
        bottom: max(var(--ezc-bottom), 88px);
    }

    #ezc-widget-container.ezc-right {
        right: 14px;
    }

    #ezc-widget-container.ezc-left {
        left: 14px;
    }

    #ezc-window {
        width: calc(100vw - 28px);
        height: min(540px, calc(100vh - 178px));
        max-height: calc(100vh - 178px);
    }

    #ezc-auto-popup {
        max-width: min(260px, calc(100vw - 36px));
        font-size: 13px;
    }
}



/* EZConnect 5.1.5 Hard Scroll Fix
   Keeps wheel/touch scrolling inside the open widget instead of letting the page behind it scroll. */
html.ezc-widget-open,
body.ezc-widget-open {
    overscroll-behavior: contain;
}

#ezc-widget-container {
    pointer-events: none;
}

#ezc-trigger-btn,
#ezc-auto-popup,
#ezc-window {
    pointer-events: auto;
}

#ezc-window {
    position: fixed !important;
    bottom: calc(max(var(--ezc-bottom), 96px) + 78px) !important;
    height: min(560px, calc(100dvh - (max(var(--ezc-bottom), 96px) + 108px))) !important;
    max-height: calc(100dvh - (max(var(--ezc-bottom), 96px) + 108px)) !important;
    min-height: 320px !important;
    overflow: hidden !important;
    overscroll-behavior: contain !important;
}

#ezc-widget-container.ezc-right #ezc-window {
    right: max(var(--ezc-side), 16px) !important;
    left: auto !important;
}

#ezc-widget-container.ezc-left #ezc-window {
    left: max(var(--ezc-side), 16px) !important;
    right: auto !important;
}

#ezc-widget-container.ezc-open #ezc-window {
    display: flex !important;
}

#ezc-window .ezc-body {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: hidden !important;
}

#ezc-window .ezc-panel.active {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

#ezc-tab-reviews {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
    padding: 0 !important;
}

#ezc-reviews-content {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: none;
    scrollbar-width: thin;
}

#ezc-chat-box {
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: none;
}

#ezc-tab-links {
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
}

@supports not (height: 100dvh) {
    #ezc-window {
        height: min(560px, calc(100vh - 204px)) !important;
        max-height: calc(100vh - 204px) !important;
    }
}

@media (max-width: 480px) {
    #ezc-window {
        bottom: calc(max(var(--ezc-bottom), 88px) + 74px) !important;
        height: min(540px, calc(100dvh - (max(var(--ezc-bottom), 88px) + 96px))) !important;
        max-height: calc(100dvh - (max(var(--ezc-bottom), 88px) + 96px)) !important;
    }
}

/* EZConnect 5.1.6 interaction + mobile polish */
#ezc-widget-container {
    pointer-events: auto !important;
}

#ezc-window,
#ezc-window * {
    pointer-events: auto;
}

#ezc-input {
    position: relative;
    z-index: 3;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    user-select: text;
    -webkit-user-select: text;
}

#ezc-send,
#ezc-reset-chat,
#ezc-close,
.ezc-tab-btn {
    position: relative;
    z-index: 3;
    touch-action: manipulation !important;
}

#ezc-chat-box,
#ezc-reviews-content,
#ezc-tab-links {
    touch-action: pan-y !important;
}

.ezc-clean-list {
    margin: 8px 0 8px 18px;
    padding: 0;
}

.ezc-clean-list li {
    margin: 5px 0;
    padding-left: 2px;
}

#ezc-auto-popup {
    display: block;
    z-index: 1000001;
}

@media (max-width: 640px) {
    #ezc-widget-container {
        bottom: max(var(--ezc-bottom), 86px) !important;
        width: 56px;
        height: 56px;
    }

    #ezc-trigger-btn {
        width: 56px;
        height: 56px;
        line-height: 56px;
        font-size: 26px;
    }

    #ezc-widget-container.ezc-right {
        right: max(var(--ezc-side), 12px) !important;
    }

    #ezc-widget-container.ezc-left {
        left: max(var(--ezc-side), 12px) !important;
    }

    #ezc-auto-popup {
        bottom: 68px !important;
        max-width: min(270px, calc(100vw - 28px)) !important;
        font-size: 13px;
        line-height: 1.3;
        padding: 10px 13px;
    }

    #ezc-window {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        bottom: calc(max(var(--ezc-bottom), 86px) + 66px) !important;
        height: min(560px, calc(100dvh - (max(var(--ezc-bottom), 86px) + 82px))) !important;
        max-height: calc(100dvh - (max(var(--ezc-bottom), 86px) + 82px)) !important;
        min-height: 330px !important;
    }

    #ezc-widget-container.ezc-right #ezc-window {
        right: 12px !important;
    }

    #ezc-widget-container.ezc-left #ezc-window {
        left: 12px !important;
    }

    .ezc-header {
        padding: 12px 14px;
    }

    .ezc-title {
        font-size: 15px;
        line-height: 1.25;
    }

    .ezc-tab-btn {
        padding: 11px 8px;
    }

    .ezc-msg {
        max-width: 92%;
        font-size: 14px;
    }
}

@supports not (height: 100dvh) {
    @media (max-width: 640px) {
        #ezc-window {
            height: min(560px, calc(100vh - (max(var(--ezc-bottom), 86px) + 82px))) !important;
            max-height: calc(100vh - (max(var(--ezc-bottom), 86px) + 82px)) !important;
        }
    }
}

/* EZConnect 5.1.7 click/focus fix
   Keeps the open widget above the bubble and prevents inside clicks from being treated as bubble/outside clicks. */
#ezc-window {
    z-index: 1000003 !important;
    pointer-events: auto !important;
}

#ezc-widget-container.ezc-open #ezc-trigger-btn {
    pointer-events: none !important;
}

#ezc-trigger-btn {
    z-index: 1000000;
}

#ezc-auto-popup {
    z-index: 1000001 !important;
}

#ezc-window input,
#ezc-window button,
#ezc-window a,
#ezc-window textarea,
#ezc-window select {
    pointer-events: auto !important;
}

#ezc-input,
#ezc-send {
    -webkit-tap-highlight-color: rgba(255, 227, 0, 0.22);
}

#ezc-input {
    cursor: text;
}

#ezc-send {
    cursor: pointer;
}

/* EZConnect 5.1.8 mobile keyboard fit
   When the phone keyboard opens, shrink the widget to the visible viewport so the chat input is not hidden. */
:root {
    --ezc-vv-top: 0px;
    --ezc-vv-height: 100dvh;
}

.ezc-input-wrapper {
    flex: 0 0 auto;
    min-height: 54px;
    background: var(--ezc-panel-bg);
    position: relative;
    z-index: 5;
}

html.ezc-mobile-keyboard-open,
body.ezc-mobile-keyboard-open {
    overflow: hidden !important;
    overscroll-behavior: contain !important;
}

html.ezc-mobile-keyboard-open #ezc-window {
    top: calc(var(--ezc-vv-top, 0px) + 8px) !important;
    bottom: auto !important;
    height: calc(var(--ezc-vv-height, 100dvh) - 16px) !important;
    max-height: calc(var(--ezc-vv-height, 100dvh) - 16px) !important;
    min-height: 260px !important;
}

html.ezc-mobile-keyboard-open #ezc-widget-container.ezc-right #ezc-window {
    right: 8px !important;
    left: auto !important;
}

html.ezc-mobile-keyboard-open #ezc-widget-container.ezc-left #ezc-window {
    left: 8px !important;
    right: auto !important;
}

html.ezc-mobile-keyboard-open #ezc-window .ezc-header {
    padding-top: 10px;
    padding-bottom: 10px;
}

html.ezc-mobile-keyboard-open #ezc-window .ezc-tab-btn {
    padding-top: 9px;
    padding-bottom: 9px;
}

html.ezc-mobile-keyboard-open #ezc-tab-chat {
    padding-bottom: 10px !important;
}

html.ezc-mobile-keyboard-open #ezc-chat-box {
    padding-bottom: 8px !important;
}

html.ezc-mobile-keyboard-open #ezc-input {
    font-size: 16px;
}

@media (max-width: 640px) {
    html.ezc-mobile-keyboard-open #ezc-window {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
    }

    html.ezc-mobile-keyboard-open #ezc-auto-popup,
    html.ezc-mobile-keyboard-open #ezc-trigger-btn {
        display: none !important;
    }
}

/* EZConnect 5.1.9 reply cut-off insurance
   Let long AI messages grow naturally inside the scrollable chat box. */
#ezc-chat-box {
    display: flex !important;
    flex-direction: column !important;
}

#ezc-chat-box .ezc-msg {
    flex: 0 0 auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    white-space: normal !important;
}

#ezc-chat-box .ezc-msg.ai,
#ezc-chat-box .ezc-msg.system {
    word-break: normal !important;
    overflow-wrap: anywhere !important;
}
