/* ===================================================================
   FIGMA-STYLE CHATBOT WIDGET
   Clean, minimal chat interface inspired by Figma docs chatbot
   =================================================================== */

/* Chatbot Widget Container */
.chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
        "Helvetica", "Arial", sans-serif;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #000000;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
}

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

/* Toggle Icons */
.chatbot-icon,
.chatbot-close-icon {
    width: 24px;
    height: 24px;
    color: #ffffff;
    transition: all 0.2s ease;
    position: absolute;
}

.chatbot-close-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

.chatbot-toggle.active .chatbot-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

.chatbot-toggle.active .chatbot-close-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Chatbot Window */
.chatbot-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 420px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-window.active {
    display: flex;
}

/* Chatbot Header */
.chatbot-header {
    background: #000000;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-menu-btn,
.chatbot-close-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.chatbot-menu-btn:hover,
.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chatbot-menu-btn svg,
.chatbot-close-btn svg {
    width: 20px;
    height: 20px;
    color: #ffffff;
}

.chatbot-header h3 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    flex: 1;
    text-align: center;
}

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

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

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

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #c0c0c0;
}

/* Powered By Badge */
.chatbot-powered-by {
    text-align: center;
    font-size: 12px;
    color: #c0c0c0;
    margin-bottom: 16px;
}

/* Timestamp */
.chatbot-timestamp {
    text-align: center;
    font-size: 13px;
    color: #909090;
    margin-bottom: 16px;
    font-weight: 400;
}

/* Message */
.chatbot-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeInMessage 0.3s ease;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.message-bubble {
    background: #f0f0f0;
    border-radius: 16px;
    padding: 12px 16px;
    max-width: 80%;
}

.message-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #000000;
}

/* User Messages */
.user-message {
    flex-direction: row-reverse;
}

.user-message .message-bubble {
    background: #000000;
    color: #ffffff;
}

.user-message .message-bubble p {
    color: #ffffff;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f0f0f0;
    border-radius: 16px;
    width: fit-content;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #909090;
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

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

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

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

/* Disclaimer */
.chatbot-disclaimer {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.chatbot-disclaimer p {
    margin: 0;
    font-size: 11px;
    line-height: 1.5;
    color: #707070;
}

.chatbot-disclaimer a {
    color: #6b5aed;
    text-decoration: none;
}

.chatbot-disclaimer a:hover {
    text-decoration: underline;
}

/* Input Container */
.chatbot-input-container {
    padding: 16px 20px 20px 20px;
    background: #ffffff;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color 0.2s ease;
    background: #ffffff;
    color: #000000;
}

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

.chatbot-input:focus {
    border-color: #000000;
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #000000;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    background: #333333;
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

.chatbot-send-btn:disabled {
    background: #e0e0e0;
    cursor: not-allowed;
}

.chatbot-send-btn svg {
    width: 20px;
    height: 20px;
    color: #ffffff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-widget {
        bottom: 16px;
        right: 16px;
    }

    .chatbot-toggle {
        width: 52px;
        height: 52px;
    }

    .chatbot-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        bottom: 68px;
        right: 0;
        left: 16px;
    }
}

/* Accessibility */
.chatbot-toggle:focus,
.chatbot-menu-btn:focus,
.chatbot-close-btn:focus,
.chatbot-send-btn:focus {
    outline: 2px solid #6b5aed;
    outline-offset: 2px;
}

.chatbot-input:focus {
    outline: none;
}

/* Print Styles */
@media print {
    .chatbot-widget {
        display: none !important;
    }
}

/* Loading State */
.chatbot-window.loading {
    pointer-events: none;
}

.chatbot-window.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Auto-expanding textarea */
.chatbot-input {
    overflow-y: hidden;
}
