﻿#alhekma-chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: 'Inter', Arial, sans-serif;
}

.chat-toggle {
    width: 68px;
    height: 68px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a86c, #e0bf83);
    color: #0a2540;
    cursor: pointer;
    box-shadow: 0 18px 40px rgba(10, 37, 64, 0.24);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.chat-toggle-icon { font-size: 22px; }
.chat-toggle-text { font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }

.alhekma-chat-closed .chat-container { display: none; }
.alhekma-chat-open .chat-toggle { display: none; }
.alhekma-chat-open .chat-container {
    display: flex;
    flex-direction: column;
    width: 380px;
    max-width: calc(100vw - 28px);
    height: 620px;
    max-height: calc(100vh - 32px);
    background: #fff;
    border-radius: 22px;
    border: 1px solid #e7edf4;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(10, 37, 64, 0.24);
}

.chat-header {
    padding: 18px 18px 14px;
    background: linear-gradient(135deg, #0a2540, #153553);
    color: #fff;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.chat-header h3 { margin: 0 0 4px; font-size: 18px; color: #fff; }
.chat-header p { margin: 0; color: rgba(255,255,255,0.72); font-size: 12px; }
.close-chat {
    background: rgba(255,255,255,0.08);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
}
.chat-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 18px;
    background: #fff7eb;
    border-bottom: 1px solid #f1e1bc;
    font-size: 12px;
    color: #7b5c21;
}
.chat-meta a { color: #0a2540; font-weight: 700; text-decoration: none; }

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background:
        radial-gradient(circle at top right, rgba(201,168,108,0.08), transparent 30%),
        #f7fafc;
}
.chat-message {
    display: flex;
    margin-bottom: 12px;
}
.chat-message p {
    margin: 0;
    padding: 12px 14px;
    border-radius: 16px;
    max-width: 84%;
    line-height: 1.55;
    word-break: break-word;
    box-shadow: 0 6px 18px rgba(10, 37, 64, 0.05);
}
.chat-message.user { justify-content: flex-end; }
.chat-message.user p { background: #c9a86c; color: #0a2540; border-bottom-right-radius: 6px; }
.chat-message.ai p,
.chat-message.agent p { background: #fff; color: #1e2b3a; border: 1px solid #e6edf5; border-bottom-left-radius: 6px; }
.chat-message.agent p { background: #eef7ff; }
.chat-message.system p {
    max-width: 100%;
    background: #e9eef4;
    color: #4a5568;
    text-align: center;
    font-size: 13px;
    box-shadow: none;
}

.chat-form {
    background: #fff;
    border: 1px solid #e6edf5;
    border-radius: 18px;
    padding: 14px;
    display: grid;
    gap: 10px;
}
.chat-form input,
.chat-form select,
.chat-form textarea {
    width: 100%;
    border: 1px solid #d9e2ec;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
}
.chat-form textarea { min-height: 84px; resize: vertical; }
.chat-start-btn {
    border: none;
    background: #0a2540;
    color: #fff;
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 14px;
    background: #fff;
    border-top: 1px solid #e6edf5;
}
.chat-input {
    flex: 1;
    border: 1px solid #d9e2ec;
    border-radius: 999px;
    padding: 12px 16px;
    outline: none;
}
.chat-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #0a2540;
    color: #fff;
    cursor: pointer;
}
.chat-send:disabled,
.chat-input:disabled { opacity: 0.65; cursor: not-allowed; }

.typing-row p.typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.typing-row p.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9aabbd;
    animation: alhekma-bounce 1s infinite ease-in-out;
}
.typing-row p.typing span:nth-child(2) { animation-delay: 0.12s; }
.typing-row p.typing span:nth-child(3) { animation-delay: 0.24s; }

@keyframes alhekma-bounce {
    0%, 80%, 100% { transform: scale(0.85); opacity: 0.5; }
    40% { transform: scale(1.1); opacity: 1; }
}

@media (max-width: 640px) {
    #alhekma-chat-widget { right: 14px; left: 14px; bottom: 14px; }
    .alhekma-chat-open .chat-container { width: 100%; height: calc(100vh - 28px); max-height: calc(100vh - 28px); }
}
