/* Chatbot Icon Image Style */
.chatbot-toggler span img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

/* AI Receptionist Icon Composite */
/* AI Receptionist Icon Composite */
/* AI Receptionist Icon Composite */
.ai-receptionist-icon {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 40px;
    color: #fff;
    text-align: center;
}

.ai-receptionist-icon .fas.fa-user-tie {
    font-size: 28px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.ai-receptionist-icon .fas.fa-headset {
    position: absolute;
    top: 5px;
    left: 62%;
    transform: translateX(-50%);
    font-size: 16px;
    z-index: 2;
    color: #FFD700;
    /* Gold headset */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.icon-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Pulse animation removed as requested simpler design, or we can keep generic pulse on the whole icon if needed, but I'll remove the specific simple pulse-ai for now or keep it blank if used elsewhere */
@keyframes pulse-ai {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Chatbot Widget Styles */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

/* الحاوية الرئيسية في ركن الصفحة */
.bot-launcher-container {
    position: fixed;
    bottom: 25px;
    left: 25px;
    display: flex;
    align-items: center;
    cursor: pointer;
    z-index: 999999;
    /* قيمة عالية جداً لضمان الظهور فوق كل شيء */
    direction: ltr;
    /* Changed to ltr so text bubble appears on right of icon */
    animation: slide-in-up 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* فقرة النص الجانبية */
.bot-text-bubble {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 20px;
    margin-left: 12px;
    font-family: Arial, sans-serif;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid #ffffff;
    white-space: nowrap;
}

/* الدائرة الزرقاء */
/* الدائرة الزرقاء */
.bot-icon-circle {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #004e92 0%, #000428 100%);
    border-radius: 50%;
    position: relative;
    border: 3px solid #ffd700;
    /* إطار ذهبي لتمييزها */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: pulse-gold 2s infinite;
}

/* رسم الرجل بالداخل */
.bot-man-head {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 18px;
}

.bot-man-body {
    width: 30px;
    height: 14px;
    background: #fff;
    border-radius: 10px 10px 0 0;
    position: absolute;
    top: 37px;
}

/* علامة الاستفهام المتحركة */
.bot-q-mark {
    position: absolute;
    top: 4px;
    right: 8px;
    color: #ffd700;
    font-size: 22px;
    font-weight: bold;
    text-shadow: 1px 1px 3px #000;
    animation: bot-bounce 2s infinite ease-in-out;
}

@keyframes bot-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* تأثير عند تمرير الماوس */
.bot-launcher-container:hover .bot-icon-circle {
    transform: scale(1.1);
    transition: 0.3s;
}

.chatbot {
    position: fixed;
    left: 35px;
    bottom: 110px;
    width: 400px;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5) translateY(20px);
    transform-origin: bottom left;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    height: 600px;
    font-family: 'Cairo', sans-serif;
    direction: rtl;
}

body.show-chatbot .chatbot {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

.chatbot header {
    padding: 20px;
    position: relative;
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, #004e92, #000428);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid #ffd700;
}

header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff !important;
    margin: 0;
    letter-spacing: 0.5px;
}

.chatbot .close-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    color: #e4e6eb;
    cursor: pointer;
    transform: translateY(-50%);
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.chatbot .close-btn:hover {
    color: #fff;
}

.chatbot .chatbox {
    overflow-y: auto;
    flex: 1;
    padding: 20px 20px 20px;
    background: #f9f9f9;
}

.chatbox .chat {
    display: flex;
    list-style: none;
    margin-bottom: 20px;
}

.chatbox .outgoing {
    justify-content: flex-start;
    /* RTL: Start is right */
}

.chatbox .incoming {
    justify-content: flex-end;
    /* RTL: End is left */
    flex-direction: row-reverse;
}

.message-content {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.chatbox .chat p {
    white-space: pre-wrap;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 4px;
}

/* User Message Style */
.chatbox .outgoing p {
    background: linear-gradient(135deg, #004e92, #000428);
    color: #fff;
    border-radius: 12px 12px 0 12px;
    text-align: right;
    border: 1px solid #004e92;
}

/* Bot Message Style */
.chatbox .incoming p {
    background: #fff;
    color: #333;
    border-radius: 12px 12px 12px 0;
    text-align: right;
    border: 1px solid #eee;
}

.chatbox .incoming .bot-icon {
    width: 35px;
    height: 35px;
    color: #fff;
    text-align: center;
    line-height: 35px;
    align-self: flex-start;
    /* Align icon to top */
    background: linear-gradient(135deg, #004e92, #000428);
    border-radius: 50%;
    margin-left: 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 78, 146, 0.3);
    border: 1px solid #ffd700;
}

.time-stamp {
    font-size: 0.7rem;
    color: #888;
    margin: 0 4px;
    display: block;
}

.outgoing .time-stamp {
    text-align: left;
    /* Align time to left for outgoing */
}

.incoming .time-stamp {
    text-align: right;
    /* Align time to right for incoming */
}

/* Suggestions Style */
.chat-suggestions {
    padding: 10px 15px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chat-suggestions::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar for Chrome/Safari */
}

.suggestion-chip {
    padding: 8px 18px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(0, 78, 146, 0.2);
    color: #004e92;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 78, 146, 0.05);
    backdrop-filter: blur(5px);
}

.suggestion-chip i {
    font-size: 0.9rem;
}

.suggestion-chip:hover {
    background: linear-gradient(135deg, #004e92, #000428);
    color: #fff;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 78, 146, 0.3);
    border-color: #ffd700;
}

.chatbot .chat-input {
    display: flex;
    gap: 10px;
    position: relative;
    width: 100%;
    background: #fff;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.03);
}

.chat-input textarea {
    height: 50px;
    width: 100%;
    border: 1px solid #eee;
    outline: none;
    resize: none;
    max-height: 150px;
    padding: 12px 15px;
    font-size: 0.95rem;
    font-family: 'Cairo', sans-serif;
    border-radius: 25px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.chat-input textarea:focus {
    border-color: #004e92;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 78, 146, 0.1);
}

.chat-input span {
    align-self: center;
    color: #004e92;
    cursor: pointer;
    height: 40px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    font-size: 1.2rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.chat-input textarea:valid~span {
    visibility: visible;
}

.chat-input span:hover {
    background: #f0f7f3;
}

@media (max-width: 490px) {
    .chatbot-toggler {
        left: 20px;
        bottom: 20px;
    }

    .chatbot {
        left: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chatbot .chatbox {
        height: 90%;
        padding: 25px 15px 100px;
    }
}

/* Result Table Styles */
.chat-result-table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}

.chat-result-table th,
.chat-result-table td {
    padding: 8px 12px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.chat-result-table th {
    background-color: #f1f3f5;
    color: #333;
    font-weight: 600;
}

.chat-result-table tr:last-child td {
    border-bottom: none;
}

/* Animations and Badge */
@keyframes pulse-gold {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 215, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
    }
}

@keyframes slide-in-up {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.bot-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff3b30;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    z-index: 10;
    animation: bounce-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1s forwards;
    opacity: 0;
    /* Hidden initially, shown by animation */
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .bot-launcher-container {
        bottom: 100px;
        /* Move up to avoid WhatsApp button */
        left: 20px;
    }

    .chatbot {
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 9999999;
        /* Ensure it's on top of everything including WhatsApp */
    }

    .chatbot .chatbox {
        height: calc(100% - 130px);
        /* Adjust height for full screen */
    }
}