/* ==========================================
   الشهيرة- Luxury Minimalist Design
   تصميم بسيط فاخر | أسود × ذهبي × أبيض
   زوايا حادة وجادة | فخامة راقية
   ========================================== */

:root {
    /* لوحة ألوان فاخرة - Luxury Black & Gold */
    --black-primary: #000000;       /* أسود نقي */
    --black-soft: #1A1A1A;          /* أسود ناعم */
    --black-light: #2D2D2D;         /* أسود فاتح */
    --charcoal: #3A3A3A;            /* فحمي */
    
    /* الذهبي الدافئ */
    --gold-primary: #D4AF37;        /* ذهبي كلاسيكي */
    --gold-light: #F4E4C1;          /* ذهبي فاتح */
    --gold-dark: #B8860B;           /* ذهبي داكن */
    --champagne: #F7E7CE;           /* شامبين */
    
    /* الأبيض الدافئ */
    --white-pure: #FFFFFF;          /* أبيض نقي */
    --white-warm: #FAFAFA;          /* أبيض دافئ */
    --cream: #F5F5F5;               /* كريمي */
    --ivory: #FEFEFE;               /* عاجي */
    
    /* الألوان المحايدة */
    --gray-50: #F9FAFB;
    --gray-100: #F5F5F5;
    --gray-200: #E8E8E8;
    --gray-300: #D1D1D1;
    --gray-500: #737373;
    --gray-700: #404040;
    --gray-900: #171717;
    
    /* الخلفيات */
    --bg-main: var(--white-pure);
    --bg-sidebar: var(--black-primary);
    --bg-card: var(--white-pure);
    --bg-hover: var(--cream);
    --bg-user: var(--cream);
    --bg-ai: var(--white-pure);
    
    /* النصوص */
    --text-primary: var(--black-primary);
    --text-secondary: var(--gray-700);
    --text-muted: var(--gray-500);
    --text-inverse: var(--white-pure);
    --text-gold: var(--gold-primary);
    
    /* الحدود والظلال */
    --border-light: var(--gray-200);
    --border-medium: var(--gray-300);
    --border-gold: var(--gold-primary);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px 0 rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 8px 0 rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 8px 16px 0 rgba(0, 0, 0, 0.16);
    --shadow-gold: 0 2px 8px rgba(212, 175, 55, 0.2);
    
    /* القياسات - زوايا حادة */
    --sidebar-width: 280px;
    --content-max-width: 900px;
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-xl: 8px;
    --radius-2xl: 10px;
    
    /* الحركة - أسرع وأكثر حدة */
    --transition: all 0.2s ease;
    --transition-fast: all 0.1s ease;

    /* تحسينات UI - مينيماليست */
    --ring: 0 0 0 2px rgba(212, 175, 55, 0.3);
    --focus-outline: 2px solid rgba(212, 175, 55, 0.8);
    --divider: rgba(0, 0, 0, 0.08);
    --text-on-gold: var(--black-primary);

    /* إحساس minimal */
    --surface: var(--white-pure);
    --surface-2: var(--cream);
    --border-subtle: rgba(0, 0, 0, 0.08);
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* تخفيف الظلال القديمة على كل العناصر */
* {
    text-rendering: geometricPrecision;
}

/* منع التمدد/التكبير المزعج بالـ iOS */
textarea,
input,
button {
    -webkit-tap-highlight-color: transparent;
}

button {
    font-family: inherit;
}

/* عناصر عامة */
.hidden {
    display: none !important;
}

/* ==========================================
   Layout الرئيسي
   ========================================== */

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ==========================================
   Sidebar - جانبية سوداء فاخرة وجادة
   ========================================== */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* تحسين تجربة الموبايل: طبقة تعتيم خلف الـ sidebar */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.35);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    z-index: 90;
}

.sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

/* رأس القائمة الجانبية */
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

