/**
 * BÜYEM Chatbot Stilleri
 * Sağ alt köşede şık bir chatbot arayüzü
 */

/* Chatbot Container */
.buyem-chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d458b 0%, #0f73a7 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(29, 69, 139, 0.4),
                0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
}

.chatbot-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    border-radius: 50%;
}

.chatbot-toggle:hover {
    box-shadow: 0 8px 32px rgba(29, 69, 139, 0.5),
                0 4px 12px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle .toggle-icon {
    transition: all 0.3s ease;
    color: #fff;
}

.chatbot-toggle .toggle-icon.icon-chat {
    font-size: 26px;
    display: block;
}

.chatbot-toggle .toggle-icon.icon-open {
    font-size: 24px;
    display: none;
}

.buyem-chatbot.open .chatbot-toggle .icon-chat {
    display: none;
}

.buyem-chatbot.open .chatbot-toggle .icon-open {
    display: block;
}

/* Online Badge on Toggle Button */
.chatbot-online-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    background: #22c55e;
    
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.buyem-chatbot.open .chatbot-online-badge {
    display: none;
}

/* Pulse Animation */
.chatbot-toggle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(29, 69, 139, 0.3);
    animation: chatbotPulse 2s ease-out infinite;
    z-index: -1;
}

.buyem-chatbot.open .chatbot-toggle::after {
    animation: none;
    opacity: 0;
}

/* Chat Window */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18),
                0 4px 16px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.buyem-chatbot.open .chatbot-window {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, #1d458b 0%, #0f73a7 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    border-radius: 20px 20px 0 0;
}

.chatbot-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.chatbot-avatar img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.chatbot-avatar i {
    font-size: 24px;
    color: #fff;
}

.chatbot-header-info {
    flex: 1;
}

.chatbot-header-title {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 4px 0;
    letter-spacing: 0.3px;
}

.chatbot-header-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 500;
}

.chatbot-header-status .status-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
    animation: statusPulse 1.5s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chatbot-close-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
    z-index: 10;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chatbot-close-btn i {
    font-size: 16px;
    pointer-events: none;
}

/* Chat Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8fafc;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Message Styles */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.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: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-message.bot .message-avatar {
    background: linear-gradient(135deg, #1d458b 0%, #0f73a7 100%);
    color: #fff;
    font-size: 14px;
}

.chat-message.user .message-avatar {
    background: #e2e8f0;
    color: #64748b;
    font-size: 14px;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message.bot .message-content {
    background: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, #1d458b 0%, #0f73a7 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* Quick Actions */
.chatbot-quick-actions {
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
}

.quick-action-btn {
    padding: 8px 14px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.quick-action-btn:hover {
    background: #e2e8f0;
    color: #1d458b;
    border-color: #1d458b;
}

/* Chat Input */
.chatbot-input-area {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
}

.chatbot-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.2s ease;
}

.chatbot-input-wrapper:focus-within {
    border-color: #1d458b;
    background: #fff;
}

.chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    color: #334155;
    outline: none;
    padding: 10px 0;
}

.chatbot-input::placeholder {
    color: #94a3b8;
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #1d458b 0%, #0f73a7 100%);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    opacity: 0.9;
}

.chatbot-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.chatbot-send-btn i {
    font-size: 16px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
}

.welcome-message h4 {
    color: #1d458b;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.welcome-message p {
    color: #64748b;
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}

/* Message Links */
.message-content a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.chat-message.bot .message-content a {
    color: #1d458b;
}

/* Message Lists */
.message-content ul {
    margin: 8px 0 0 0;
    padding-left: 18px;
}

.message-content li {
    margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 480px) {
    .buyem-chatbot {
        bottom: 16px;
        right: 16px;
    }
    
    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }
    
    .chatbot-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        bottom: 72px;
        right: 0;
        border-radius: 16px;
    }
    
    .chatbot-header {
        padding: 14px 16px;
    }
    
    .chatbot-messages {
        padding: 16px;
    }
    
    .chatbot-input-area {
        padding: 12px 16px;
    }
}

/* Print - Hide chatbot */
@media print {
    .buyem-chatbot {
        display: none !important;
    }
}
