/* ==========================================================================
   اسأل زاد (Ask Zad) - المساعد الإسلامي الذكي التفاعلي
   تصميم فاخر متجاوب مع شاشات الآيفون، الأندرويد، وسطح المكتب (Zero Glitch)
   ========================================================================== */

/* زر الإطلاق العائم (Floating Action Button) */
.ask-zad-fab {
    position: fixed;
    bottom: calc(66px + env(safe-area-inset-bottom, 8px));
    right: max(14px, env(safe-area-inset-right, 14px));
    z-index: 1040;
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0e6654 0%, #073f35 60%, #04241e 100%);
    color: #ffffff;
    border: 2px solid rgba(212, 175, 55, 0.75);
    border-radius: 50%;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 16px rgba(212, 175, 55, 0.3);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease, border-color 0.22s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

.ask-zad-fab:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 24px rgba(212, 175, 55, 0.45);
    border-color: #d4af37;
}

.ask-zad-fab:active {
    transform: translateY(1px) scale(0.95);
}

.ask-zad-fab-icon {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffdb4d;
    font-size: 22px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.ask-zad-fab:hover .ask-zad-fab-icon {
    transform: scale(1.08);
}

.ask-zad-fab-sparkle {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #ffdb4d;
    border: 2px solid #04241e;
    box-shadow: 0 0 10px #ffdb4d;
    animation: askZadPulse 2s infinite ease-in-out;
}

@keyframes askZadPulse {
    0%, 100% { transform: scale(0.85); opacity: 0.75; }
    50% { transform: scale(1.2); opacity: 1; }
}

@media (min-width: 992px) {
    .ask-zad-fab {
        bottom: 28px;
        right: 28px;
        width: 58px;
        height: 58px;
        min-width: 58px;
        min-height: 58px;
    }
    .ask-zad-fab-icon {
        font-size: 25px;
    }
}

/* نافذة المساعد (Chat Modal / Fullscreen Immersive Drawer) */
.ask-zad-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 15, 12, 0.75);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 2050;
    display: flex;
    justify-content: center;
    align-items: stretch;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, backdrop-filter 0.3s ease, -webkit-backdrop-filter 0.3s ease;
}

.ask-zad-overlay.is-active {
    opacity: 1;
    visibility: visible;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ask-zad-container {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100%;
    background: var(--bg-card, #0a2620);
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    overflow: hidden;
}

/* شريط السحب الخاص بالهواتف (Mobile Sheet Grab Handle) */
.ask-zad-drag-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: max(10px, env(safe-area-inset-top, 10px)) 0 6px;
    width: 100%;
    cursor: grab;
    touch-action: none; /* يسمح بالتقاط حركة السحب بالكامل بدون تدخل المتصفح */
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    background: rgba(7, 35, 29, 0.85);
}

.ask-zad-drag-bar:active {
    cursor: grabbing;
}

.ask-zad-drag-handle {
    width: 44px;
    height: 5px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.32);
    transition: background 0.2s ease, transform 0.15s ease;
}

.ask-zad-drag-bar:active .ask-zad-drag-handle {
    transform: scaleX(1.12);
}

[data-theme="light"] .ask-zad-drag-handle {
    background: rgba(0, 0, 0, 0.18);
}