/* شعار الشركة - مينيماليست */
.company-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gold-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 1px solid var(--gold-dark);
    box-shadow: var(--shadow-md);
}

.logo-text {
    text-align: center;
}

.company-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--white-pure);
    letter-spacing: 1px;
}

.company-tagline {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 400;
    margin-top: 0;
    letter-spacing: 0.5px;
}

/* زر محادثة جديدة - جاد وفاخر */
.new-chat-btn {
    width: 100%;
    padding: 12px 18px;
    background: var(--gold-primary);
    border: 1px solid var(--gold-dark);
    border-radius: var(--radius-sm);
    color: var(--black-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.new-chat-btn:active {
    transform: scale(0.98);
}

.new-chat-btn:hover {
    background: var(--gold-dark);
    box-shadow: var(--shadow-gold);
}

.new-chat-btn svg {
    width: 18px;
    height: 18px;
}

/* تاريخ المحادثات */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-history::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.chat-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.history-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 16px 12px 8px;
    margin-top: 8px;
}

.history-item {
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.history-item svg {
    flex-shrink: 0;
    opacity: 0.95;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white-pure);
    padding-right: 16px;
}

.history-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white-pure);
    border-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* منطقة المستخدم */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-info span {
    color: var(--text-on-gold);
    font-weight: 600;
    font-size: 13px;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.1);
}

.avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white-pure);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--white-pure);
}

.user-role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

/* ==========================================
   المحتوى الرئيسي
   ========================================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    min-width: 0;
}

/* رأس المحادثة */
.chat-header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--white-pure);
    border-bottom: 1px solid var(--divider);
    box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* زر القائمة بالموبايل */
.menu-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-light);
    background: var(--white-pure);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    color: var(--text-muted);
}

.menu-toggle:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
    color: var(--gold-primary);
}

.menu-toggle:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

.chat-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-badge {
    padding: 4px 12px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(184, 134, 11, 0.12));
    color: var(--gold-dark);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* زر الإعدادات الحالي بالـHTML */
.icon-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-light);
    background: var(--white-pure);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    color: var(--text-muted);
}

.icon-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
    color: var(--gold-primary);
}

.icon-btn:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-light);
    background: var(--white-pure);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    color: var(--text-muted);
}

.header-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
    color: var(--gold-primary);
}

/* ==========================================
   منطقة الرسائل
   ========================================== */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px 0;
    /* خلفية فاخرة مع لمسات ذهبية خفيفة */
    background:
        radial-gradient(900px 240px at 20% 12%, rgba(212, 175, 55, 0.06), transparent 60%),
        radial-gradient(900px 240px at 85% 18%, rgba(184, 134, 11, 0.05), transparent 55%),
        var(--bg-main);
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--gray-100);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 10px;
}

/* شاشة الترحيب */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.welcome-screen p {
    color: var(--text-secondary);
    margin-top: 2px;
    margin-bottom: 28px;
}

.welcome-logo {
    width: 80px;
    height: 80px;
    background: var(--gold-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gold-dark);
}

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

.welcome-screen h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 500px;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    max-width: 900px;
    width: 100%;
}

