/* ═══════════════════════════════════════════════
   AI Assistant Panel — شاليه أوراس PANEL_006
   ═══════════════════════════════════════════════ */

/* ── Overlay خلفية معتمة ──────────────────────── */
#ai-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
#ai-overlay.hidden { display: none !important; }

/* ── اللوحة المركزية (حوار كامل) ─────────────── */
#ai-panel-center {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,0.28);
    direction: rtl;
    animation: aiSlideUp .32s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}
@keyframes aiSlideUp {
    from { transform: translateY(28px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── رأس اللوحة ──────────────────────────────── */
#ai-center-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    background: linear-gradient(135deg,#1a73e8,#0d47a1);
    flex-shrink: 0;
}
.ai-center-title {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}
.ai-center-title svg { width: 20px; height: 20px; fill: #fff; opacity:.9; }
.ai-center-sub { font-size: 11px; color: rgba(255,255,255,.75); margin-top: 1px; }

#ai-center-dismiss {
    background: rgba(255,255,255,.18);
    border: none;
    color: #fff;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .15s;
}
#ai-center-dismiss:hover { background: rgba(255,255,255,.3); }

/* ── منطقة الرسائل ──────────────────────────── */
#ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.ai-msg-bot {
    background: #f0f4ff;
    border: 1px solid #d0deff;
    border-radius: 12px 12px 12px 0;
    padding: 10px 13px;
    font-size: 14px;
    line-height: 1.6;
    color: #1a1a2e;
    max-width: 92%;
    align-self: flex-end;
}
.ai-msg-user {
    background: #1a73e8;
    color: #fff;
    border-radius: 12px 12px 0 12px;
    padding: 9px 13px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 80%;
    align-self: flex-start;
}
.ai-msg-blocked {
    background: #fff3e0;
    border: 1px solid #ffcc02;
    border-radius: 12px;
    padding: 8px 13px;
    font-size: 13px;
    color: #e65100;
    text-align: center;
    align-self: center;
}

/* مؤشر التحميل */
.ai-typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 8px 13px;
    background: #f0f4ff;
    border-radius: 12px;
    width: fit-content;
    align-self: flex-end;
}
.ai-typing span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #1a73e8;
    animation: aiDot 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aiDot {
    0%,80%,100% { transform:scale(.7); opacity:.5; }
    40%          { transform:scale(1);  opacity:1;  }
}

/* ── الخيارات السريعة ───────────────────────── */
#ai-options {
    padding: 6px 14px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: flex-end;
    flex-shrink: 0;
}
.ai-option-btn {
    background: #fff;
    border: 1.5px solid #1a73e8;
    color: #1a73e8;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, color .15s;
    font-family: inherit;
}
.ai-option-btn:hover, .ai-option-btn:active { background:#1a73e8; color:#fff; }

/* ── حقل الكتابة ────────────────────────────── */
#ai-input-row {
    display: flex;
    gap: 8px;
    padding: 8px 12px 12px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
#ai-input {
    flex: 1;
    border: 1.5px solid #dde3f0;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
    direction: rtl;
    font-family: inherit;
    transition: border-color .2s;
}
#ai-input:focus { border-color: #1a73e8; }
#ai-input:disabled { background: #f5f5f5; color: #aaa; }
#ai-send-btn {
    background: #1a73e8;
    border: none;
    border-radius: 50%;
    width: 38px; height: 38px;
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background .2s;
}
#ai-send-btn:hover { background: #1558b0; }
#ai-send-btn:disabled { background: #aaa; cursor: not-allowed; }
#ai-send-btn svg { width: 18px; height: 18px; fill: #fff; }

/* ── زر الفتح العائم (بعد الإغلاق) ─────────── */
#ai-toggle-btn {
    position: fixed;
    bottom: 90px;
    left: 16px;
    z-index: 1050;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg,#1a73e8,#0d47a1);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(26,115,232,.5);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: transform .2s, box-shadow .2s;
}
#ai-toggle-btn.visible { display: flex; }
#ai-toggle-btn:hover { transform: scale(1.08); }
#ai-toggle-btn svg { width: 26px; height: 26px; fill: #fff; }
#ai-badge {
    position: absolute; top: -4px; right: -4px;
    background: #e53935; color: #fff;
    font-size: 11px; font-weight: 700;
    border-radius: 50%; width: 18px; height: 18px;
    display: none; align-items: center; justify-content: center;
}
