/* ===========================
   Chatbot Widget Styles
   =========================== */

.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
}

/* Chatbot Button */
.chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(37, 99, 235, 0.5);
}

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

.chatbot-icon,
.chatbot-close-icon {
    width: 28px;
    height: 28px;
    transition: all 0.3s ease;
}

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

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

.chatbot-button.open .chatbot-close-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Notification Badge */
.chatbot-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid #fff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Chat Window */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chatbot-avatar img {
    width: 80%;
    height: 80%;
    object-fit: cover;
}

.chatbot-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.status-dot.online {
    background: #22c55e;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0);
    }
}

.chatbot-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-minimize svg {
    width: 20px;
    height: 20px;
}

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

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

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

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

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

/* Messages */
.chatbot-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: messageSlideIn 0.3s ease;
}

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

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    white-space: pre-line;
    line-height: 1.5;
}

.bot-message .message-content {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: #2563eb;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #64748b;
    padding: 0 4px;
}

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

.user-message .message-time {
    align-self: flex-end;
}

.message-link {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 14px;
    background: #2563eb;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
    align-self: flex-start;
}

.message-link:hover {
    background: #1d4ed8;
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.quick-reply-btn {
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 14px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.quick-reply-btn:hover {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    transform: translateY(-2px);
}

/* Input Area */
.chatbot-input-area {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 16px 16px;
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

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

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2563eb;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-send-btn:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

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

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

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

    .chatbot-window {
        width: calc(100vw - 30px);
        max-width: calc(100vw - 30px);
        height: calc(100vh - 120px);
        bottom: 85px;
        right: 15px;
        border-radius: 20px;
    }

    .chatbot-button {
        width: 60px;
        height: 60px;
        box-shadow: 0 6px 24px rgba(37, 99, 235, 0.5);
    }

    .chatbot-header {
        padding: 16px;
    }

    .chatbot-messages {
        padding: 16px;
    }

    .quick-replies {
        flex-wrap: wrap;
    }

    .quick-reply-btn {
        font-size: 13px;
        padding: 8px 14px;
    }
}

@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 10px;
        right: 10px;
    }

    .chatbot-window {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 75px;
        right: 10px;
        left: 10px;
        margin: 0 auto;
        border-radius: 16px;
    }

    .chatbot-button {
        width: 56px;
        height: 56px;
    }

    .chatbot-header {
        padding: 14px;
    }

    .chatbot-title {
        font-size: 15px;
    }

    .chatbot-status {
        font-size: 12px;
    }

    .chatbot-avatar {
        width: 36px;
        height: 36px;
    }

    .chatbot-messages {
        padding: 12px;
        gap: 10px;
    }

    .message-content {
        font-size: 14px;
        padding: 10px 14px;
    }

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

    .chatbot-input {
        font-size: 14px;
        padding: 10px 14px;
    }

    .quick-reply-btn {
        font-size: 12px;
        padding: 7px 12px;
    }
}
