/* Sanjaya Chatbot Styles - Themed to match the main site */
/* Palette: Navy (#1D3654), Teal (#29867F), Gold (#D8AF53) */

#chatbot-icon {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1D3654, #29867F);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(41, 134, 127, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border: 3px solid white;
}

#chatbot-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(41, 134, 127, 0.4);
}

#chatbot-icon.chatbot-icon-active {
    /* CHANGE: Deepens the existing gradient */
    background: linear-gradient(135deg, #162942, #1f635e);
    transform: scale(1.05);
}

#chatbot-icon::before {
    content: '💬';
    font-size: 30px;
    color: white;
}

#chatbot-container {
    position: fixed;
    bottom: 160px;
    right: 30px;
    width: 500px;
    height: 600px;
    background: #f8fafc; /* CHANGE: Using light site background color */
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    border: 1px solid rgba(41, 134, 127, 0.2);
    overflow: hidden;
}

#chatbot-container.chatbot-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

#chatbot-header {
    /* CHANGE: Using the site's primary Navy-to-Teal gradient */
    background: linear-gradient(135deg, #1D3654, #29867F);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
}

#chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Archivo Black', sans-serif; /* CHANGE: Match heading font */
}

#chatbot-header h3::before {
    content: '🤖';
    font-size: 20px;
}

#chatbot-controls {
    display: flex;
    gap: 10px;
}

#chatbot-minimize-btn,
#chatbot-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

#chatbot-minimize-btn:hover,
#chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

#chatbot-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc; /* CHANGE: Consistent light background */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#chatbot-body::-webkit-scrollbar {
    width: 6px;
}

#chatbot-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#chatbot-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#chatbot-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message-user {
    align-self: flex-end;
}

.chatbot-message-bot {
    align-self: flex-start;
}

.chatbot-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    font-family: 'Avenir Next Arabic', sans-serif; /* CHANGE: Match body font */
}

.chatbot-message-user .chatbot-message-content {
    /* CHANGE: Using the site's Gold accent color for user messages */
    background: #D8AF53;
    /* CHANGE: Using Navy for text for high contrast on gold */
    color: #1D3654;
    font-weight: 500; /* Add weight for better readability */
    border-bottom-right-radius: 6px;
}

.chatbot-message-bot .chatbot-message-content {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chatbot-message-time {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    text-align: right;
}

.chatbot-message-bot .chatbot-message-time {
    text-align: left;
}

#chatbot-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#chatbot-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    padding: 12px 18px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    resize: none;
    max-height: 100px;
    font-family: 'Avenir Next Arabic', sans-serif; /* CHANGE: Match body font */
}

#chatbot-input:focus {
    /* CHANGE: Focus color changed to Teal */
    border-color: #29867F;
    box-shadow: 0 0 0 3px rgba(41, 134, 127, 0.1);
}

#chatbot-send-btn {
    /* CHANGE: Using the site's primary Navy-to-Teal gradient */
    background: linear-gradient(135deg, #1D3654, #29867F);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
    flex-shrink: 0;
}

#chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    /* CHANGE: Shadow color updated to match Teal */
    box-shadow: 0 4px 15px rgba(41, 134, 127, 0.3);
}

#chatbot-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.chatbot-loading {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #chatbot-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 80px;
        border-radius: 15px;
    }
    
    #chatbot-icon {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    #chatbot-icon::before {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    #chatbot-container {
        width: calc(100vw - 10px);
        right: 5px;
        bottom: 70px;
    }
    
    .chatbot-message {
        max-width: 90%;
    }
}

/* Typing indicator */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    max-width: 60px;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    /* CHANGE: Using the site's Teal color for typing dots */
    background: #29867F;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}