/* ==========================================================================
   LIVE CHAT WIDGET (visitor-facing)
   ========================================================================== */

.gtm-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1300;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.gtm-chat-bubble {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #2d7a8c 0%, #1e3a5f 100%);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(30, 58, 95, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.gtm-chat-bubble:hover {
    transform: translateY(-2px) scale(1.03);
}

.gtm-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ff6b35;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.gtm-chat-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 460px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(18, 41, 63, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gtm-chat-panel[hidden] {
    display: none;
}

.gtm-chat-panel-header {
    background: linear-gradient(135deg, #2d7a8c 0%, #1e3a5f 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.92rem;
}

.gtm-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.85;
}

.gtm-chat-close:hover {
    opacity: 1;
}

.gtm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #F9FAFB;
}

.gtm-chat-welcome {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #4B5563;
    align-self: flex-start;
    max-width: 85%;
}

.gtm-chat-bubble-msg {
    max-width: 82%;
    padding: 9px 13px;
    border-radius: 13px;
    font-size: 0.85rem;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.gtm-chat-bubble-msg.visitor {
    align-self: flex-end;
    background: linear-gradient(135deg, #2d7a8c 0%, #1e3a5f 100%);
    color: #fff;
    border-bottom-right-radius: 3px;
}

.gtm-chat-bubble-msg.admin {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #E5E7EB;
    color: #1F2937;
    border-bottom-left-radius: 3px;
}

.gtm-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #EEF1F6;
    background: #fff;
}

.gtm-chat-form textarea {
    flex: 1;
    resize: none;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 0.85rem;
    font-family: inherit;
    min-height: 38px;
    max-height: 90px;
}

.gtm-chat-form textarea:focus {
    outline: none;
    border-color: #2d7a8c;
    box-shadow: 0 0 0 3px rgba(45, 122, 140, 0.12);
}

.gtm-chat-form button {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c4a 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gtm-chat-form button:disabled {
    opacity: 0.6;
    cursor: default;
}

@media (max-width: 480px) {
    .gtm-chat-widget {
        right: 12px;
        bottom: 12px;
    }
    .gtm-chat-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 120px);
        bottom: 70px;
    }
}
