/* ==========================================================================
   Daleel Smart Assistant (شات بوت دليل الذكي) - Modern Glassmorphic Styles
   ========================================================================== */

:root {
    --daleel-chat-primary: #023E73;
    --daleel-chat-primary-gradient: linear-gradient(135deg, #023E73 0%, #0d5594 100%);
    --daleel-chat-accent: #e67e22;
    --daleel-chat-accent-gradient: linear-gradient(135deg, #f39c12 0%, #d35400 100%);
    --daleel-chat-bg: rgba(255, 255, 255, 0.98);
    --daleel-chat-bubble-ai: #f4f7fb;
    --daleel-chat-bubble-ai-border: rgba(2, 62, 115, 0.08);
    --daleel-chat-bubble-user: linear-gradient(135deg, #023E73 0%, #0d5594 100%);
    --daleel-chat-shadow: 0 16px 40px rgba(2, 62, 115, 0.16), 0 4px 12px rgba(0, 0, 0, 0.08);
    --daleel-chat-font: 'Segoe UI', system-ui, -apple-system, Tahoma, Geneva, sans-serif;
    --daleel-chat-radius: 20px;
}

/* Floating Launcher Button */
.daleel-chat-launcher {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--daleel-chat-font);
    direction: rtl;
    text-align: right;
}

.daleel-chat-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--daleel-chat-primary-gradient);
    box-shadow: 0 8px 24px rgba(2, 62, 115, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    font-size: 28px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    outline: none;
    user-select: none;
}

.daleel-chat-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 28px rgba(2, 62, 115, 0.45);
}

.daleel-chat-btn:active {
    transform: scale(0.95);
}

/* Notification Pulse Ring */
.daleel-chat-btn::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 2px solid rgba(230, 126, 34, 0.6);
    animation: daleelPulseRing 2.5s infinite;
    pointer-events: none;
}

@keyframes daleelPulseRing {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 0; }
    100% { transform: scale(0.95); opacity: 0; }
}

.daleel-chat-online-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #2ecc71;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
}

/* Launcher Tooltip */
.daleel-chat-tooltip {
    background: #ffffff;
    color: #023E73;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(2, 62, 115, 0.1);
    pointer-events: none;
    white-space: nowrap;
    animation: daleelTooltipFloat 3s ease-in-out infinite;
    display: flex;
    align-items: center;
    gap: 6px;
}

@keyframes daleelTooltipFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Chat Container Window */
.daleel-chat-window {
    position: fixed;
    bottom: 96px;
    left: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 570px;
    max-height: calc(100vh - 120px);
    background: var(--daleel-chat-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--daleel-chat-radius);
    box-shadow: var(--daleel-chat-shadow);
    border: 1px solid rgba(2, 62, 115, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    direction: rtl;
    font-family: var(--daleel-chat-font);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.daleel-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.daleel-chat-header {
    background: var(--daleel-chat-primary-gradient);
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.daleel-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.daleel-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.daleel-chat-title-box h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
}

.daleel-chat-title-box p {
    margin: 3px 0 0 0;
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.daleel-chat-dot {
    width: 7px;
    height: 7px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
}

.daleel-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.daleel-chat-icon-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

.daleel-chat-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Quick Suggestion Chips */
.daleel-chat-chips {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #edf2f7;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.daleel-chat-chips::-webkit-scrollbar {
    display: none;
}

.daleel-chip {
    background: #ffffff;
    color: #023E73;
    border: 1px solid rgba(2, 62, 115, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    flex-shrink: 0;
}

.daleel-chip:hover {
    background: #023E73;
    color: #ffffff;
    border-color: #023E73;
    transform: translateY(-1px);
}

/* Messages Body */
.daleel-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    background: #ffffff;
}

.daleel-msg {
    display: flex;
    flex-direction: column;
    max-width: 86%;
    animation: daleelMsgFadeIn 0.25s ease-out;
}

@keyframes daleelMsgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.daleel-msg-ai {
    align-self: flex-start;
}

.daleel-msg-user {
    align-self: flex-end;
}

.daleel-msg-bubble {
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
    position: relative;
}

.daleel-msg-ai .daleel-msg-bubble {
    background: var(--daleel-chat-bubble-ai);
    color: #2c3e50;
    border: 1px solid var(--daleel-chat-bubble-ai-border);
    border-bottom-right-radius: 4px;
}

.daleel-msg-user .daleel-msg-bubble {
    background: var(--daleel-chat-bubble-user);
    color: #ffffff;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 10px rgba(2, 62, 115, 0.2);
}

.daleel-msg-bubble strong {
    font-weight: 700;
    color: #023E73;
}

.daleel-msg-user .daleel-msg-bubble strong {
    color: #ffeaa7;
}

.daleel-msg-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
}

.daleel-msg-user .daleel-msg-time {
    text-align: left;
}

/* Action Buttons Container */
.daleel-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.daleel-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    color: #023E73;
    border: 1.5px solid #023E73;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(2, 62, 115, 0.08);
    cursor: pointer;
}

.daleel-action-btn:hover {
    background: #023E73;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(2, 62, 115, 0.22);
}

.daleel-action-btn.btn-accent {
    background: #e67e22;
    color: #ffffff;
    border-color: #d35400;
}

.daleel-action-btn.btn-accent:hover {
    background: #d35400;
}

/* Typing Indicator */
.daleel-typing {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: var(--daleel-chat-bubble-ai);
    border-radius: 14px;
    width: fit-content;
    border: 1px solid var(--daleel-chat-bubble-ai-border);
}

.daleel-typing.active {
    display: flex;
}

.daleel-typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: daleelBounce 1.4s infinite ease-in-out both;
}

.daleel-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.daleel-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes daleelBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); background: #023E73; }
}

/* Input Footer */
.daleel-chat-footer {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #edf2f7;
    display: flex;
    align-items: center;
    gap: 8px;
}

.daleel-chat-input-wrapper {
    flex: 1;
    position: relative;
    background: #f1f5f9;
    border-radius: 24px;
    padding: 4px 14px;
    display: flex;
    align-items: center;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.daleel-chat-input-wrapper:focus-within {
    background: #ffffff;
    border-color: #023E73;
    box-shadow: 0 0 0 3px rgba(2, 62, 115, 0.1);
}

.daleel-chat-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 13.5px;
    outline: none;
    direction: rtl;
    font-family: inherit;
    color: #1e293b;
    padding: 6px 0;
}

.daleel-chat-input::placeholder {
    color: #94a3b8;
}

.daleel-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--daleel-chat-primary-gradient);
    border: none;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 10px rgba(2, 62, 115, 0.25);
    flex-shrink: 0;
}

.daleel-chat-send-btn:hover:not(:disabled) {
    transform: scale(1.06);
}

.daleel-chat-send-btn:active:not(:disabled) {
    transform: scale(0.92);
}

.daleel-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .daleel-chat-launcher {
        bottom: 84px; /* فوق الشريط السفلي للجوال مباشرة */
        left: 16px;
    }
    .daleel-chat-window {
        bottom: 154px;
        left: 12px;
        width: calc(100vw - 24px);
        height: calc(100vh - 180px);
        border-radius: 18px;
    }
    .daleel-chat-tooltip {
        display: none; /* إخفاء التلميح النصي في الشاشات الصغيرة لتجنب حجب المحتوى */
    }
}
