/**
 * AI Chatbot - Frontend Widget Styles
 * Version: 1.1.0
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --ai-chatbot-primary: #0073aa;
}

* {
    box-sizing: border-box;
}

.ai-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    z-index: 999999;
    font-size: 14px;
    line-height: 1.5;
}

.ai-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    cursor: pointer !important;
    font-size: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: linear-gradient(135deg, rgba(31, 38, 135, 0.15) 0%, rgba(31, 38, 135, 0.08) 100%) !important;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ai-chatbot-toggle:hover {
    transform: scale(1.12) translateY(-3px) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.4) !important;
    background: linear-gradient(135deg, rgba(31, 38, 135, 0.22) 0%, rgba(31, 38, 135, 0.12) 100%) !important;
    border-color: rgba(255, 255, 255, 0.5);
}

.ai-chatbot-toggle:active {
    transform: scale(0.98);
}

.ai-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ai-chatbot-window.hidden {
    display: none !important;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

.chat-header {
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: rgba(31, 38, 135, 0.08);
    backdrop-filter: blur(30px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), inset 0 1px 0px rgba(255, 255, 255, 0.15);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.chat-close {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white;
    font-size: 26px;
    cursor: pointer !important;
    padding: 4px 8px !important;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    backdrop-filter: blur(20px);
    font-weight: 300;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    transform: rotate(90deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chat-visitor-form {
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #ffffff;
    flex: 1;
    overflow-y: auto;
    align-items: center;
}

.chat-visitor-form p {
    margin: 0 0 16px 0;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    font-weight: 500;
}

.visitor-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(0,0,0,0.1) !important;
    border-radius: 12px;
    font-size: 14px;
    background: #f8f9fa;
    color: #333 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.visitor-input:focus {
    outline: none;
    border-color: var(--ai-chatbot-primary) !important;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(var(--ai-chatbot-primary-rgb, 0, 115, 170), 0.1) !important;
    transform: translateY(-1px);
}

.visitor-input::placeholder { color: #aaa; font-weight: 400; }

.visitor-submit {
    width: 100%;
    padding: 14px;
    color: white;
    border: none !important;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 8px 0 0 0;
    background: var(--ai-chatbot-primary) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    letter-spacing: 0.3px;
}

.visitor-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.visitor-submit:active { transform: translateY(0); }

.guest-divider {
    text-align: center;
    color: #999;
    font-size: 13px;
    margin: 12px 0;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
    width: 100%;
}
.guest-divider::before, .guest-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: rgba(0,0,0,0.08);
}
.guest-divider::before { left: 0; }
.guest-divider::after { right: 0; }

.guest-submit {
    width: 100%;
    padding: 12px;
    color: var(--ai-chatbot-primary);
    border: 1px solid var(--ai-chatbot-primary) !important;
    background: transparent;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer !important;
    transition: all 0.2s ease;
    margin: 0;
}

.guest-submit:hover {
    background: rgba(var(--ai-chatbot-primary-rgb, 0, 115, 170), 0.05);
    transform: translateY(-1px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.01);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

.message {
    display: flex;
    animation: messageSlideUp 0.3s ease-out;
}

.message.bot-message  { justify-content: flex-start; }
.message.user-message { justify-content: flex-end; }

.message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 10px 15px -3px rgba(0,0,0,0.1);
}

@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.message.bot-message .message-content {
    background: #ffffff;
    color: #1a1a2e;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 4px;
}

.message.user-message .message-content {
    background: var(--ai-chatbot-primary);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    align-items: center;
    height: 24px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #b0b0b0;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

.chat-input-area {
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-shrink: 0;
    position: relative;
}

.chat-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.chat-input {
    flex: 1;
    border: 1px solid rgba(0,0,0,0.1) !important;
    border-radius: 24px;
    padding: 14px 48px 14px 16px;
    font-size: 14px;
    outline: none;
    background: #f8f9fa;
    color: #333 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.chat-input::placeholder { color: #aaa; }

.chat-input:focus {
    border-color: var(--ai-chatbot-primary) !important;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(var(--ai-chatbot-primary-rgb, 0, 115, 170), 0.1);
}

.chat-send {
    position: absolute;
    right: 4px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    border: none !important;
    cursor: pointer !important;
    font-size: 14px;
    flex-shrink: 0;
    padding: 0 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ai-chatbot-primary) !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

@media (max-width: 600px) {
    .ai-chatbot-window {
        width: calc(100vw - 24px) !important;
        height: calc(100vh - 120px) !important;
        right: 12px !important;
        bottom: 70px !important;
        border-radius: 24px;
    }

    .chat-header { padding: 16px; }
    .chat-header h3 { font-size: 16px; }
    .message-content { max-width: 90%; font-size: 13px; }
}
