/* ============================================================
   UCEGA Live Chat Widget
   Floating button + breathing pulse ring + chat window
   Pure CSS, no SVG, no emoji. Icons via Font Awesome.
   ============================================================ */

/* ---- Floating launcher button ---- */
#ucega-chat-fab {
    position: fixed;
    bottom: 50px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0ea5e9;
    color: #ffffff;
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
    transition: transform 0.2s ease, background 0.2s ease;
}
#ucega-chat-fab:hover {
    background: #0284c7;
    transform: scale(1.06);
}
#ucega-chat-fab i {
    font-size: 24px;
    line-height: 1;
}

/* Breathing pulse ring around the button (pure CSS keyframes) */
#ucega-chat-fab::before,
#ucega-chat-fab::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(14, 165, 233, 0.4);
    z-index: -1;
    animation: chat-pulse 2s ease-out infinite;
}
#ucega-chat-fab::after {
    animation-delay: 1s;
}
@keyframes chat-pulse {
    0%   { transform: scale(1);    opacity: 0.6; }
    100% { transform: scale(1.6);  opacity: 0;   }
}

/* Unread badge on the floating button */
#ucega-chat-fab .chat-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    display: none;
}
#ucega-chat-fab .chat-unread-badge.show { display: block; }

/* ---- Invitation tooltip bubble ---- */
#ucega-chat-tooltip {
    position: fixed;
    bottom: 58px;
    right: 92px;
    max-width: 220px;
    background: #ffffff;
    color: #1f2937;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    opacity: 0;
    transform: translateX(8px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
#ucega-chat-tooltip.show {
    opacity: 1;
    transform: translateX(0);
}
#ucega-chat-tooltip .chat-tooltip-close {
    position: absolute;
    top: 4px;
    right: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9ca3af;
    font-size: 12px;
    padding: 0;
}

/* ---- Chat window ---- */
#ucega-chat-window {
    position: fixed;
    bottom: 122px;
    right: 20px;
    width: 350px;
    height: 450px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
#ucega-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
#ucega-chat-window .chat-header {
    background: #0ea5e9;
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#ucega-chat-window .chat-header .chat-title {
    font-size: 15px;
    font-weight: 600;
}
#ucega-chat-window .chat-header .chat-status {
    font-size: 11px;
    opacity: 0.9;
    margin-left: 8px;
}
#ucega-chat-window .chat-header .chat-status::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    margin-right: 5px;
}
#ucega-chat-window .chat-header .chat-actions {
    display: flex;
    gap: 6px;
}
#ucega-chat-window .chat-header .chat-actions button {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    opacity: 0.9;
}
#ucega-chat-window .chat-header .chat-actions button:hover { opacity: 1; }

/* Body / message list */
#ucega-chat-window .chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Visitor capture form */
#ucega-chat-window .chat-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    gap: 10px;
    background: #fff;
}
#ucega-chat-window .chat-form h4 {
    margin: 0 0 4px;
    font-size: 15px;
    color: #1f2937;
}
#ucega-chat-window .chat-form p {
    margin: 0 0 8px;
    font-size: 12px;
    color: #6b7280;
}
#ucega-chat-window .chat-form input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 13px;
    outline: none;
}
#ucega-chat-window .chat-form input:focus {
    border-color: #0ea5e9;
}
#ucega-chat-window .chat-form .chat-form-btn {
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
}
#ucega-chat-window .chat-form .chat-form-btn:hover { background: #0284c7; }

/* Messages */
#ucega-chat-window .chat-msg {
    max-width: 78%;
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}
#ucega-chat-window .chat-msg.admin {
    align-self: flex-start;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 3px;
}
#ucega-chat-window .chat-msg.visitor {
    align-self: flex-end;
    background: #0ea5e9;
    color: #ffffff;
    border-bottom-right-radius: 3px;
}
#ucega-chat-window .chat-msg .chat-time {
    display: block;
    font-size: 10px;
    opacity: 0.7;
    margin-top: 3px;
}

/* Footer input */
#ucega-chat-window .chat-input {
    flex-shrink: 0;
    display: flex;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}
#ucega-chat-window .chat-input input {
    flex: 1;
    border: none;
    padding: 12px;
    font-size: 13px;
    outline: none;
}
#ucega-chat-window .chat-input button {
    background: #0ea5e9;
    color: #fff;
    border: none;
    padding: 0 16px;
    cursor: pointer;
    font-size: 14px;
}
#ucega-chat-window .chat-input button:hover { background: #0284c7; }

/* ---- Cookie consent banner ---- */
#ucega-cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1f2937;
    color: #f9fafb;
    padding: 14px 20px;
    z-index: 9997;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}
#ucega-cookie-banner.show { display: flex; }
#ucega-cookie-banner .cookie-text { max-width: 760px; }
#ucega-cookie-banner .cookie-text a { color: #7dd3fc; text-decoration: underline; }
#ucega-cookie-banner .cookie-actions { display: flex; gap: 8px; flex-shrink: 0; }
#ucega-cookie-banner .cookie-actions button {
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
}
#ucega-cookie-accept { background: #0ea5e9; color: #fff; }
#ucega-cookie-decline { background: #4b5563; color: #fff; }
#ucega-cookie-accept:hover { background: #0284c7; }
#ucega-cookie-decline:hover { background: #374151; }

/* ---- Responsive: mobile near-fullscreen ---- */
@media (max-width: 480px) {
    #ucega-chat-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
        height: calc(100vh - 100px);
        height: calc(100dvh - 100px);
    }
    #ucega-chat-tooltip { right: 80px; bottom: 56px; max-width: 180px; font-size: 12px; }
}
