/**
 * Chatbot Styles - مركز الرعاية النموذجي للتأهيل
 */

/* Chat Button */
#chatbot-button {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #2E3A6E 0%, #1E2A5E 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(46, 58, 110, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(46, 58, 110, 0.5);
}

#chatbot-button.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

#chatbot-button .chat-btn-icon {
    color: white;
    font-size: 1.8rem;
    z-index: 2;
}

#chatbot-button .chat-btn-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(123, 192, 67, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Chat Window */
#chatbot-window {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0);
    opacity: 0;
    transform-origin: bottom left;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#chatbot-window.open {
    transform: scale(1);
    opacity: 1;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #2E3A6E 0%, #1E2A5E 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.chat-title h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-status {
    font-size: 0.75rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #7BC043;
    border-radius: 50%;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chat-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8f9fa;
}

.chat-message {
    display: flex;
    max-width: 85%;
}

.chat-message.user-message {
    align-self: flex-start;
}

.chat-message.bot-message {
    align-self: flex-end;
}

.message-content {
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.user-message .message-content {
    background: linear-gradient(135deg, #2E3A6E 0%, #1E2A5E 100%);
    color: white;
    border-bottom-left-radius: 5px;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Typing Indicator */
.message-content.typing {
    display: flex;
    gap: 5px;
    padding: 15px 20px;
}

.message-content.typing span {
    width: 8px;
    height: 8px;
    background: #2E3A6E;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.message-content.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.message-content.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Quick Replies */
.chat-quick-replies {
    padding: 10px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #f8f9fa;
    max-height: 180px;
    overflow-y: auto;
}

.quick-reply-btn {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    font-family: inherit;
}

.quick-reply-btn:hover {
    background: #2E3A6E;
    color: white;
    border-color: #2E3A6E;
    transform: translateY(-2px);
}

/* Chat Input */
.chat-input-area {
    display: flex;
    padding: 15px;
    gap: 10px;
    background: white;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

#chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}

#chat-input:focus {
    border-color: #2E3A6E;
}

#chat-send {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #7BC043 0%, #5a9e2f 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

#chat-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(123, 192, 67, 0.4);
}

#chat-send i {
    transform: rotate(180deg);
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar,
.chat-quick-replies::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-quick-replies::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-quick-replies::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-quick-replies::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #chatbot-button {
        bottom: 20px;
        left: 20px;
        width: 55px;
        height: 55px;
    }

    #chatbot-window {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    #chatbot-window.open {
        transform: scale(1);
    }

    .chat-header {
        padding: 12px 15px;
    }

    .chat-messages {
        padding: 15px;
    }

    .quick-reply-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}