/* GG Chat Widget Styles */
#gg-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#gg-chat-widget.gg-chat-bottom-right { bottom: 20px; right: 20px; }
#gg-chat-widget.gg-chat-bottom-left { bottom: 20px; left: 20px; }

/* Launcher Button */
.gg-chat-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.3s, box-shadow 0.3s;
}
.gg-chat-launcher:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.gg-chat-launcher svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}
.gg-chat-launcher .close-icon { display: none; }
.gg-chat-launcher.open .chat-icon { display: none; }
.gg-chat-launcher.open .close-icon { display: block; }

/* Chat Window */
.gg-chat-window {
    position: absolute;
    bottom: 76px;
    width: 370px;
    height: 520px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    background: #fff;
    animation: gg-chat-slide-up 0.3s ease;
}
.gg-chat-bottom-right .gg-chat-window { right: 0; }
.gg-chat-bottom-left .gg-chat-window { left: 0; }
.gg-chat-window.open { display: flex; }

@keyframes gg-chat-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.gg-chat-header {
    padding: 20px;
    color: #fff;
}
.gg-chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}
.gg-chat-header p {
    margin: 4px 0 0;
    font-size: 12px;
    opacity: 0.85;
}

/* Messages Area */
.gg-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
}
.gg-chat-msg {
    margin-bottom: 12px;
    display: flex;
}
.gg-chat-msg.visitor { justify-content: flex-end; }
.gg-chat-msg.bot, .gg-chat-msg.agent { justify-content: flex-start; }
.gg-chat-msg.system { justify-content: center; }
.gg-chat-msg .bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}
.gg-chat-msg.visitor .bubble {
    border-bottom-right-radius: 4px;
    color: #fff;
}
.gg-chat-msg.bot .bubble, .gg-chat-msg.agent .bubble {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
    color: #1f2937;
}
.gg-chat-msg.system .bubble {
    background: transparent;
    color: #6b7280;
    font-size: 11px;
    font-style: italic;
}
.gg-chat-msg .sender {
    font-size: 10px;
    color: #6b7280;
    margin-bottom: 2px;
}

/* Typing indicator */
.gg-chat-typing {
    display: none;
    padding: 8px 16px;
}
.gg-chat-typing.show { display: block; }
.gg-chat-typing .dots {
    display: inline-flex;
    gap: 4px;
}
.gg-chat-typing .dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: gg-typing 1.4s infinite;
}
.gg-chat-typing .dots span:nth-child(2) { animation-delay: 0.2s; }
.gg-chat-typing .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes gg-typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Input Area */
.gg-chat-footer {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}
.gg-chat-footer form {
    display: flex;
    gap: 8px;
}
.gg-chat-footer input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.gg-chat-footer input[type="text"]:focus {
    border-color: var(--gg-chat-color, #7c3aed);
}
.gg-chat-footer button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}
.gg-chat-footer button:hover { opacity: 0.85; }
.gg-chat-footer button svg { width: 18px; height: 18px; fill: #fff; }

/* Pre-chat form */
.gg-chat-prechat {
    padding: 20px;
    background: #f9fafb;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.gg-chat-prechat h5 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #1f2937;
}
.gg-chat-prechat input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 10px;
    box-sizing: border-box;
}
.gg-chat-prechat button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* Unread badge */
.gg-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}
.gg-chat-badge.show { display: flex; }

/* Mobile responsive */
@media (max-width: 480px) {
    .gg-chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        bottom: 76px;
        right: -4px !important;
        left: -4px !important;
        border-radius: 12px;
    }
}