.suggestion-card {
    padding: 18px;
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: right;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.suggestion-card:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

.suggestion-card:hover {
    border-color: var(--gold-primary);
    box-shadow: var(--shadow-md);
}

.suggestion-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.suggestion-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.suggestion-sub {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* الرسائل */
.message {
    padding: 20px 24px;
    width: 100%;
    animation: slideIn 0.28s cubic-bezier(0.4, 0, 0.2, 1);

    /* layout */
    display: flex;
    gap: 14px;
    align-items: flex-start;
    max-width: var(--content-max-width);
    margin: 0 auto;
}

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

.message.user {
    background: transparent;
}

.message.assistant {
    background: var(--gray-50);
}

/* ملاحظة: الـJS الحالي يبني `.message-avatar` و `.message-content` وليس wrapper */

.message-content {
    flex: 1;
    min-width: 0;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.message.user .message-avatar {
    background: var(--gold-primary);
    color: var(--black-primary);
    border: 1px solid var(--gold-dark);
}

.message.assistant .message-avatar {
    background: var(--black-primary);
    color: var(--gold-primary);
    border: 1px solid var(--gray-700);
}

.message-bubble {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.message.user .message-bubble {
    background: var(--cream);
    border-color: var(--border-medium);
}

.message.assistant .message-bubble {
    background: var(--white-pure);
    border-color: var(--border-light);
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* صور inline داخل الرسائل */
.inline-image-container {
    margin: 10px 0;
    display: flex;
    justify-content: flex-start;
}

.inline-product-image {
    width: min(360px, 100%);
    max-height: 240px;
    object-fit: contain;
    background: #fff;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: var(--radius-lg);
    padding: 10px;
    box-shadow: var(--shadow-md);
}

/* ==========================================
   حقل الإدخال
   ========================================== */

.input-container {
    background: var(--white-pure);
    padding: 20px 32px 28px;
    border-top: 1px solid var(--divider);
    box-shadow: 0 -12px 28px rgba(17, 24, 39, 0.04);
}

/* معاينة الصورة المرفوعة */
.image-preview-container {
    max-width: var(--content-max-width);
    margin: 0 auto 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: var(--radius-xl);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 26px rgba(17, 24, 39, 0.06);
}

.image-preview-container img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid rgba(17, 24, 39, 0.10);
    background: #fff;
}

.remove-image-btn {
    margin-right: auto;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(17, 24, 39, 0.10);
    background: var(--white-pure);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.remove-image-btn:hover {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.25);
    color: rgb(185, 28, 28);
}

.input-wrapper {
    max-width: var(--content-max-width);
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 22px rgba(17, 24, 39, 0.06);
    display: flex;
    align-items: flex-end;
    padding: 14px 18px;
    gap: 12px;
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: rgba(212, 175, 55, 0.45);
    box-shadow: var(--ring), 0 12px 28px rgba(17, 24, 39, 0.08);
}

#messageInput {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 16px;
    color: var(--text-primary);
    max-height: 200px;
    resize: none;
    padding: 6px 0;
    line-height: 1.6;
}

#messageInput {
    caret-color: var(--gold-primary);
}

#messageInput:focus {
    outline: none;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--gray-100);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* زر رفع الصور الموجود بالـHTML */
.upload-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.upload-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
    color: var(--gold-primary);
}

.upload-btn:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

/* 🎤 زر التسجيل الصوتي */
.voice-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    position: relative;
}

.voice-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
    color: var(--gold-primary);
}

.voice-btn:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

/* حالة التسجيل النشط */
.voice-btn.recording {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
    animation: pulse-recording 1.5s infinite;
}

.voice-btn.recording:hover {
    background: #b91c1c;
}

@keyframes pulse-recording {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
    }
}

/* موجات الصوت */
.voice-waves {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 20px;
}

.voice-waves span {
    width: 3px;
    height: 8px;
    background: white;
    border-radius: 2px;
    animation: wave 0.8s ease-in-out infinite;
}

.voice-waves span:nth-child(1) { animation-delay: 0s; }
.voice-waves span:nth-child(2) { animation-delay: 0.1s; }
.voice-waves span:nth-child(3) { animation-delay: 0.2s; }
.voice-waves span:nth-child(4) { animation-delay: 0.3s; }

@keyframes wave {
    0%, 100% { height: 8px; }
    50% { height: 18px; }
}

/* حالة المعالجة */
.voice-btn.processing {
    background: var(--gold-primary);
    border-color: var(--gold-dark);
    color: var(--black-primary);
}

.action-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold-primary);
}

