/* Custom AI Chatbot Widget Styles - Dark Mode Premium */

:root {
    --chat-bg: #0F172A; /* Very dark blue/black */
    --chat-surface: #1E293B; /* Slightly lighter surface for cards */
    --chat-primary: #38BDF8; /* Light blue accent */
    --chat-text-primary: #F8FAFC;
    --chat-text-secondary: #94A3B8;
    --chat-border: #334155;
}

#gls-chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#gls-chat-button {
    width: 60px;
    height: 60px;
    background-color: var(--chat-primary);
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
}

#gls-chat-button:hover {
    transform: scale(1.08);
}

#gls-chat-button svg {
    fill: white;
    width: 30px;
    height: 30px;
}

#gls-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 650px;
    max-height: 85vh;
    background-color: var(--chat-bg);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease;
    border: 1px solid var(--chat-border);
    color: var(--chat-text-primary);
}

#gls-chat-window.open {
    display: flex;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); scale: 0.95; }
    to { opacity: 1; transform: translateY(0); scale: 1; }
}

/* Header Area */
#gls-chat-header {
    background-color: var(--chat-surface);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--chat-border);
}

#gls-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#gls-chat-header-info img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
    background: #000;
    padding: 2px;
}

.gls-header-text {
    display: flex;
    flex-direction: column;
}

#gls-chat-header-title {
    font-weight: 600;
    font-size: 15px;
    margin: 0;
    color: var(--chat-text-primary);
}

#gls-chat-header-status {
    font-size: 13px;
    color: #10B981; /* Green dot */
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
#gls-chat-header-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #10B981;
    border-radius: 50%;
}

#gls-chat-close {
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--chat-text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    transition: background 0.2s;
}

#gls-chat-close:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Main View Wrapper (Handles switching between Home and Chat) */
#gls-views-container {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.gls-view {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, opacity 0.3s ease;
    background-color: var(--chat-bg);
}

/* --- HOME VIEW --- */
#gls-home-view {
    padding: 24px;
    overflow-y: auto;
    z-index: 2;
}

#gls-home-view.hidden {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.gls-welcome-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 10px 0;
}

.gls-welcome-subtitle {
    font-size: 15px;
    color: var(--chat-text-secondary);
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.gls-main-action-btn {
    background-color: var(--chat-surface);
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    text-align: left;
    margin-bottom: 32px;
}
.gls-main-action-btn:hover {
    background-color: #283548;
}
.gls-main-action-icon {
    font-size: 20px;
}
.gls-main-action-text {
    flex: 1;
}
.gls-main-action-text h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    color: white;
}
.gls-main-action-text p {
    margin: 0;
    font-size: 13px;
    color: var(--chat-text-secondary);
}
.gls-main-action-arrow {
    color: var(--chat-text-secondary);
}

.gls-quick-paths-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--chat-text-secondary);
    margin: 0 0 12px 0;
    font-weight: 600;
}

.gls-quick-path {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--chat-border);
    color: white;
    padding: 16px 0;
    width: 100%;
    text-align: left;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s;
}
.gls-quick-path:hover {
    color: var(--chat-primary);
}
.gls-quick-path span.arrow {
    color: var(--chat-text-secondary);
    font-size: 12px;
}
.gls-quick-path:last-child {
    border-bottom: none;
}

/* --- LEAD FORM VIEW --- */
#gls-lead-view {
    padding: 24px;
    z-index: 3;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}
#gls-lead-view.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}
.gls-form-title {
    font-size: 20px;
    margin: 0 0 8px 0;
}
.gls-form-desc {
    font-size: 14px;
    color: var(--chat-text-secondary);
    margin: 0 0 24px 0;
}
.gls-input-group {
    margin-bottom: 16px;
}
.gls-input-group label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--chat-text-secondary);
}
.gls-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--chat-surface);
    border: 1px solid var(--chat-border);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}
.gls-input:focus {
    border-color: var(--chat-primary);
}
.gls-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--chat-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.gls-submit-btn:hover {
    background: #0ea5e9;
}

/* --- CHAT VIEW --- */
#gls-chat-view {
    z-index: 4;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}
#gls-chat-view.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

#gls-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gls-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}
.gls-message p { margin: 0 0 8px 0; }
.gls-message p:last-child { margin: 0; }

.gls-message.bot {
    align-self: flex-start;
    background-color: var(--chat-surface);
    color: var(--chat-text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--chat-border);
}

.gls-message.user {
    align-self: flex-end;
    background-color: var(--chat-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

#gls-chat-input-area {
    padding: 16px;
    background-color: var(--chat-bg);
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 10px;
}

#gls-chat-input {
    flex: 1;
    padding: 12px 16px;
    background-color: var(--chat-surface);
    border: 1px solid var(--chat-border);
    border-radius: 24px;
    color: white;
    outline: none;
    font-size: 14px;
}
#gls-chat-input:focus {
    border-color: var(--chat-primary);
}

#gls-chat-send {
    background-color: var(--chat-primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Typing Indicator */
.gls-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background-color: var(--chat-surface);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}
.gls-typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--chat-text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}
.gls-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.gls-typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Bottom Navigation Bar */
#gls-bottom-nav {
    display: flex;
    background-color: var(--chat-surface);
    border-top: 1px solid var(--chat-border);
    padding: 8px 0;
}
.gls-nav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--chat-text-secondary);
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px 0;
}
.gls-nav-btn.active {
    color: white;
}
.gls-nav-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
.gls-powered-by {
    text-align: center;
    font-size: 11px;
    color: var(--chat-text-secondary);
    padding: 8px 0 12px 0;
    background-color: var(--chat-bg);
}
.gls-powered-by span {
    font-weight: bold;
    color: white;
}

@media (max-width: 480px) {
    #gls-chat-window {
        position: fixed;
        bottom: 0; right: 0;
        width: 100%; height: 100%; max-height: 100%;
        border-radius: 0;
    }
}
