/* =========================================================================
   LSS Chatbot - Frontend Styles
   ========================================================================= */

:root {
    --lss-accent: #0B6E4F;
    --lss-accent-hover: #0B6E4Fdd;
    --lss-bg: #ffffff;
    --lss-bg-secondary: #f4f6f8;
    --lss-text: #1a1a2e;
    --lss-text-light: #6b7280;
    --lss-border: #e5e7eb;
    --lss-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --lss-radius: 16px;
    --lss-radius-sm: 10px;
    --lss-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Container */
#lss-chatbot-container {
    position: fixed;
    bottom: 24px;
    z-index: 999999;
    font-family: var(--lss-font);
    font-size: 14px;
    line-height: 1.5;
}
#lss-chatbot-container.lss-position-right { right: 24px; }
#lss-chatbot-container.lss-position-left { left: 24px; }

/* Toggle Button */
#lss-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--lss-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}
#lss-chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

/* Chat Window */
#lss-chatbot-window {
    position: absolute;
    bottom: 76px;
    width: 400px;
    max-height: 600px;
    background: var(--lss-bg);
    border-radius: var(--lss-radius);
    box-shadow: var(--lss-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--lss-border);
    animation: lssSlideUp 0.3s ease;
}
.lss-position-right #lss-chatbot-window { right: 0; }
.lss-position-left #lss-chatbot-window { left: 0; }

@keyframes lssSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
#lss-chatbot-header {
    background: var(--lss-accent);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.lss-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.lss-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
}
.lss-header-title {
    font-weight: 600;
    font-size: 15px;
}
.lss-header-subtitle {
    font-size: 12px;
    opacity: 0.8;
}
#lss-chatbot-minimize {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}
#lss-chatbot-minimize:hover { opacity: 1; }

/* Messages Area */
#lss-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 380px;
    min-height: 200px;
    scroll-behavior: smooth;
}
#lss-chatbot-messages::-webkit-scrollbar { width: 5px; }
#lss-chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#lss-chatbot-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

/* Message Bubbles */
.lss-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--lss-radius-sm);
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.6;
    animation: lssFadeIn 0.2s ease;
}
@keyframes lssFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.lss-message-bot {
    background: var(--lss-bg-secondary);
    color: var(--lss-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.lss-message-user {
    background: var(--lss-accent);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.lss-typing {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    align-self: flex-start;
    background: var(--lss-bg-secondary);
    border-radius: var(--lss-radius-sm);
    border-bottom-left-radius: 4px;
}
.lss-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lss-text-light);
    animation: lssTypingBounce 1.2s infinite;
}
.lss-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.lss-typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes lssTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Course Suggestion */
.lss-course-suggestion {
    background: linear-gradient(135deg, var(--lss-accent)10, var(--lss-accent)05);
    border: 1px solid var(--lss-accent)30;
    border-radius: var(--lss-radius-sm);
    padding: 12px 16px;
    margin-top: 8px;
    align-self: flex-start;
    max-width: 85%;
}
.lss-course-suggestion a {
    color: var(--lss-accent);
    font-weight: 600;
    text-decoration: none;
}
.lss-course-suggestion a:hover {
    text-decoration: underline;
}

/* Input Area */
#lss-chatbot-input-area {
    padding: 14px 18px;
    border-top: 1px solid var(--lss-border);
    flex-shrink: 0;
    background: var(--lss-bg);
}
.lss-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--lss-bg-secondary);
    border-radius: var(--lss-radius-sm);
    padding: 6px 6px 6px 14px;
    border: 1px solid var(--lss-border);
    transition: border-color 0.2s;
}
.lss-input-wrapper:focus-within {
    border-color: var(--lss-accent);
}
#lss-chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 14px;
    font-family: var(--lss-font);
    line-height: 1.5;
    color: var(--lss-text);
    padding: 6px 0;
    max-height: 100px;
    outline: none;
}
#lss-chatbot-input::placeholder { color: var(--lss-text-light); }

#lss-chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--lss-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}
#lss-chatbot-send:hover { background: var(--lss-accent-hover); transform: scale(1.05); }
#lss-chatbot-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Footer */
#lss-chatbot-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
    color: var(--lss-text-light);
}
#lss-chatbot-footer a {
    color: var(--lss-accent);
    text-decoration: none;
    font-weight: 500;
}
#lss-chatbot-footer a:hover { text-decoration: underline; }

/* Lead Capture Form */
#lss-lead-form {
    padding: 0 18px 18px;
}
.lss-lead-form-inner {
    background: var(--lss-bg-secondary);
    border-radius: var(--lss-radius-sm);
    padding: 20px;
    border: 1px solid var(--lss-border);
    animation: lssFadeIn 0.3s ease;
}
.lss-lead-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--lss-text);
    margin: 0 0 4px;
}
.lss-lead-subtitle {
    font-size: 12px;
    color: var(--lss-text-light);
    margin: 0 0 14px;
}
#lss-lead-form input,
#lss-lead-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--lss-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: var(--lss-font);
    margin-bottom: 10px;
    box-sizing: border-box;
    background: var(--lss-bg);
    color: var(--lss-text);
    transition: border-color 0.2s;
}
#lss-lead-form input:focus,
#lss-lead-form select:focus {
    outline: none;
    border-color: var(--lss-accent);
}
#lss-lead-submit {
    width: 100%;
    padding: 10px;
    background: var(--lss-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 6px;
}
#lss-lead-submit:hover { background: var(--lss-accent-hover); }

/* Limit reached banner */
.lss-limit-banner {
    background: linear-gradient(135deg, var(--lss-accent), #0d8f66);
    color: #fff;
    padding: 16px;
    border-radius: var(--lss-radius-sm);
    text-align: center;
    align-self: stretch;
    max-width: 100%;
}
.lss-limit-banner a {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #lss-chatbot-window {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 120px);
        bottom: 70px;
        right: -12px !important;
        left: auto !important;
    }
    .lss-position-left #lss-chatbot-window {
        left: -12px !important;
        right: auto !important;
    }
    #lss-chatbot-container {
        bottom: 16px;
    }
    #lss-chatbot-container.lss-position-right { right: 16px; }
    #lss-chatbot-container.lss-position-left { left: 16px; }
}
