/* ============================================
   CHATBOT UI - Professional Theme
   Always Light Theme
   ============================================ */

/* --- Chatbot Toggle Button --- */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9000;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b00, #ff8c33);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 107, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 30px rgba(255, 107, 0, 0.6);
}

.chatbot-toggle .icon-chat {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle .icon-chat svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}

.chatbot-toggle .icon-close {
    display: none;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle .icon-close svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

.chatbot-toggle.active .icon-chat {
    display: none;
}

.chatbot-toggle.active .icon-close {
    display: flex;
}

/* --- Chatbot Window --- */
.chatbot-window {
    position: fixed;
    bottom: 95px;
    right: 20px;
    z-index: 9001;
    width: 380px;
    height: 520px;
    min-width: 300px;
    min-height: 400px;
    max-width: 90vw;
    max-height: calc(100vh - 130px);
    border-radius: 16px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    resize: both;
}

.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Resize Handle Indicator */
.chatbot-window::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, transparent 50%, #ddd 50%, #ddd 60%, transparent 60%, transparent 70%, #ddd 70%, #ddd 80%, transparent 80%);
    pointer-events: none;
    opacity: 0.5;
    border-radius: 0 0 8px 0;
}

/* --- Chatbot Header --- */
.chatbot-header {
    background: #ffffff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b00, #ff8c33);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(255, 107, 0, 0.3);
    overflow: hidden;
    flex-shrink: 0;
}

.chatbot-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    border-radius: 50%;
}

.chatbot-header-text h3 {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.chatbot-header-text span {
    font-size: 0.75rem;
    color: #888;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-header-text span::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}

.chatbot-close {
    background: #f5f5f5;
    border: 1px solid #eee;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 107, 0, 0.1);
    border-color: rgba(255, 107, 0, 0.3);
    color: #ff6b00;
}

.chatbot-close svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* --- Chat Messages Area --- */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f9f9f9;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* --- Message Bubbles --- */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: messageSlide 0.3s ease;
}

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

.chat-message.bot {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.msg-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    border-radius: 50%;
}

.chat-message.bot .message-avatar {
    background: linear-gradient(135deg, #ff6b00, #ff8c33);
}

.chat-message.user .message-avatar {
    background: #1a1a1a;
}

.chat-message.user .message-avatar svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.6;
    font-family: 'Inter', sans-serif;
    color: #333;
}

.chat-message.bot .message-bubble {
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, #ff6b00, #ff8c33);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 10px rgba(255, 107, 0, 0.25);
}

.message-bubble strong {
    font-weight: 600;
    color: #ff6b00;
}

.chat-message.user .message-bubble strong {
    color: #fff;
}

.message-bubble ul, .message-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-bubble li {
    margin-bottom: 4px;
    color: #444;
}

.message-time {
    font-size: 0.68rem;
    color: #999;
    padding: 0 4px;
}

.chat-message.user .message-time {
    text-align: right;
    color: #999;
}

/* --- Typing Indicator --- */
.typing-indicator {
    display: none;
    align-self: flex-start;
    max-width: 88%;
}

.typing-indicator.show {
    display: flex;
}

.typing-indicator .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b00, #ff8c33);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff6b00;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* --- Quick Replies --- */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px;
    background: #ffffff;
    border-top: 1px solid #eee;
}

.quick-reply-btn {
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #555;
    font-size: 0.72rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
}

.quick-reply-btn:hover {
    background: rgba(255, 107, 0, 0.08);
    border-color: #ff6b00;
    color: #ff6b00;
}

.quick-reply-btn svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

/* --- Welcome Screen --- */
.chatbot-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px 20px;
    text-align: center;
    animation: welcomeFadeIn 0.5s ease;
}

.chatbot-welcome.hidden {
    display: none;
}

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

.welcome-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b00, #ff8c33);
    padding: 3px;
    box-shadow: 0 4px 20px rgba(255, 107, 0, 0.3);
    margin-bottom: 16px;
}

.welcome-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    border: 2px solid #fff;
}

.welcome-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.welcome-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    color: #888;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.welcome-suggestions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.suggestion-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
}

.suggestion-btn:hover {
    background: rgba(255, 107, 0, 0.04);
    border-color: rgba(255, 107, 0, 0.4);
    transform: translateX(4px);
    box-shadow: 0 2px 12px rgba(255, 107, 0, 0.12);
}

.suggestion-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 107, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.suggestion-icon svg {
    width: 20px;
    height: 20px;
    fill: #ff6b00;
}

.suggestion-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.suggestion-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1a1a1a;
}

.suggestion-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #999;
}

/* --- Chat Input Area --- */
.chatbot-input {
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    background: #ffffff;
    border-top: 1px solid #eee;
}

.chatbot-input input {
    flex: 1;
    padding: 13px 18px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    background: #f5f5f5;
    color: #333;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}

.chatbot-input input::placeholder {
    color: #999;
}

.chatbot-input input:focus {
    border-color: #ff6b00;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
    background: #fff;
}

.chatbot-send {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff6b00, #ff8c33);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(255, 107, 0, 0.3);
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(255, 107, 0, 0.5);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* --- Responsive Design --- */
@media (max-width: 480px) {
    .chatbot-toggle {
        bottom: 20px;
        right: 15px;
        width: 52px;
        height: 52px;
    }

    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        min-width: 100%;
        min-height: 100%;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        resize: none;
    }

    .chatbot-window::after {
        display: none;
    }

    .chatbot-header {
        border-radius: 0;
        padding: 14px 16px;
    }

    .chatbot-messages {
        padding: 16px;
    }

    .chatbot-input {
        padding: 12px 16px;
    }

    .quick-replies {
        padding: 10px 16px;
    }

    .chatbot-welcome {
        padding: 20px 16px 16px;
    }

    .welcome-avatar {
        width: 60px;
        height: 60px;
    }

    .welcome-title {
        font-size: 1.05rem;
    }

    .welcome-subtitle {
        font-size: 0.78rem;
    }

    .suggestion-btn {
        padding: 12px 14px;
    }

    .suggestion-icon {
        width: 36px;
        height: 36px;
    }

    .suggestion-icon svg {
        width: 18px;
        height: 18px;
    }

    .suggestion-title {
        font-size: 0.84rem;
    }

    .suggestion-desc {
        font-size: 0.72rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .chatbot-window {
        width: 340px !important;
        height: 480px !important;
        right: 15px;
        bottom: 90px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .chatbot-window {
        width: 360px !important;
        height: 500px !important;
        right: 25px;
    }
}