@media (min-width: 768px) {
    .ask-zad-drag-bar {
        display: none;
    }
    .ask-zad-overlay {
        align-items: center;
        padding: 24px;
    }
    .ask-zad-container {
        border-radius: 26px;
        border: 1px solid var(--border-color, rgba(212, 175, 55, 0.25));
        height: 90vh;
        max-height: 860px;
        max-width: 680px;
        box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6);
        transform: translateY(30px) scale(0.96);
        opacity: 0;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    }
    .ask-zad-overlay.is-active .ask-zad-container {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.ask-zad-overlay.is-active .ask-zad-container {
    transform: translateY(0);
}

/* شريط رأس المحادثة */
.ask-zad-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(7, 35, 29, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    flex-shrink: 0;
}
@media (max-width: 767px) {
    .ask-zad-header {
        padding-top: 6px;
    }
}

.ask-zad-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ask-zad-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(14, 102, 84, 0.35) 100%);
    border: 1.5px solid rgba(212, 175, 55, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d4af37;
    font-size: 20px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ask-zad-online-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    background: #10b981;
    border: 2px solid var(--bg-card, #0a2620);
    border-radius: 50%;
}

.ask-zad-header-text h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ask-zad-badge {
    font-size: 11px;
    color: #ffdb4d;
    font-weight: normal;
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid rgba(212, 175, 55, 0.35);
    padding: 2px 7px;
    border-radius: 9999px;
    letter-spacing: 0.2px;
}

.ask-zad-header-text p {
    margin: 2px 0 0;
    font-size: 11.5px;
    color: var(--muted, #94a3b8);
}

.ask-zad-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ask-zad-header-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.ask-zad-header-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
    border-color: rgba(212, 175, 55, 0.4);
}

/* منطقة الرسائل */
.ask-zad-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* بطاقة الترحيب والاقتراحات */
.ask-zad-welcome-card {
    background: rgba(14, 102, 84, 0.12);
    border: 1px dashed rgba(212, 175, 55, 0.35);
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    margin-bottom: 4px;
}

.ask-zad-welcome-title {
    font-size: 15px;
    font-weight: 800;
    color: #d4af37;
    margin-bottom: 6px;
}

.ask-zad-welcome-desc {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-secondary, #cbd5e1);
    margin: 0 0 14px;
}

.ask-zad-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.ask-zad-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.25);
    color: #e2e8f0;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ask-zad-chip:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
    color: #ffd700;
    transform: translateY(-1px);
}

.ask-zad-chip:active {
    transform: scale(0.96);
}

/* فقاعات الرسائل */
.ask-zad-msg-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.ask-zad-msg-row.user {
    justify-content: flex-start; /* في الـ RTL، المستخدم على اليسار */
    flex-direction: row-reverse;
}

.ask-zad-msg-row.bot {
    justify-content: flex-start;
}

.ask-zad-msg-bubble {
    max-width: 86%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.7;
    position: relative;
    word-break: break-word;
}

.ask-zad-msg-row.user .ask-zad-msg-bubble {
    background: linear-gradient(135deg, #0e6654 0%, #115e4f 100%);
    color: #ffffff;
    border-end-end-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ask-zad-msg-row.bot .ask-zad-msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #f1f5f9);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-end-start-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.ask-zad-msg-bubble strong {
    color: #d4af37;
}

.ask-zad-msg-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}





/* أزرار الإجراءات داخل إجابة البوت */
.ask-zad-msg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.ask-zad-action-btn {
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.35);
    color: #ffdb4d;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s ease;
}

.ask-zad-action-btn:hover {
    background: rgba(212, 175, 55, 0.28);
    border-color: #d4af37;
    color: #ffffff;
    transform: translateY(-1px);
}

/* مؤشر الكتابة (Typing Indicator) */
.ask-zad-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.ask-zad-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d4af37;
    opacity: 0.6;
    animation: askZadBounce 1.4s infinite ease-in-out both;
}

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

@keyframes askZadBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); opacity: 1; }
}

/* شريط الإدخال السفلي */
.ask-zad-footer {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 8px));
    background: rgba(7, 35, 29, 0.94);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.ask-zad-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1.5px solid rgba(212, 175, 55, 0.3);
    border-radius: 9999px;
    padding-block: 3px;
    padding-inline: 4px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ask-zad-input-form:focus-within {
    border-color: #d4af37;
    box-shadow: 0 0 14px rgba(212, 175, 55, 0.25);
}

#ask-zad-input {
    text-align: start;
    unicode-bidi: isolate;
}

.ask-zad-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 16px !important; /* يمنع التكبير التلقائي المزعج في الآيفون */
    padding: 8px 0;
    min-height: 24px;
    -webkit-appearance: none;
}
    .ask-zad-input:focus{
        outline:unset !important;
    }
    .ask-zad-input::placeholder {
        color: rgba(255, 255, 255, 0.4);
        font-size: 13.5px;
    }

.ask-zad-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37 0%, #b89326 100%);
    border: none;
    color: #073f35;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.18s ease, filter 0.18s ease;
    touch-action: manipulation;
}

.ask-zad-send-btn:hover {
    transform: scale(1.08);
    filter: brightness(1.1);
}

.ask-zad-send-btn:active {
    transform: scale(0.92);
}

