.drabdelrahman-chatbot {
    --dr-main-color: #2563eb;
    --dr-text-color: #111827;
    --dr-icon-color: #ffffff;
    --dr-bg-window: #ffffff;
    --dr-bg-messages: #f0f4f8;
    --dr-bg-form: #ffffff;
    --dr-border: #e5e7eb;
    --dr-msg-user-bg: var(--dr-main-color);
    --dr-msg-bot-bg: #ffffff;
    --dr-msg-bot-border: #e5e7eb;
    --dr-input-bg: #f3f4f6;
    --dr-input-border: #d1d5db;
    --dr-muted: #6b7280;
    --dr-typing-dots: #9ca3af;
    position: fixed;
    bottom: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
}

.drabdelrahman-chatbot.dr-dark {
    --dr-bg-window: var(--dr-dark-bg-override, #111111);
    --dr-bg-messages: var(--dr-dark-bg-override, #000000);
    --dr-bg-form: var(--dr-dark-bg-override, #111111);
    --dr-border: #2a2a2a;
    --dr-msg-user-bg: var(--dr-main-color);
    --dr-msg-bot-bg: #1c1c1c;
    --dr-msg-bot-border: #2a2a2a;
    --dr-input-bg: #1c1c1c;
    --dr-input-border: #2a2a2a;
    --dr-muted: #888888;
    --dr-text-color: var(--dr-dark-text-override, #f5f5f5);
    --dr-typing-dots: #aaaaaa;
}

.drabdelrahman-chatbot.dr-dark .dr-message-bot {
    color: #f5f5f5;
}

.drabdelrahman-chatbot.dr-dark .dr-message-meta {
    color: #b3b3b3;
}

.drabdelrahman-chatbot.dr-dark .dr-chat-form input {
    color: #f5f5f5;
}

.drabdelrahman-chatbot.dr-dark .dr-chat-form input::placeholder {
    color: #9b9b9b;
    opacity: 1;
}

.drabdelrahman-chatbot.is-right {
    right: 24px;
    align-items: flex-end;
}

.drabdelrahman-chatbot.is-left {
    left: 24px;
    align-items: flex-start;
}

.dr-chat-toggle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: var(--dr-main-color);
    color: var(--dr-icon-color);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    font-size: 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.dr-chat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    transform: translateY(1px);
}

.dr-chat-toggle-logo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid rgba(255, 255, 255, 0.28);
}

.drabdelrahman-chatbot.is-open .dr-chat-toggle {
    display: none;
}

.dr-chat-window {
    width: min(390px, calc(100vw - 30px));
    height: 560px;
    max-height: calc(100vh - 110px);
    border-radius: 20px;
    overflow: hidden;
    background: var(--dr-bg-window);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22);
    display: none;
    flex-direction: column;
    border: 1px solid var(--dr-border);
}

.drabdelrahman-chatbot.is-open .dr-chat-window {
    display: flex;
}

.dr-chat-header {
    background: var(--dr-main-color);
    color: #ffffff;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dr-chat-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dr-chat-brand img {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    object-fit: cover;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.dr-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dr-chat-reset {
    background: transparent;
    border: 0;
    color: #ffffff;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0.85;
    padding: 0;
}

.dr-chat-reset:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.dr-chat-reset svg {
    width: 17px;
    height: 17px;
    display: block;
}

.dr-chat-close {
    background: transparent;
    border: 0;
    color: #ffffff;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.drabdelrahman-chatbot.dr-dark .dr-chat-reset {
    color: #ffffff;
    opacity: 0.85;
}

.dr-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 12px;
    background: var(--dr-bg-messages);
    color: var(--dr-text-color);
}

.dr-message-wrap {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.dr-message-wrap-user {
    align-items: flex-start;
}

.dr-message-wrap-bot {
    align-items: flex-end;
}

.dr-message {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
    overflow: visible;
}

.dr-message-user {
    background: var(--dr-msg-user-bg);
    color: #ffffff;
    border-bottom-left-radius: 6px;
}

.dr-message-user::after {
    content: "";
    position: absolute;
    left: -6px;
    bottom: 0;
    width: 0;
    height: 0;
    border-right: 6px solid var(--dr-msg-user-bg);
    border-top: 6px solid transparent;
}

.dr-message-bot {
    background: var(--dr-msg-bot-bg);
    color: var(--dr-text-color);
    border: 1px solid var(--dr-msg-bot-border);
    border-bottom-right-radius: 6px;
}

.dr-message-bot::after {
    content: "";
    position: absolute;
    right: -6px;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 6px solid var(--dr-msg-bot-bg);
    border-top: 6px solid transparent;
}

.dr-message-meta {
    margin-top: 3px;
    font-size: 11px;
    color: var(--dr-muted);
}

.dr-message-actions {
    margin-top: 4px;
}

.dr-message-listen-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--dr-border);
    border-radius: 50%;
    background: var(--dr-input-bg);
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
}

.dr-message-listen-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.dr-message-listen-btn svg path {
    fill: currentColor !important;
}

.dr-chat-typing {
    padding: 0 14px 10px;
    background: var(--dr-bg-messages);
}

.dr-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.dr-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dr-typing-dots);
    animation: dr-bounce 1.2s infinite;
}

.dr-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dr-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dr-bounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-6px);
    }
}

.dr-chat-form {
    border-top: 1px solid var(--dr-border);
    background: var(--dr-bg-form);
    padding: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
    min-height: 58px;
}

.dr-chat-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--dr-input-border);
    border-radius: 999px;
    padding: 10px 14px;
    outline: 0;
    font-size: 14px;
    color: var(--dr-text-color);
    background: var(--dr-input-bg);
}

.dr-send-btn,
.dr-voice-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
}

.dr-send-btn {
    background: var(--dr-main-color);
    color: #ffffff;
}

.dr-send-btn svg,
.dr-voice-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.dr-voice-btn {
    background: var(--dr-input-bg);
    color: var(--dr-text-color);
    border: 1px solid var(--dr-input-border);
}

.dr-voice-btn.is-active {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

.dr-voice-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.drabdelrahman-chatbot.dr-dark .dr-message-listen-btn {
    background: #2a2a2a;
    border-color: #3a3a3a;
    color: #f5f5f5;
}

.drabdelrahman-chatbot.dr-dark .dr-message-listen-btn:hover {
    background: #343434;
}

.drabdelrahman-chatbot.dr-dark .dr-voice-btn {
    background: #202020;
    border-color: #3a3a3a;
    color: #f5f5f5;
}

.drabdelrahman-chatbot.dr-dark .dr-voice-btn svg,
.drabdelrahman-chatbot.dr-dark .dr-send-btn svg {
    color: #f5f5f5;
}

.drabdelrahman-chatbot.dr-dark .dr-chat-close {
    color: #ffffff;
}

@media (max-width: 640px) {
    .drabdelrahman-chatbot {
        right: 12px;
        left: 12px;
        bottom: 12px;
    }

    .drabdelrahman-chatbot.is-left,
    .drabdelrahman-chatbot.is-right {
        right: 12px;
        left: 12px;
    }

    .dr-chat-window {
        width: 100%;
        height: calc(100vh - 86px);
        max-height: calc(100vh - 86px);
        border-radius: 16px;
    }

    .dr-chat-toggle {
        margin-inline-start: auto;
        display: block;
    }

    .dr-chat-header {
        padding: 10px 12px;
    }

    .dr-chat-reset {
        width: 26px;
        height: 26px;
    }

    .dr-chat-form {
        padding: 8px;
        gap: 6px;
    }

    .dr-send-btn,
    .dr-voice-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
}