.send-btn {
    background: var(--gold-primary);
    color: var(--black-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gold-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.send-btn:focus-visible {
    outline: 2px solid var(--gold-primary);
    outline-offset: 2px;
}

.send-btn:hover {
    background: var(--gold-dark);
    box-shadow: var(--shadow-md);
}

.send-btn:disabled {
    background: var(--gray-200);
    color: var(--gray-500);
    cursor: not-allowed;
    box-shadow: none;
    border-color: var(--gray-300);
}

.input-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}

/* ==========================================
   بطاقات المنتجات - نمط Lavender
   ========================================== */

.products-container {
    margin-top: 32px;
    padding: 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 16px 32px rgba(17, 24, 39, 0.06);
}

.products-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.products-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.products-badge {
    padding: 6px 12px;
    background: var(--gold-primary);
    color: var(--black-primary);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gold-dark);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.product-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-card);
    transition: var(--transition-fast);
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.product-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gold-primary);
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    background: var(--gold-primary);
    color: var(--black-primary);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 700;
    z-index: 10;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gold-dark);
}

.product-image-wrapper {
    height: 240px;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border-bottom: 1px solid var(--divider);
    position: relative;
    overflow: hidden;
}

.product-image-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    /* Disable the purple tint overlay so image background stays pure white */
    background: transparent;
}

.product-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    padding: 16px;
}

.product-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    display: -webkit-box;
    line-clamp: 1;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-description {
    font-size: 13px;
    color: var(--text-secondary);
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
    line-height: 1.5;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid var(--divider);
}

.product-price {
    font-weight: 700;
    font-size: 16px;
    color: var(--gold-primary);
}

.product-currency {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: 4px;
}

.product-btn {
    background: var(--gold-primary);
    color: var(--black-primary);
    border: 1px solid var(--gold-dark);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.product-btn:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

.product-btn:hover {
    background: var(--gold-dark);
    box-shadow: var(--shadow-md);
}

/* شاشة التحميل - خفيفة وأنيقة */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    pointer-events: none;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    z-index: 999;
}

.loading-overlay.show {
    display: flex;
}

.loading-overlay p {
    display: none;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--gold-primary);
    animation: spin 0.8s linear infinite;
    pointer-events: auto;
    background: white;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.25);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   مؤشر الكتابة
   ========================================== */

.typing-indicator {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px 0;
}

/* رسالة المستخدم مع صورة */
.message-with-image {
    display: flex;
    align-items: center;
    gap: 12px;
}

.message-with-image img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid rgba(17, 24, 39, 0.10);
    background: #fff;
}

.message-with-image span {
    font-weight: 600;
    color: var(--text-primary);
}

/* مؤشر تحليل الصورة */
.analyzing-message {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(212, 175, 55, 0.25);
    border-top-color: var(--gold-primary);
    animation: spin 0.9s linear infinite;
    flex-shrink: 0;
}

.typing-indicator span {
    background: var(--gold-primary);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

/* ==========================================
   Responsive Design
   ========================================== */

@media (max-width: 1024px) {
    :root {
        --content-max-width: 720px;
    }
    
    .chat-header,
    .input-container {
        padding-left: 24px;
        padding-right: 24px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 85%;
    }
    
    .sidebar {
        position: fixed;
        right: -100%;
        height: 100%;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.show {
        right: 0;
    }
    
    .chat-header {
        height: 64px;
        padding: 0 16px;
    }

    .menu-toggle {
        display: inline-flex;
    }
    
    .chat-title {
        font-size: 16px;
    }
    
    .welcome-screen h2 {
        font-size: 24px;
    }
    
    .suggestions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .message {
        padding: 20px 16px;
    }

    .message {
        gap: 12px;
    }
    
    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .input-container {
        padding: 16px 16px 24px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }

    .message-bubble {
        padding: 12px 14px;
        border-radius: 16px;
    }

    .inline-product-image {
        width: 100%;
        max-height: 220px;
    }
}

/* ==========================================
   لمسات نهائية
   ========================================== */

html {
    scroll-behavior: smooth;
}

button:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}