.ask-zad-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* تنبيه إخلاء المسؤولية الموثوق */
.ask-zad-disclaimer {
    margin: 8px 0 0;
    text-align: center;
    font-size: 10.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.45);
}

/* التوافق مع الوضع النهاري (Light Theme Support) */
[data-theme="light"] .ask-zad-fab {
    background: linear-gradient(135deg, #0e6654 0%, #073f35 60%, #04241e 100%);
    border-color: #d4af37;
    box-shadow: 0 8px 24px rgba(7, 63, 53, 0.28), 0 2px 10px rgba(212, 175, 55, 0.25);
}

[data-theme="light"] .ask-zad-fab:hover {
    box-shadow: 0 12px 30px rgba(7, 63, 53, 0.38), 0 0 20px rgba(212, 175, 55, 0.35);
    border-color: #b89326;
}

[data-theme="light"] .ask-zad-fab-sparkle {
    background: #152d24;
    border-color: #ffffff;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
}

[data-theme="light"] .ask-zad-overlay {
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

[data-theme="light"] .ask-zad-container {
    background: #ffffff;
    border-color: rgba(7, 63, 53, 0.15);
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .ask-zad-header {
    background: #f8fafc;
    border-bottom-color: #e2e8f0;
}

[data-theme="light"] .ask-zad-avatar {
    background: linear-gradient(135deg, rgba(14, 102, 84, 0.12) 0%, rgba(212, 175, 55, 0.18) 100%);
    border-color: rgba(14, 102, 84, 0.3);
    color: #073f35;
    box-shadow: 0 2px 8px rgba(7, 63, 53, 0.1);
}

[data-theme="light"] .ask-zad-online-dot {
    border-color: #f8fafc;
}

[data-theme="light"] .ask-zad-header-text h3 {
    color: #073f35 !important;
}

[data-theme="light"] .ask-zad-badge {
    color: #065f46;
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .ask-zad-header-text p {
    color: #64748b;
}

[data-theme="light"] .ask-zad-header-btn {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

[data-theme="light"] .ask-zad-header-btn:hover {
    background: #e2e8f0;
    color: #073f35;
    border-color: #cbd5e1;
}

[data-theme="light"] .ask-zad-welcome-card {
    background: #f0fdf4;
    border-color: rgba(14, 102, 84, 0.3);
}

[data-theme="light"] .ask-zad-welcome-title {
    color: #065f46;
}

[data-theme="light"] .ask-zad-welcome-desc {
    color: #334155;
}

[data-theme="light"] .ask-zad-chip {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .ask-zad-chip i {
    color: #059669;
}

[data-theme="light"] .ask-zad-chip:hover {
    background: #ecfdf5;
    border-color: #059669;
    color: #065f46;
}

[data-theme="light"] .ask-zad-msg-row.bot .ask-zad-msg-bubble {
    background: #f8fafc;
    color: #0f172a;
    border-color: #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .ask-zad-msg-row.bot .ask-zad-msg-bubble strong {
    color: #073f35;
}

[data-theme="light"] .ask-zad-action-btn {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
    font-weight: 700;
}

[data-theme="light"] .ask-zad-action-btn:hover {
    background: #059669;
    border-color: #059669;
    color: #ffffff;
}

[data-theme="light"] .ask-zad-msg-meta {
    border-top-color: rgba(0, 0, 0, 0.06);
    color: #64748b;
}

[data-theme="light"] .ask-zad-typing-dot {
    background: #059669;
}

[data-theme="light"] .ask-zad-footer {
    background: #ffffff;
    border-top-color: #e2e8f0;
}

[data-theme="light"] .ask-zad-input-form {
    background: #f8fafc;
    border-color: #cbd5e1;
}

[data-theme="light"] .ask-zad-input-form:focus-within {
    border-color: #059669;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

[data-theme="light"] .ask-zad-input {
    color: #0f172a;
}

[data-theme="light"] .ask-zad-input::placeholder {
    color: #94a3b8;
}

[data-theme="light"] .ask-zad-send-btn {
    background: linear-gradient(135deg, #0e6654 0%, #073f35 100%);
    color: #ffdb4d;
}

[data-theme="light"] .ask-zad-send-btn:hover {
    filter: brightness(1.15);
}

[data-theme="light"] .ask-zad-disclaimer {
    color: #64748b;
}

/* ==========================================================================
   التوافق مع الوضع الليلي الفاخر (Dark Theme Luxury Emerald & Gold)
   ========================================================================== */
[data-theme="dark"] .ask-zad-fab,
:root:not([data-theme="light"]) .ask-zad-fab {
    background: linear-gradient(135deg, #0e6654 0%, #073f35 60%, #04241e 100%);
    border-color: rgba(230, 189, 112, 0.75);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(230, 189, 112, 0.3);
}

[data-theme="dark"] .ask-zad-fab:hover,
:root:not([data-theme="light"]) .ask-zad-fab:hover {
    border-color: #ffd700;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 24px rgba(230, 189, 112, 0.45);
}

[data-theme="dark"] .ask-zad-fab-sparkle,
:root:not([data-theme="light"]) .ask-zad-fab-sparkle {
    background: #e6bd70;
    border-color: #04241e;
    box-shadow: 0 0 10px #e6bd70;
}

[data-theme="dark"] .ask-zad-overlay,
:root:not([data-theme="light"]) .ask-zad-overlay {
    background: rgba(4, 15, 12, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] .ask-zad-container,
:root:not([data-theme="light"]) .ask-zad-container {
    background: linear-gradient(180deg, #0f2b23 0%, #0a1f19 100%);
    border-color: rgba(230, 189, 112, 0.25);
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.75), 0 0 32px rgba(14, 102, 84, 0.15);
}

[data-theme="dark"] .ask-zad-drag-handle,
:root:not([data-theme="light"]) .ask-zad-drag-handle {
    background: rgba(230, 189, 112, 0.35);
}

[data-theme="dark"] .ask-zad-header,
:root:not([data-theme="light"]) .ask-zad-header {
    background: rgba(10, 31, 25, 0.88);
    border-bottom: 1px solid rgba(230, 189, 112, 0.16);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

[data-theme="dark"] .ask-zad-avatar,
:root:not([data-theme="light"]) .ask-zad-avatar {
    background: linear-gradient(135deg, rgba(230, 189, 112, 0.18) 0%, rgba(14, 102, 84, 0.35) 100%);
    border-color: rgba(230, 189, 112, 0.5);
    color: #e6bd70;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .ask-zad-online-dot,
:root:not([data-theme="light"]) .ask-zad-online-dot {
    background: #10b981;
    border-color: #0a1f19;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

[data-theme="dark"] .ask-zad-header-text h3,
:root:not([data-theme="light"]) .ask-zad-header-text h3 {
    color: #f3f8f4 !important;
}

[data-theme="dark"] .ask-zad-badge,
:root:not([data-theme="light"]) .ask-zad-badge {
    color: #e6bd70;
    background: rgba(230, 189, 112, 0.14);
    border-color: rgba(230, 189, 112, 0.35);
    font-weight: 700;
}

[data-theme="dark"] .ask-zad-header-text p,
:root:not([data-theme="light"]) .ask-zad-header-text p {
    color: #a7bfb0;
}

[data-theme="dark"] .ask-zad-header-btn,
:root:not([data-theme="light"]) .ask-zad-header-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(230, 189, 112, 0.2);
    color: #c0d4c8;
}

[data-theme="dark"] .ask-zad-header-btn:hover,
:root:not([data-theme="light"]) .ask-zad-header-btn:hover {
    background: rgba(230, 189, 112, 0.2);
    color: #ffd700;
    border-color: #e6bd70;
    box-shadow: 0 0 10px rgba(230, 189, 112, 0.3);
}

[data-theme="dark"] .ask-zad-welcome-card,
:root:not([data-theme="light"]) .ask-zad-welcome-card {
    background: linear-gradient(145deg, rgba(16, 48, 38, 0.5) 0%, rgba(8, 25, 20, 0.7) 100%);
    border: 1.5px dashed rgba(230, 189, 112, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .ask-zad-welcome-title,
:root:not([data-theme="light"]) .ask-zad-welcome-title {
    color: #e6bd70;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ask-zad-welcome-desc,
:root:not([data-theme="light"]) .ask-zad-welcome-desc {
    color: #c0d4c8;
}

[data-theme="dark"] .ask-zad-chip,
:root:not([data-theme="light"]) .ask-zad-chip {
    background: rgba(16, 45, 36, 0.6);
    border-color: rgba(230, 189, 112, 0.25);
    color: #f3f8f4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .ask-zad-chip i,
:root:not([data-theme="light"]) .ask-zad-chip i {
    color: #73d3ab;
}

[data-theme="dark"] .ask-zad-chip:hover,
:root:not([data-theme="light"]) .ask-zad-chip:hover {
    background: rgba(230, 189, 112, 0.22);
    border-color: #e6bd70;
    color: #ffd700;
    box-shadow: 0 0 12px rgba(230, 189, 112, 0.3);
    transform: translateY(-1px);
}

[data-theme="dark"] .ask-zad-chip:hover i,
:root:not([data-theme="light"]) .ask-zad-chip:hover i {
    color: #ffd700;
}

[data-theme="dark"] .ask-zad-msg-row.user .ask-zad-msg-bubble,
:root:not([data-theme="light"]) .ask-zad-msg-row.user .ask-zad-msg-bubble {
    background: linear-gradient(135deg, #0e6654 0%, #09473b 100%);
    color: #ffffff;
    border: 1px solid rgba(115, 211, 171, 0.25);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ask-zad-msg-row.bot .ask-zad-msg-bubble,
:root:not([data-theme="light"]) .ask-zad-msg-row.bot .ask-zad-msg-bubble {
    background: rgba(16, 44, 35, 0.85);
    color: #f3f8f4;
    border: 1px solid rgba(230, 189, 112, 0.22);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .ask-zad-msg-row.bot .ask-zad-msg-bubble strong,
:root:not([data-theme="light"]) .ask-zad-msg-row.bot .ask-zad-msg-bubble strong {
    color: #e6bd70;
}

[data-theme="dark"] .ask-zad-action-btn,
:root:not([data-theme="light"]) .ask-zad-action-btn {
    background: rgba(230, 189, 112, 0.12);
    border-color: rgba(230, 189, 112, 0.38);
    color: #ffd700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .ask-zad-action-btn:hover,
:root:not([data-theme="light"]) .ask-zad-action-btn:hover {
    background: linear-gradient(135deg, rgba(230, 189, 112, 0.3) 0%, rgba(14, 102, 84, 0.45) 100%);
    border-color: #ffd700;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(230, 189, 112, 0.35);
}

[data-theme="dark"] .ask-zad-msg-meta,
:root:not([data-theme="light"]) .ask-zad-msg-meta {
    border-top-color: rgba(255, 255, 255, 0.08);
    color: #a7bfb0;
}

[data-theme="dark"] .ask-zad-typing-dot,
:root:not([data-theme="light"]) .ask-zad-typing-dot {
    background: #e6bd70;
    box-shadow: 0 0 6px rgba(230, 189, 112, 0.6);
}

[data-theme="dark"] .ask-zad-footer,
:root:not([data-theme="light"]) .ask-zad-footer {
    background: rgba(8, 24, 19, 0.96);
    border-top: 1px solid rgba(230, 189, 112, 0.16);
}

[data-theme="dark"] .ask-zad-input-form,
:root:not([data-theme="light"]) .ask-zad-input-form {
    background: rgba(5, 17, 13, 0.7);
    border: 1.5px solid rgba(230, 189, 112, 0.3);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ask-zad-input-form:focus-within,
:root:not([data-theme="light"]) .ask-zad-input-form:focus-within {
    border-color: #e6bd70;
    background: rgba(8, 24, 19, 0.9);
    box-shadow: 0 0 16px rgba(230, 189, 112, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .ask-zad-input,
:root:not([data-theme="light"]) .ask-zad-input {
    color: #f3f8f4;
}

[data-theme="dark"] .ask-zad-input::placeholder,
:root:not([data-theme="light"]) .ask-zad-input::placeholder {
    color: rgba(192, 212, 200, 0.45);
}

[data-theme="dark"] .ask-zad-send-btn,
:root:not([data-theme="light"]) .ask-zad-send-btn {
    background: linear-gradient(135deg, #e6bd70 0%, #c49a45 100%);
    color: #081c17;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .ask-zad-send-btn:hover,
:root:not([data-theme="light"]) .ask-zad-send-btn:hover {
    background: linear-gradient(135deg, #ffd700 0%, #d4af37 100%);
    box-shadow: 0 0 14px rgba(230, 189, 112, 0.5);
    filter: brightness(1.1);
}

[data-theme="dark"] .ask-zad-disclaimer,
:root:not([data-theme="light"]) .ask-zad-disclaimer {
    color: #8fa89b;
}

/* تخصيص شريط التمرير (Scrollbar) في الوضع الليلي والنهاري */
.ask-zad-body::-webkit-scrollbar {
    width: 5px;
}
.ask-zad-body::-webkit-scrollbar-track {
    background: transparent;
}
[data-theme="dark"] .ask-zad-body::-webkit-scrollbar-thumb,
:root:not([data-theme="light"]) .ask-zad-body::-webkit-scrollbar-thumb {
    background: rgba(230, 189, 112, 0.2);
    border-radius: 9999px;
}
[data-theme="dark"] .ask-zad-body::-webkit-scrollbar-thumb:hover,
:root:not([data-theme="light"]) .ask-zad-body::-webkit-scrollbar-thumb:hover {
    background: rgba(230, 189, 112, 0.4);
}
[data-theme="light"] .ask-zad-body::-webkit-scrollbar-thumb {
    background: rgba(14, 102, 84, 0.2);
    border-radius: 9999px;
}
[data-theme="light"] .ask-zad-body::-webkit-scrollbar-thumb:hover {
    background: rgba(14, 102, 84, 0.4);
}

/* Compact controls, keyboard viewport and touch targets (Android & iPhone optimized) */
html.ask-zad-open,
body.ask-zad-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: none !important;
}
html.ask-zad-open #live-radio-widget {
    display: none;
}
.ask-zad-fab {
    min-height: 48px;
    min-width: 48px;
    width: 50px;
    height: 50px;
    padding: 0;
    right: max(14px, env(safe-area-inset-right, 14px));
    touch-action: manipulation;
}
.ask-zad-fab-icon { font-size: 21px; width: 100%; height: 100%; }
.ask-zad-fab-sparkle { display: block; }
.ask-zad-overlay {
    box-sizing: border-box;
    direction: inherit;
    overscroll-behavior: contain !important;
    touch-action: none;
}
.ask-zad-container {
    height: 100vh;
    height: 100dvh;
    max-height: 100%;
    box-sizing: border-box;
    overscroll-behavior: contain !important;
}
@media (min-width: 768px) {
    .ask-zad-container {
        height: min(860px, 90vh);
        max-height: 90vh;
    }
}
.ask-zad-body {
    min-height: 0;
    overscroll-behavior-y: contain !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
.ask-zad-header,
.ask-zad-footer,
.ask-zad-drag-bar {
    touch-action: none;
}
.ask-zad-header {
    padding: 10px 14px;
    gap: 8px;
}
.ask-zad-header-brand, .ask-zad-header-text { min-width: 0; }
.ask-zad-header-actions { flex-shrink: 0; }
.ask-zad-header-btn, .ask-zad-send-btn, .ask-zad-chip, .ask-zad-action-btn {
    min-width: 0;
    touch-action: manipulation;
}
.ask-zad-input {
    min-width: 0;
    font-size: 16px !important;
}
.ask-zad-msg-bubble {
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}
.ask-zad-msg-meta { flex-wrap: wrap; gap: 6px; }
.ask-zad-container :focus-visible { outline: 2px solid #d4af37; outline-offset: 2px; }

/* Small phones (iPhone SE, Galaxy A series <= 380px) */
@media (max-width: 380px) {
    .ask-zad-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
        border-radius: 10px;
    }
    .ask-zad-header-text h3 { font-size: 14.5px; }
    .ask-zad-header-text p { font-size: 10.5px; }
    .ask-zad-header-btn { width: 34px; height: 34px; font-size: 13px; }
    .ask-zad-chip { font-size: 11.5px; padding: 6px 10px; }
    .ask-zad-msg-bubble { max-width: 90%; font-size: 13.5px; }
}

/* Landscape orientation on mobile */
@media (max-height: 520px) {
    .ask-zad-container {
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    .ask-zad-header { padding: 6px 12px; }
    .ask-zad-header-text p,
    .ask-zad-disclaimer,
    .ask-zad-drag-bar { display: none; }
    .ask-zad-overlay { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .ask-zad-overlay, .ask-zad-container, .ask-zad-fab { transition: none; }
}
