/**
 * أنماط روبوت المحادثة
 * Chatbot Styles
 */

/* ========================================
   Container
   ======================================== */

#chatbot-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9000;
    font-family: 'Cairo', sans-serif;
}

/* ========================================
   Toggle Button
   ======================================== */

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 5px 25px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.chatbot-toggle .chatbot-icon-close {
    display: none;
}

#chatbot-container.open .chatbot-toggle .chatbot-icon-open {
    display: none;
}

#chatbot-container.open .chatbot-toggle .chatbot-icon-close {
    display: block;
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-badge.hidden {
    display: none;
}

/* ========================================
   Chat Window
   ======================================== */

.chatbot-window {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: linear-gradient(135deg, #1e1b4b, #0f172a);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

#chatbot-container.open .chatbot-window {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* ========================================
   Header
   ======================================== */

.chatbot-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.chatbot-info {
    flex: 1;
}

.chatbot-info h4 {
    font-size: 15px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.chatbot-status {
    font-size: 12px;
    color: #10b981;
}

.chatbot-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ========================================
   Messages
   ======================================== */

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-message {
    max-width: 85%;
    animation: message-in 0.3s ease;
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message.bot {
    align-self: flex-start;
}

.chatbot-message.user {
    align-self: flex-end;
}

.chatbot-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.chatbot-message.bot .chatbot-message-content {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message.user .chatbot-message-content {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color: white;
    border-bottom-left-radius: 4px;
}

.chatbot-message-content a {
    color: #06b6d4;
    text-decoration: underline;
}

.chatbot-message-time {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    padding: 0 8px;
}

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: fit-content;
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    background: #8b5cf6;
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* ========================================
   Quick Actions
   ======================================== */

.chatbot-quick-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-quick-actions button {
    padding: 8px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.chatbot-quick-actions button:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}

/* ========================================
   Input Area
   ======================================== */

.chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-input-area input::placeholder {
    color: #64748b;
}

.chatbot-input-area input:focus {
    border-color: rgba(139, 92, 246, 0.5);
}

.chatbot-input-area button {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-input-area button:hover {
    transform: scale(1.05);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 480px) {
    #chatbot-container {
        bottom: 10px;
        left: 10px;
    }
    
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        border-radius: 20px;
    }
}
