/* ==========================================================================
   GG Live Chat Widget Styles
   ========================================================================== */

/* Widget container - fixed to bottom right
   ========================================================================== */
.gg-live-chat-widget {
    --primary-color: #2563eb;
    --primary-color-text: #fff;
    --primary-color-hover: var(--primary-color);
    --primary-color-hover: oklch(from var(--primary-color) calc(l - 0.15) c h);
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Launcher button (chat icon)
   ========================================================================== */
.gg-live-chat-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color)!important;
    color: var(--primary-color-text)!important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    border: none;
    outline: none;
    position: relative;
    float: right;
}

.gg-live-chat-launcher:hover {
    background-color: var(--primary-color-hover)!important;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.gg-live-chat-launcher:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.gg-live-chat-launcher svg {
    width: 28px;
    height: 28px;
}

/* Chat window
   ========================================================================== */
.gg-live-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: gg-live-chat-slide-up 0.3s ease;
}

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

/* Chat header
   ========================================================================== */
.gg-live-chat-header {
    background-color: var(--primary-color)!important;
    color: var(--primary-color-text)!important;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.gg-live-chat-header-title {
    font-size: 16px;
    font-weight: 600;
}

.gg-live-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gg-live-chat-header-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gg-live-chat-header-close:hover {
    opacity: 1;
}

.gg-live-chat-header-close svg {
    width: 20px;
    height: 20px;
}

/* Chat body - messages area
   ========================================================================== */
.gg-live-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #f8fafc;
}

.gg-live-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Individual messages
   ========================================================================== */
.gg-live-chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.4;
    animation: gg-live-chat-message-in 0.2s ease;
}

@keyframes gg-live-chat-message-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gg-live-chat-message--visitor {
    background-color: var(--primary-color)!important;
    color: var(--primary-color-text)!important;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.gg-live-chat-message--agent {
    background-color: #e2e8f0;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.gg-live-chat-message--system {
    background-color: transparent;
    color: #64748b;
    align-self: center;
    max-width: 100%;
    font-size: 12px;
    text-align: center;
    font-style: italic;
}

.gg-live-chat-message .gg-live-chat-message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
}

/* Typing indicator
   ========================================================================== */
.gg-live-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
    background-color: #94a3b8;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    margin-top: 4px;
}

.gg-live-chat-typing-dot {
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
    animation: gg-live-chat-typing-bounce 1.4s infinite ease-in-out;
}

.gg-live-chat-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.gg-live-chat-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.gg-live-chat-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes gg-live-chat-typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* Input area
   ========================================================================== */
.gg-live-chat-input-area {
    border-top: 1px solid #e2e8f0;
    background: #fff;
    padding: 12px 16px;
    flex-shrink: 0;
}

/* Name form (pre-chat name collection)
   ========================================================================== */
.gg-live-chat-name-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gg-live-chat-intro-message {
    color: #64748b;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.gg-live-chat-name-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gg-live-chat-name-input,
.gg-live-chat-email-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.gg-live-chat-name-input:focus,
.gg-live-chat-email-input:focus {
    border-color: var(--primary-color)!important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.gg-live-chat-name-submit {
    padding: 10px 18px;
    background-color: var(--primary-color)!important;
    color: var(--primary-color-text)!important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s;
    font-family: inherit;
}

.gg-live-chat-name-submit:hover {
    background-color: var(--primary-color-hover)!important;
}

/* End Conversation button
   ========================================================================== */
.gg-live-chat-end-chat-btn {
    display: none;
    width: 100%;
    margin-top: 8px;
    padding: 8px 16px;
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #ef4444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
}

.gg-live-chat-end-chat-btn:hover {
    background-color: #fef2f2;
    border-color: #fecaca;
}

/* Message form (chat input after connected)
   ========================================================================== */
.gg-live-chat-message-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.gg-live-chat-message-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.gg-live-chat-message-input:focus {
    border-color: var(--primary-color)!important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.gg-live-chat-send-btn {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color)!important;
    color: var(--primary-color-text)!important;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.gg-live-chat-send-btn:hover {
    background-color: var(--primary-color-hover)!important;
}

.gg-live-chat-send-btn:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
}

.gg-live-chat-send-btn svg {
    width: 20px;
    height: 20px;
}

/* Business hours notice banner
   ========================================================================== */
.gg-live-chat-bh-notice {
    background-color: #fef3c7;
    border: 1px solid #fbbf24;
    color: #92400e;
    font-size: 12px;
    line-height: 1.4;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    text-align: center;
    flex-shrink: 0;
}

/* Ended conversation view
   ========================================================================== */
.gg-live-chat-ended-view {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
    flex: 1;
}

.gg-live-chat-ended-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 280px;
}

.gg-live-chat-ended-content svg {
    color: #22c55e;
    margin-bottom: 4px;
}

.gg-live-chat-ended-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.gg-live-chat-ended-text {
    font-size: 14px;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

.gg-live-chat-start-new-btn {
    margin-top: 8px;
    padding: 10px 24px;
    background-color: var(--primary-color)!important;
    color: var(--primary-color-text)!important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
    font-family: inherit;
}

.gg-live-chat-start-new-btn:hover {
    background-color: var(--primary-color-hover)!important;
}

/* Footer
   ========================================================================== */
.gg-live-chat-footer {
    padding: 8px 16px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

.gg-live-chat-footer-text {
    font-size: 11px;
    color: #94a3b8;
}

/* Connection status
   ========================================================================== */
.gg-live-chat-status {
    font-size: 12px;
    color: #64748b;
    padding: 12px 16px;
    text-align: center;
    display: none;
}

.gg-live-chat-status--visible {
    display: block;
}

.gg-live-chat-status--error {
    color: #ef4444;
}

/* Mobile responsive
   ========================================================================== */
@media (max-width: 480px) {

    .gg-live-chat-launcher {
        position: fixed;
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .gg-live-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .gg-live-chat-header {
        padding: 14px 16px;
        padding-top: calc(14px + env(safe-area-inset-top, 0px));
    }

    .gg-live-chat-messages {
        padding: 12px;
    }

    .gg-live-chat-input-area {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}