/* ===== CSS Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    background: var(--bg-cream);
    margin: 0;
    padding: 0;
}

:root {
    /* ===== شاهين AI Design System - Arabic Financial Excellence ===== */
    
    /* Primary Brand Colors */
    --primary-gold: #D4AF37;           /* الذهبي الأساسي */
    --primary-gold-light: #E5C158;     /* ذهبي فاتح */
    --primary-gold-dark: #B8941F;      /* ذهبي داكن */
    --accent-gold-light: #F4D03F;      /* ذهبي فاتح للتمرير */
    --primary-color: #D4AF37;          /* للتوافق مع الكود القديم */
    --primary-hover: #B8941F;
    
    /* Trust & Professional Colors */
    --trust-blue: #1E3A8A;             /* أزرق الثقة */
    --trust-blue-light: #3B5998;       /* أزرق فاتح */
    
    /* Financial Indicators */
    --gain-green: #10B981;             /* أخضر الصعود */
    --gain-green-dark: #059669;        /* أخضر داكن */
    --loss-red: #EF4444;               /* أحمر الهبوط */
    --loss-red-dark: #DC2626;          /* أحمر داكن */
    --neutral-gray: #6B7280;           /* رمادي محايد */
    
    /* Background Colors - Cream Theme */
    --bg-cream: #FAF8F3;               /* كريمي أساسي */
    --bg-cream-light: #FDFCFA;         /* كريمي فاتح */
    --bg-cream-dark: #F5F2EB;          /* كريمي داكن */
    --bg-white: #FFFFFF;               /* أبيض نقي */
    --bg-primary: #FFFFFF;
    --bg-secondary: #FAF8F3;
    --bg-user: #1a1a1a;                /* أسود لرسائل المستخدم */
    --bg-ai: #FAF8F3;                  /* كريمي لرسائل AI */
    
    /* Dark Theme Elements */
    --dark-primary: #1a1a1a;           /* أسود أساسي */
    --dark-secondary: #2d2d2d;         /* أسود ثانوي */
    --dark-tertiary: #3a3a3a;          /* أسود ثالثي */
    --accent-color: #1a1a1a;
    
    /* Text Colors */
    --text-primary: #1F2937;           /* نص أساسي */
    --text-secondary: #6B7280;         /* نص ثانوي */
    --text-tertiary: #9CA3AF;          /* نص خفيف */
    --text-gold: #B8860B;              /* نص ذهبي */
    
    /* Border Colors */
    --border-light: #E5E7EB;           /* حدود فاتحة */
    --border-cream: #E8DCC8;           /* حدود كريمية */
    --border-gold: rgba(212, 175, 55, 0.3); /* حدود ذهبية */
    --border-dark: #4B5563;            /* حدود داكنة */
    --border-dark-secondary: #374151;  /* حدود داكنة ثانوية */
    --border-color: #E8DCC8;
    
    /* Status Colors */
    --error-color: #EF4444;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-gold: 0 4px 15px rgba(212, 175, 55, 0.25);
    
    /* Gradients */
    --gradient-gold: linear-gradient(135deg, #D4AF37 0%, #E5C158 100%);
    --gradient-dark: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);
    --gradient-cream: linear-gradient(180deg, #FAF8F3 0%, #FDFCFA 100%);
    
    /* Typography */
    --font-primary: 'IBM Plex Sans Arabic', 'Cairo', Tahoma, sans-serif;
    --font-display: 'Cairo', 'IBM Plex Sans Arabic', sans-serif;
    --font-size-base: 16px;
    --font-size-sm: 0.875rem;
    --font-size-lg: 1.125rem;
    --line-height-normal: 1.7;
    --line-height-relaxed: 1.8;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-cream);
    color: var(--text-primary);
    line-height: var(--line-height-normal);
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    /* Force Western numerals (0-9) globally */
    font-feature-settings: "tnum" on, "lnum" on;
    font-variant-numeric: tabular-nums lining-nums;
}

/* ===== Container ===== */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ===== Header ===== */
.header {
    background: var(--gradient-dark);
    border-bottom: 3px solid var(--primary-color);
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-image {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    animation: shaheenFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.5));
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
    transition: all 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.8));
}

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

/* ===== Splash Screen Styles ===== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: splashFadeOut 0.5s ease-out 1.5s forwards;
}

.splash-content {
    text-align: center;
    animation: splashContentFadeIn 0.8s ease-out;
}

.splash-logo {
    position: relative;
    margin: 0 auto 2rem;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.splash-logo-img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 2;
    animation: splashLogoScale 1.5s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.6),
                0 0 80px rgba(212, 175, 55, 0.4),
                0 0 120px rgba(212, 175, 55, 0.2);
}

.splash-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.3) 0%, transparent 70%);
    animation: splashGlowPulse 2s ease-in-out infinite;
}

.splash-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #D4AF37 0%, #FFD700 50%, #D4AF37 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 1rem 0;
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    animation: splashTitleGlow 2s ease-in-out infinite;
}

.splash-subtitle {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    color: #bbb;
    margin: 0 0 2.5rem 0;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.splash-loader {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loader-bar {
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #D4AF37 50%, 
        transparent 100%);
    animation: splashLoaderMove 1.5s ease-in-out infinite;
}

/* Splash Animations */
@keyframes splashFadeOut {
    to {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

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

@keyframes splashLogoScale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes splashGlowPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.3;
    }
}

@keyframes splashTitleGlow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
    }
    50% {
        text-shadow: 0 0 40px rgba(212, 175, 55, 0.8),
                     0 0 60px rgba(212, 175, 55, 0.6);
    }
}

@keyframes splashLoaderMove {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(200%);
    }
}

.logo h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
    letter-spacing: 0.5px;
}

.status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 20px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== Chat Container ===== */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 1rem;
    padding-bottom: 200px; /* Space for fixed input area + footer + related questions */
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    background: var(--bg-cream);
    -webkit-overflow-scrolling: touch;
}

/* Desktop: Centered chat with max-width */
@media (min-width: 1024px) {
    .chat-container {
        max-width: 900px;
        padding: 0 2rem;
    }
}

/* Custom Scrollbar */
.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ===== Welcome Message ===== */
.welcome-message {
    text-align: center;
    padding: 3rem 1rem;
    animation: fadeIn 0.5s ease-in;
}

.welcome-icon {
    margin-bottom: 1.5rem;
}

.welcome-message h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.welcome-message p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ===== Warren AI Style Welcome ===== */
.welcome-message.warren-style {
    background: var(--bg-cream);
    padding: 4rem 2rem;
    margin: 0;
    width: 100%;
    max-width: 100%;
    flex: 1;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 4rem;
}

/* Warren Branding - Logo + Tagline */
.warren-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.warren-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.warren-tagline {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--primary-gold);
    text-align: center;
    margin: 0;
}

.warren-question {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-gold);
    margin-bottom: 2rem;
    text-align: center;
}

/* Gold Gradient Border Search Box */
.warren-search-wrapper {
    width: 100%;
    max-width: 650px;
    padding: 3px;
    background: var(--gradient-gold);
    border-radius: 50px;
    margin-bottom: 2.5rem;
}

.warren-search-box {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: var(--bg-white);
    border-radius: 47px;
    padding: 0.5rem 1rem;
    gap: 0.75rem;
}

.warren-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 1rem;
    padding: 0.75rem 0.5rem;
    text-align: right;
    direction: rtl;
}

.warren-search-input::placeholder {
    color: var(--text-tertiary);
}

.warren-search-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--primary-gold);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.warren-search-btn:hover {
    transform: scale(1.1);
    color: var(--accent-gold-light);
}

.warren-search-btn svg {
    transform: rotate(0deg);
}

/* Explore Text */
.warren-explore-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

/* Warren AI Category Pills Container */
.warren-categories {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 600px;
    margin-bottom: 1.5rem;
    width: 100%;
}

.warren-pills-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

/* Category Pill Button - Light Theme with Gold Accents */
.warren-category-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    background: var(--bg-white);
    border: 1px solid var(--border-cream);
    border-radius: 20px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.warren-category-pill:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--primary-gold);
    color: var(--primary-gold);
}

.warren-category-pill:active {
    transform: scale(0.98);
}

.warren-category-pill .pill-icon {
    font-size: 0.9rem;
}

.warren-category-pill .pill-arrow {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-right: -0.25rem;
}

/* New Features Row - Featured buttons at bottom */
.new-features-row {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
}

/* Direct Action Buttons - No Arrow */
.warren-category-pill.direct-action {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(212, 175, 55, 0.03) 100%);
    border-color: rgba(212, 175, 55, 0.3);
}

.warren-category-pill.direct-action:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(212, 175, 55, 0.08) 100%);
    border-color: var(--primary-gold);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
}

/* NEW Badge */
.new-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.4rem;
    background: linear-gradient(135deg, #D4AF37 0%, #c9a227 100%);
    color: #1a1a1a;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 8px;
    margin-right: -0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(1.02);
    }
}

/* Category Menu Container */
.category-menu-container {
    width: 100%;
    max-width: 600px;
}

/* Category Menu - Slide Panel - Light Theme */
.category-menu {
    background: var(--bg-white);
    border: 1px solid var(--border-cream);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideDown 0.25s ease-out;
    margin-bottom: 1rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-menu-header {
    padding: 0;
    border-bottom: 1px solid var(--border-cream);
}

.category-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-align: right;
}

.category-back-btn:hover {
    background: rgba(212, 175, 55, 0.1);
}

.category-back-btn span:first-child {
    color: var(--primary-gold);
    font-size: 1rem;
}

.category-menu-items {
    padding: 0.25rem 0;
}

.category-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-cream);
}

.category-menu-item:last-child {
    border-bottom: none;
}

.category-menu-item:hover {
    background: rgba(212, 175, 55, 0.15);
    color: var(--primary-gold);
}

.category-menu-item:active {
    background: rgba(212, 175, 55, 0.25);
}

.category-menu-item .item-arrow {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Legacy pill support for backwards compatibility */
.warren-pills-container {
    display: none;
}

.warren-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border-cream);
    border-radius: 25px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.warren-pill:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--primary-gold);
    color: var(--primary-gold);
}

.pill-icon {
    font-size: 1rem;
}

/* Responsive Warren Style */
@media (max-width: 768px) {
    .welcome-message.warren-style {
        padding: 3rem 1rem;
        padding-top: 1.5rem;
    }
    
    .warren-branding {
        margin-bottom: 1.5rem;
    }
    
    .warren-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 0.5rem;
    }
    
    .warren-tagline {
        font-size: 0.8rem;
    }
    
    .warren-question {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .warren-search-wrapper {
        max-width: 100%;
    }
    
    .warren-categories {
        gap: 0.5rem;
    }
    
    .warren-pills-row {
        gap: 0.4rem;
    }
    
    .warren-category-pill {
        padding: 0.4rem 0.7rem;
        font-size: 0.75rem;
    }
    
    .warren-category-pill .pill-icon {
        font-size: 0.8rem;
    }
    
    .category-menu {
        border-radius: 10px;
    }
    
    .category-back-btn {
        padding: 0.75rem 0.875rem;
        font-size: 0.85rem;
    }
    
    .category-menu-item {
        padding: 0.75rem 0.875rem;
        font-size: 0.85rem;
    }
    
    .warren-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.example-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.example-prompt {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: right;
}

.example-prompt:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* ===== Main Menu ===== */
.main-menu {
    max-width: 800px;
    margin: 2rem auto 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.menu-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.menu-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.menu-item.active {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.menu-item-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.menu-item-header:hover {
    background: var(--bg-secondary);
}

.menu-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.menu-title {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

.menu-arrow {
    color: var(--text-secondary);
    font-size: 0.75rem;
    transition: transform 0.3s;
}

/* ===== Sub Menu ===== */
.sub-menu {
    display: none;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sub-menu-item {
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    text-align: right;
    font-size: 0.95rem;
}

.sub-menu-item:hover {
    background: var(--bg-primary);
    color: var(--primary-color);
    transform: translateX(-5px);
}

/* ===== Inline Expandable Panels ===== */
.inline-panel {
    margin-top: 1.5rem;
    background: var(--bg-white);
    border: 1px solid var(--border-cream);
    border-radius: 16px;
    padding: 1.25rem;
    animation: slideDown 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.inline-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-gold);
}

.inline-panel-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-gold);
}

.inline-panel-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.inline-panel-close:hover {
    background: rgba(212, 175, 55, 0.2);
    color: var(--primary-gold);
}

.inline-panel-search {
    position: relative;
    margin-bottom: 1rem;
}

.inline-search-input {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-right: 2.75rem;
    border: 1px solid var(--border-cream);
    border-radius: 10px;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    background: var(--bg-cream);
    color: var(--text-primary);
    transition: all 0.2s;
    text-align: right;
}

.inline-search-input::placeholder {
    color: var(--text-tertiary);
}

.inline-search-input:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.inline-search-input.small {
    padding: 0.625rem 0.875rem;
    padding-right: 2.25rem;
    font-size: 0.875rem;
}

.inline-search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--text-secondary);
}

.inline-panel-list {
    max-height: 280px;
    overflow-y: auto;
    border-radius: 8px;
    background: var(--bg-cream);
    border: 1px solid var(--border-cream);
}

.inline-panel-list.small {
    max-height: 180px;
}

.inline-panel-list::-webkit-scrollbar {
    width: 6px;
}

.inline-panel-list::-webkit-scrollbar-track {
    background: var(--bg-cream-dark);
    border-radius: 3px;
}

.inline-panel-list::-webkit-scrollbar-thumb {
    background: var(--primary-gold);
    border-radius: 3px;
}

.inline-panel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid var(--border-cream);
}

.inline-panel-item:last-child {
    border-bottom: none;
}

.inline-panel-item:hover {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.15), transparent);
}

.inline-panel-item.selected {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.25), rgba(212, 175, 55, 0.1));
    border-right: 3px solid var(--primary-gold);
}

.inline-item-name {
    font-family: var(--font-primary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.inline-item-symbol {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-cream-dark);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    font-variant-numeric: tabular-nums;
}

.inline-panel-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-align: center;
}

/* Comparison Inline Panels */
.comparison-inline-boxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.comparison-inline-box {
    background: var(--bg-cream);
    border: 1px solid var(--border-cream);
    border-radius: 10px;
    padding: 0.75rem;
}

.comparison-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-gold);
    margin-bottom: 0.5rem;
    text-align: center;
}

.inline-compare-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--gradient-gold);
    color: var(--dark-primary);
    border: none;
    border-radius: 10px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.inline-compare-btn:disabled {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.inline-compare-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

/* Selected Funds Display */
.selected-funds-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    min-height: 2rem;
}

.selected-fund-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.1));
    border: 1px solid var(--primary-color);
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.selected-fund-tag .remove-fund {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    transition: color 0.2s;
}

.selected-fund-tag .remove-fund:hover {
    color: #ff6b6b;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .comparison-inline-boxes {
        grid-template-columns: 1fr;
    }
    
    .inline-panel {
        padding: 1rem;
    }
    
    .inline-panel-list {
        max-height: 200px;
    }
}

/* ===== Company Search ===== */
.company-search {
    position: relative;
    margin: 0.5rem;
}

.company-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
    text-align: right;
}

.company-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.company-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item .company-name {
    font-weight: 500;
    color: var(--text-primary);
}

.dropdown-item .company-symbol {
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.dropdown-item.no-results {
    color: var(--text-secondary);
    font-style: italic;
    cursor: default;
}

.dropdown-item.no-results:hover {
    background: transparent;
}

/* ===== Related Buttons ===== */
.related-buttons-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Spacer to ensure content is visible above fixed input */
.bottom-spacer {
    height: 120px;
    width: 100%;
}

.related-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.related-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.related-button {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.related-button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Responsive */
@media (max-width: 768px) {
    .main-menu {
        margin: 1.5rem auto 0;
    }
    
    .menu-item-header {
        padding: 0.875rem 1rem;
    }
    
    .related-buttons {
        flex-direction: column;
    }
    
    .related-button {
        width: 100%;
        text-align: center;
    }
}

.prompt-icon {
    font-size: 1.5rem;
}

/* ===== Messages ===== */
.message {
    display: flex;
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease-out;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.message.user {
    justify-content: flex-start;
}

.message.ai {
    justify-content: flex-end;
}

.message-content {
    max-width: 95%;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    position: relative;
}

/* Full-width content for AI messages with tables */
.message.ai .message-content.has-table {
    max-width: 100%;
    padding: 1rem;
}

.message.user .message-content {
    background: var(--bg-user);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.ai .message-content {
    background: var(--bg-ai);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.message-text {
    font-family: var(--font-primary);
    line-height: var(--line-height-relaxed);
    direction: rtl;
    text-align: right;
}

/* Force Western numerals (0-9) instead of Arabic-Indic (٠-٩) */
.message-text,
.message-text table,
.message-text td,
.warren-table-wrapper,
.warren-table-wrapper table,
.warren-table-wrapper td {
    font-feature-settings: "tnum" on, "lnum" on;
    font-variant-numeric: tabular-nums lining-nums;
}

/* Table wrapper for horizontal scroll */
.message-text .table-wrapper,
.warren-table-wrapper {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
    direction: rtl;
    margin: 1rem 0;
    display: block !important;
}

.message-text p {
    margin-bottom: 0.5rem;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text h1,
.message-text h2,
.message-text h3 {
    font-family: var(--font-display);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.message-text ul,
.message-text ol {
    margin: 0.5rem 0;
    padding-right: 1.5rem;
}

.message-text li {
    margin-bottom: 0.25rem;
}

.message-text code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.message-text pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.message-text pre code {
    background: none;
    padding: 0;
}

/* Table styles moved to unified section below (.chart-container table, .message-text table) */

/* ===== Warren AI Style Headings ===== */
.message-text h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-gold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-text h3:first-child {
    margin-top: 0;
}

/* ===== Insights Box ===== */
.message-text p strong:first-child {
    color: var(--primary-color);
}

/* ===== Summary Paragraph Style ===== */
.message-text > p:first-of-type {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2c2c2c;
    margin-bottom: 1.5rem;
}

/* ===== Bold Numbers Highlight ===== */
.message-text strong {
    color: #1a1a1a;
    font-weight: 700;
}

/* ===== List Items Warren AI Style ===== */
.message-text ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.message-text ul li {
    position: relative;
    padding-right: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.message-text ul li::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0.6rem;
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
}

/* ===== Evaluation Section ===== */
.message-text h3:last-of-type {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.1) 0%, transparent 100%);
    padding: 1rem;
    border-radius: 8px;
    border-bottom: none;
    margin-bottom: 1rem;
}

.message-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.message-text a:hover {
    text-decoration: underline;
}

.message-metadata {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ===== Model Indicator ===== */
.model-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

/* ===== Thinking Indicator ===== */
.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 500;
    animation: thinkingPulse 1.5s ease-in-out infinite;
}

@keyframes thinkingPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ===== Error Text ===== */
.error-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #ef4444;
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ===== Inline Charts ===== */
.inline-chart {
    margin: 1rem 0;
    border-radius: 12px;
    overflow: hidden;
}

/* ===== Typing Indicator ===== */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ===== Company Card ===== */
.company-card {
    background: var(--gradient-gold);
    border-radius: 16px;
    padding: 1.5rem;
    color: var(--dark-primary);
    margin: 1rem 0;
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.company-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.company-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.company-ticker {
    font-size: 0.875rem;
    opacity: 0.9;
}

.company-logo {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #1a1a1a;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.company-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat {
    background: rgba(255, 255, 255, 0.4);
    padding: 0.75rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.stat-label {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.stat-value.positive {
    color: #10b981;
}

.stat-value.negative {
    color: #ef4444;
}

/* ===== Error Message ===== */
.error-message {
    background: #fee;
    border: 1px solid var(--error-color);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    color: var(--error-color);
}

.error-message strong {
    display: block;
    margin-bottom: 0.5rem;
}

.retry-button {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.retry-button:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* ===== Input Area ===== */
.input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-cream);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

.input-form {
    display: flex;
    gap: 0.75rem;
    max-width: 900px;
    margin: 0 auto;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    font-family: var(--font-primary);
    font-size: 1rem;
    resize: none;
    max-height: 120px;
    transition: all 0.2s;
    background: var(--bg-white);
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.send-button {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-footer {
    text-align: center;
    margin-top: 0.75rem;
}

.footer-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ===== AI Disclaimer ===== */
.ai-disclaimer {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0.75rem 0 0 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.ai-disclaimer em {
    font-style: italic;
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease-in-out;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--error-color);
}

.toast.success {
    background: var(--success-color);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .status {
        padding: 0.375rem 0.75rem;
    }

    .chat-container {
        padding: 1rem 0.5rem;
    }

    .message-content {
        max-width: 100%;
        padding: 0.75rem;
    }
    
    /* Full-width AI messages on mobile */
    .message.ai .message-content {
        max-width: 100%;
    }
    
    /* Mobile table optimization */
    .warren-table-wrapper,
    .message-text .table-wrapper {
        margin: 0.75rem -0.75rem;
        border-radius: 0;
        width: calc(100% + 1.5rem);
    }
    
    th, td,
    .warren-table-wrapper th,
    .warren-table-wrapper td,
    .message-text table th,
    .message-text table td {
        padding: 0.6rem 0.5rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
    }
    
    /* Compact header on mobile */
    th:last-child,
    .warren-table-wrapper th:last-child {
        padding-right: 0.75rem !important;
    }

    .welcome-message {
        padding: 2rem 0.5rem;
    }

    .welcome-message h2 {
        font-size: 1.1rem;
    }

    .example-prompts {
        grid-template-columns: 1fr;
    }

    .input-area {
        padding: 0.75rem 1rem;
    }

    .company-stats {
        grid-template-columns: 1fr 1fr;
    }

    .toast {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
    }
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== Processing Indicator ===== */
.processing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 1rem 0;
}

/* ===== Metadata Badge ===== */
.metadata-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.metadata-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.metadata-badge.info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* ===== Charts ===== */
.chart-container {
    width: 100%;
    min-height: 350px;
    margin: 0.5rem 0;
    padding: 0;
    background: transparent !important;
    border: none !important;
    border-radius: 0;
    box-shadow: none !important;
    direction: rtl;
}

/* ECharts container needs explicit height */
.chart-container:has(canvas) {
    min-height: 400px;
    padding: 1rem;
    background: #f9fafb !important;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

/* Chart container with actual charts (Highcharts) needs some styling */
.chart-container:has(.highcharts-container) {
    padding: 1rem;
    background: #f9fafb !important;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

/* Inline chart containers */
.inline-chart {
    min-height: 400px;
}

/* Extra chart containers (for radar, grouped_bar, etc.) */
.charts-wrapper .chart-container {
    min-height: 400px;
}

.chart-container canvas,
.chart-container svg {
    max-width: 100%;
    height: auto;
}

.chart-placeholder {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
}

.chart-error {
    padding: 1.5rem;
    text-align: center;
    color: #dc2626;
    background: #fee2e2;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.9rem;
}

/* Highcharts container */
.chart-container .highcharts-container {
    border-radius: 8px;
    overflow: hidden;
}

/* ===== Unified Premium Table Design - Warren AI Style ===== */
/* Reference: جدول "مقارنة سريعة مع أبرز شركات القطاع" */

/* Warren Table Wrapper */
.warren-table-wrapper {
    background: var(--bg-cream) !important;
    border-radius: 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
    direction: rtl !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04) !important;
    margin: 1rem 0 !important;
    border: 1px solid var(--border-cream) !important;
}

/* Table Title - Cream/beige background with gold underline */
.warren-table-title {
    font-family: var(--font-display) !important;
    margin: 0 !important;
    padding: 0.85rem 1.25rem !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    background: var(--bg-cream) !important;
    text-align: right !important;
    border: none !important;
    border-bottom: 2px solid var(--primary-gold) !important;
    direction: rtl !important;
}

/* ========== ALL Tables - Unified Style ========== */
table,
.chart-container table,
.message-text table,
.warren-table-wrapper table {
    font-family: var(--font-primary) !important;
    width: 100% !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    background: var(--bg-cream) !important;
    direction: rtl !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Table Header - Dark gray with gold text */
thead,
.chart-container table thead,
.message-text table thead,
.warren-table-wrapper table thead {
    background: var(--dark-tertiary) !important;
}

th,
.chart-container table th,
.message-text table th,
.warren-table-wrapper table th {
    font-family: var(--font-display) !important;
    padding: 0.85rem 1rem !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    color: var(--primary-gold) !important;
    border: none !important;
    text-align: center !important;
    background: var(--dark-tertiary) !important;
    letter-spacing: 0.3px !important;
}

/* Last column header (right side in RTL) - Company name */
th:last-child,
.chart-container table th:last-child,
.message-text table th:last-child,
.warren-table-wrapper table th:last-child {
    text-align: right !important;
    padding-right: 1.25rem !important;
}

/* Table Body Rows */
tbody tr,
.chart-container table tbody tr,
.message-text table tbody tr,
.warren-table-wrapper table tbody tr {
    background: var(--bg-white) !important;
    transition: background 0.15s ease !important;
}

/* Odd rows - white background */
tbody tr:nth-child(odd),
.chart-container table tbody tr:nth-child(odd),
.message-text table tbody tr:nth-child(odd),
.warren-table-wrapper table tbody tr:nth-child(odd) {
    background: var(--bg-white) !important;
}

/* Even rows - cream background */
tbody tr:nth-child(even),
.chart-container table tbody tr:nth-child(even),
.message-text table tbody tr:nth-child(even),
.warren-table-wrapper table tbody tr:nth-child(even) {
    background: var(--bg-cream-light) !important;
}

/* Hover effect */
tbody tr:hover,
.chart-container table tbody tr:hover,
.message-text table tbody tr:hover,
.warren-table-wrapper table tbody tr:hover {
    background: rgba(212, 175, 55, 0.08) !important;
}

/* Table Cells */
td,
.chart-container table td,
.message-text table td,
.warren-table-wrapper table td {
    font-family: var(--font-primary) !important;
    padding: 0.85rem 1rem !important;
    font-size: 0.9rem !important;
    color: var(--text-primary) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-cream) !important;
    text-align: center !important;
    background: transparent !important;
}

/* Last column (Company name in RTL) - align right */
td:last-child,
.chart-container table td:last-child,
.message-text table td:last-child,
.warren-table-wrapper table td:last-child {
    text-align: right !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    padding-right: 1.25rem !important;
}

/* Last row - no bottom border */
tbody tr:last-child td,
.chart-container table tbody tr:last-child td,
.message-text table tbody tr:last-child td,
.warren-table-wrapper table tbody tr:last-child td {
    border-bottom: none !important;
}

/* Bold text in cells */
td strong,
.chart-container table td strong,
.message-text table td strong,
.warren-table-wrapper table td strong {
    color: var(--text-primary) !important;
    font-weight: 700 !important;
}

/* Positive/Gain values in tables */
.gain, .positive, td.gain, td.positive,
[style*="color: green"], [style*="color:#10B981"], [style*="color: #10B981"] {
    color: var(--gain-green) !important;
}

/* Negative/Loss values in tables */
.loss, .negative, td.loss, td.negative,
[style*="color: red"], [style*="color:#EF4444"], [style*="color: #EF4444"] {
    color: var(--loss-red) !important;
}

/* Hide Highcharts credits/watermark */
.highcharts-credits {
    display: none !important;
}

/* Highcharts Customizations */
.highcharts-background {
    fill: #f9fafb !important;
}

.highcharts-title {
    fill: #1f2937 !important;
    font-weight: bold !important;
}

.highcharts-axis-labels text {
    fill: #4b5563 !important;
}

.highcharts-legend-item text {
    fill: #374151 !important;
}

.highcharts-tooltip-box {
    fill: white !important;
    stroke: #d1d5db !important;
    stroke-width: 1 !important;
}

/* Export Menu */
.highcharts-menu {
    background: white !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

.highcharts-menu-item {
    padding: 8px 16px !important;
    font-size: 13px !important;
    color: #374151 !important;
    transition: background 0.2s !important;
}

.highcharts-menu-item:hover {
    background: #f3f4f6 !important;
}

/* Quick Actions Section */
.quick-actions-section {
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    min-height: 90px;
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db;
}

.quick-action-btn.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #2563eb;
}

.quick-action-btn.primary .btn-text {
    color: white;
}

.quick-action-btn.primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.btn-icon {
    font-size: 1.8rem;
}

.btn-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-content.modal-wide {
    max-width: 800px;
}

/* Selected Funds/Companies Chips */
.selected-funds-container {
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(212, 175, 55, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.selected-funds-container h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 40px;
}

.selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--gradient-gold);
    color: var(--dark-primary);
    border-radius: 20px;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 500;
    animation: chipIn 0.2s ease;
}

@keyframes chipIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.selected-chip .remove-chip {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: #1a1a1a;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.2s ease;
}

.selected-chip .remove-chip:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* Modal Actions */
.modal-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.compare-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--gradient-gold);
    color: var(--dark-primary);
    border: none;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-gold);
}

.compare-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

.compare-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Fund Item in List */
.fund-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.fund-item:hover {
    border-color: var(--primary-color);
    background: rgba(212, 175, 55, 0.05);
}

.fund-item.selected {
    border-color: var(--primary-color);
    background: rgba(212, 175, 55, 0.1);
}

.fund-item-info {
    flex: 1;
}

.fund-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.fund-item-manager {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.fund-item-stats {
    text-align: left;
    display: flex;
    gap: 1rem;
}

.fund-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fund-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.fund-stat-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.fund-stat-value.positive {
    color: #22c55e;
}

.fund-stat-value.negative {
    color: #ef4444;
    position: relative;
}

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

.modal-close {
    position: absolute;
    left: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: #374151;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.modal-description {
    color: #6b7280;
    text-align: center;
    margin: 0 0 1.5rem 0;
}

.company-search-box {
    position: relative;
    margin-bottom: 1rem;
}

.modal-search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: all 0.3s;
}

.modal-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.company-search-box .search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: #9ca3af;
}

.modal-company-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    padding: 0.5rem;
}

.modal-company-item {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    margin: 0.25rem;
    border-radius: 8px;
}

.modal-company-item:last-child {
    border-bottom: none;
}

.modal-company-item:hover {
    background: #eff6ff;
    transform: translateX(-4px);
}

.modal-company-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.modal-company-symbol {
    color: #6b7280;
    font-size: 0.85rem;
    background: #f3f4f6;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
}

/* Comparison Modal Specific Styles */
.comparison-boxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.comparison-box {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    background: #f9fafb;
}

.comparison-box-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.75rem 0;
    text-align: center;
}

.comparison-list {
    max-height: 300px;
}

.comparison-box.selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

.compare-button {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
}

.compare-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.compare-button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    opacity: 0.6;
}

.modal-company-item.selected {
    background: #eff6ff;
    border-color: #3b82f6;
}

/* Responsive */
@media (max-width: 1024px) {
    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
    }
    
    .comparison-boxes {
        grid-template-columns: 1fr;
    }
    
    .comparison-list {
        max-height: 200px;
    }
}

/* Chart Title - Hidden for tables */
.chart-container::before {
    display: none;
}

/* Responsive Charts */
@media (max-width: 768px) {
    .chart-container {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .chart-container table {
        font-size: 12px;
    }
    
    .chart-container table th,
    .chart-container table td {
        padding: 8px;
    }
}

/* Type Selection Buttons for Modals */
.financials-type-buttons,
.holders-type-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f3f4f6;
    border-radius: 12px;
}

.financials-type-btn,
.holders-type-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.financials-type-btn:hover,
.holders-type-btn:hover {
    background: #f0f9ff;
    border-color: #93c5fd;
    color: #3b82f6;
}

.financials-type-btn.active,
.holders-type-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
    color: white;
}

/* Fund Type Buttons for Mutual Funds Modal */
.fund-type-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.fund-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    background: linear-gradient(145deg, #1a1a1a 0%, #2a2a2a 100%);
    border: 2px solid #D4AF37;
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #D4AF37;
}

.fund-type-btn:hover {
    background: linear-gradient(145deg, #D4AF37 0%, #B8941F 100%);
    color: #1a1a1a;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
}

.fund-type-btn .btn-icon {
    font-size: 1.8rem;
}

.fund-info-note {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(212, 175, 55, 0.05) 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    margin-top: 1rem;
    color: #8B7355;
    font-size: 0.9rem;
}

.fund-info-note .info-icon {
    font-size: 1.2rem;
}

/* ===== Conversation History Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    border-left: 3px solid var(--primary-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease-in-out;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
}

.sidebar.open {
    right: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border-bottom: 2px solid var(--primary-color);
}

.sidebar-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.sidebar-close-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}

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

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 1rem;
    padding: 0.875rem 1rem;
    background: var(--gradient-gold);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

.new-chat-icon {
    font-size: 1.2rem;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.conversations-list::-webkit-scrollbar {
    width: 6px;
}

.conversations-list::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 3px;
}

.conversations-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.conversation-item {
    position: relative;
    padding: 1rem;
    margin: 0.5rem;
    background: #2a2a2a;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.conversation-item:hover {
    background: #3a3a3a;
    border-color: var(--primary-color);
    transform: translateX(-4px);
}

.conversation-item.active {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--primary-color);
}

.conversation-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.conversation-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.conversation-date {
    font-size: 0.75rem;
    color: #9ca3af;
}

.conversation-count {
    font-size: 0.7rem;
    color: var(--primary-color);
    background: rgba(212, 175, 55, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
}

.conversation-delete-btn {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    opacity: 0;
    transition: all 0.2s;
}

.conversation-item:hover .conversation-delete-btn {
    opacity: 1;
}

.conversation-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.loading-conversations {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #9ca3af;
    gap: 1rem;
}

.loading-spinner-small {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(212, 175, 55, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.empty-conversations {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
}

.empty-conversations-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-conversations-text {
    font-size: 0.9rem;
    line-height: 1.6;
}

.conversations-group {
    margin-bottom: 1rem;
}

.conversations-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    padding: 0.5rem 1rem;
    letter-spacing: 0.5px;
}

/* Header Sidebar Toggle Button */
.sidebar-toggle-btn {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--primary-color);
    padding: 0.625rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.new-chat-header-btn {
    background: var(--gradient-gold);
    border: none;
    color: #1a1a1a;
    padding: 0.625rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.new-chat-header-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.5);
}

/* Smart Suggested Questions */
.smart-suggestions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.smart-suggestions-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.smart-suggestions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.smart-suggestion-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.smart-suggestion-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.smart-suggestion-btn .suggestion-icon {
    font-size: 1rem;
}

/* Responsive Sidebar */
@media (max-width: 768px) {
    .sidebar {
        width: 85%;
        max-width: 320px;
    }
    
    .sidebar-toggle-btn,
    .new-chat-header-btn {
        padding: 0.5rem;
    }
    
    .conversation-item {
        padding: 0.875rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        max-width: none;
        right: -100%;
    }
    
    .sidebar.open {
        right: 0;
    }
}

/* ========== MOBILE OPTIMIZATION - COMPREHENSIVE ========== */

/* Table Responsive Wrapper - Horizontal Scroll */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.5rem 0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Scroll indicator for tables */
.table-scroll-hint {
    display: none;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: linear-gradient(to right, rgba(212,175,55,0.1), transparent, rgba(212,175,55,0.1));
}

/* Mobile Table Improvements */
@media (max-width: 768px) {
    /* Add scroll hint on mobile */
    .table-scroll-hint {
        display: block;
    }
    
    /* Table wrapper with scroll */
    .warren-table-wrapper,
    .chart-container,
    .message-text {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure table has minimum width for readability */
    table,
    .warren-table-wrapper table,
    .chart-container table,
    .message-text table {
        min-width: 500px !important;
        font-size: 0.8rem !important;
    }
    
    /* Smaller padding for mobile tables */
    th, td,
    .warren-table-wrapper th,
    .warren-table-wrapper td,
    .chart-container table th,
    .chart-container table td,
    .message-text table th,
    .message-text table td {
        padding: 0.5rem 0.6rem !important;
        font-size: 0.78rem !important;
        white-space: nowrap !important;
    }
    
    /* First column sticky on mobile (RTL - first column is on the RIGHT) */
    table th:first-child,
    table td:first-child {
        position: sticky !important;
        right: 0 !important;
        background: #fff !important;
        z-index: 1 !important;
        box-shadow: -3px 0 5px rgba(0,0,0,0.1) !important;
    }
    
    table tbody tr:nth-child(even) td:first-child {
        background: #fdfcfa !important;
    }
    
    table tbody tr:first-child td:first-child {
        background: #fffdf5 !important;
    }
    
    table thead th:first-child {
        background: #3a3a3a !important;
        z-index: 2 !important;
    }
    
    /* CRITICAL: Ensure table containers allow horizontal scroll */
    .message-content {
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
    
    /* CRITICAL: Force RTL on mobile for message text */
    .message-text {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        direction: rtl !important;
        text-align: right !important;
        unicode-bidi: plaintext !important;
    }
    
    /* Force RTL alignment for headings on mobile */
    .message-text h1,
    .message-text h2,
    .message-text h3,
    .message-text h4,
    .message-text h5,
    .message-text h6 {
        direction: rtl !important;
        text-align: right !important;
        unicode-bidi: plaintext !important;
    }
    
    /* Force RTL for paragraphs and lists */
    .message-text p,
    .message-text ul,
    .message-text ol,
    .message-text li {
        direction: rtl !important;
        text-align: right !important;
    }
    
    /* Direct table styling to ensure scroll works */
    .message-text > table,
    .message-text > .warren-table-wrapper {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Very small screens - extra compact */
@media (max-width: 480px) {
    /* Even smaller table text */
    table,
    .warren-table-wrapper table,
    .chart-container table,
    .message-text table {
        min-width: 450px !important;
        font-size: 0.75rem !important;
    }
    
    th, td {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.72rem !important;
    }
    
    /* Header compact mode */
    .header {
        padding: 0.75rem 1rem !important;
    }
    
    .header h1 {
        font-size: 1.1rem !important;
    }
    
    .logo-image {
        width: 36px !important;
        height: 36px !important;
    }
    
    /* Quick actions - single column on very small screens */
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    .action-button {
        padding: 0.6rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    .action-button svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* Input area compact */
    .input-container {
        padding: 0.75rem !important;
    }
    
    .chat-input {
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 0.75rem 1rem !important;
    }
    
    /* Message text smaller */
    .message-text {
        font-size: 0.9rem !important;
        line-height: 1.6 !important;
    }
    
    /* Splash screen mobile */
    .splash-logo-img {
        width: 120px !important;
        height: 120px !important;
    }
    
    .splash-title {
        font-size: 2.5rem !important;
    }
    
    .splash-subtitle {
        font-size: 1rem !important;
    }
}

/* Prevent auto-zoom on iOS for inputs */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea,
    select,
    .chat-input,
    .modal-search-input {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
    }
}

/* Better touch targets for mobile */
@media (max-width: 768px) {
    button,
    .action-button,
    .send-button,
    .related-button {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    .related-button {
        padding: 0.6rem 0.8rem !important;
        font-size: 0.8rem !important;
    }
    
    /* Inline panel improvements for mobile */
    .inline-selection-panel {
        padding: 0.75rem !important;
    }
    
    .inline-selection-panel .modal-search-input {
        padding: 0.75rem !important;
    }
    
    .inline-company-item,
    .inline-fund-item {
        padding: 0.75rem !important;
        font-size: 0.85rem !important;
    }
}

/* Smooth scrolling for all containers */
.chat-container,
.message-content,
.warren-table-wrapper,
.chart-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Fix for horizontal scroll visibility */
.warren-table-wrapper::-webkit-scrollbar,
.chart-container::-webkit-scrollbar,
.message-text::-webkit-scrollbar {
    height: 6px;
}

.warren-table-wrapper::-webkit-scrollbar-track,
.chart-container::-webkit-scrollbar-track,
.message-text::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.warren-table-wrapper::-webkit-scrollbar-thumb,
.chart-container::-webkit-scrollbar-thumb,
.message-text::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

/* Mobile landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-container {
        max-height: calc(100vh - 100px) !important;
    }
    
    .header {
        padding: 0.5rem 1rem !important;
    }
    
    .input-container {
        padding: 0.5rem !important;
    }
}

/* RTL improvements for mobile */
@media (max-width: 768px) {
    .message-user {
        margin-left: 0 !important;
        margin-right: auto !important;
    }
    
    .message-ai {
        margin-right: 0 !important;
        margin-left: auto !important;
    }
    
    /* Better RTL table alignment */
    .warren-table-wrapper,
    .chart-container {
        direction: rtl !important;
    }
    
    /* Scroll from right in RTL */
    .warren-table-wrapper,
    .chart-container,
    .message-text {
        direction: ltr;
    }
    
    .warren-table-wrapper table,
    .chart-container table,
    .message-text table {
        direction: rtl !important;
    }
}

/* ===== Stock Screener Styles ===== */
.screener-pill {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(212, 175, 55, 0.1) 100%) !important;
    border-color: var(--primary-color) !important;
}

.screener-pill:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.3) 0%, rgba(212, 175, 55, 0.2) 100%) !important;
}

.screener-panel {
    max-width: 100%;
}

/* Preset Buttons */
.screener-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-cream-dark);
    border: 1px solid var(--border-cream);
    border-radius: 12px;
}

.screener-presets-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.screener-preset-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg-white);
    border: 1px solid var(--border-cream);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.screener-preset-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.screener-preset-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #e5c158 100%);
    border-color: var(--primary-color);
    color: #1a1a1a;
    font-weight: 600;
    box-shadow: var(--shadow-gold);
}

.preset-icon {
    font-size: 0.9rem;
}

.preset-name {
    font-size: 0.8rem;
}

/* Filter Toggle Button */
.screener-filters-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border-cream);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.75rem;
}

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

.toggle-icon {
    font-size: 1rem;
}

.toggle-arrow {
    font-size: 0.7rem;
    margin-right: auto;
    transition: transform 0.3s ease;
}

/* Filters Grid */
.screener-filters {
    background: var(--bg-cream);
    border: 1px solid var(--border-cream);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease;
}

.screener-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
}

.filter-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.filter-input {
    width: 100%;
    min-width: 0;
    padding: 0.625rem 0.75rem;
    background: var(--bg-white);
    border: 1px solid var(--border-cream);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    text-align: center;
    transition: all 0.2s ease;
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.filter-input::placeholder {
    color: var(--text-tertiary);
}

.filter-separator {
    color: var(--text-secondary);
    font-weight: bold;
}

.filter-select {
    padding: 0.625rem 0.75rem;
    background: var(--bg-white);
    border: 1px solid var(--border-cream);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-select option {
    background: var(--bg-white);
    color: var(--text-primary);
}

/* Filter Actions */
.screener-filter-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-cream);
}

.screener-clear-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border-cream);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.screener-clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.screener-run-btn {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #e5c158 100%);
    border: none;
    border-radius: 10px;
    color: #1a1a1a;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.screener-run-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

/* Results Section */
.screener-results {
    min-height: 150px;
    background: var(--bg-white);
    border: 1px solid var(--border-cream);
    border-radius: 12px;
    overflow: hidden;
}

.screener-results-placeholder,
.screener-no-results,
.screener-loading,
.screener-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.placeholder-icon,
.no-results-icon,
.error-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.screener-results-placeholder p,
.screener-no-results p {
    font-size: 0.95rem;
    margin: 0;
}

.no-results-hint {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem !important;
}

.screener-loading {
    flex-direction: row;
    gap: 0.75rem;
}

.screener-retry-btn {
    margin-top: 1rem;
    padding: 0.5rem 1.25rem;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.screener-retry-btn:hover {
    background: rgba(212, 175, 55, 0.2);
}

/* Results Header */
.screener-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(212, 175, 55, 0.1);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.results-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Screener Table */
.screener-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.screener-results-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.screener-results-table thead {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    position: sticky;
    top: 0;
    z-index: 1;
}

.screener-results-table th {
    padding: 0.75rem 0.625rem;
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 2px solid rgba(212, 175, 55, 0.3);
    white-space: nowrap;
}

.screener-results-table td {
    padding: 0.625rem;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
}

.screener-result-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.screener-result-row:hover {
    background: rgba(212, 175, 55, 0.08);
}

.stock-symbol {
    font-weight: 600;
    color: var(--primary-color);
    font-family: monospace;
}

.stock-name {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-price {
    font-weight: 600;
    color: #fff;
}

.stock-change {
    font-weight: 600;
}

.stock-change.positive {
    color: #22c55e;
}

.stock-change.negative {
    color: #ef4444;
}

.stock-rsi.overbought {
    color: #ef4444;
    font-weight: 600;
}

.stock-rsi.oversold {
    color: #22c55e;
    font-weight: 600;
}

.stock-action {
    text-align: center;
}

.screener-analyze-btn {
    padding: 0.375rem 0.625rem;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.screener-analyze-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    transform: scale(1.1);
}

/* Mobile Responsive Screener */
@media (max-width: 768px) {
    .screener-presets {
        padding: 0.5rem;
        gap: 0.375rem;
    }
    
    .screener-preset-btn {
        padding: 0.4rem 0.65rem;
        font-size: 0.75rem;
    }
    
    .preset-icon {
        font-size: 0.8rem;
    }
    
    .screener-filters-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-range {
        gap: 0.375rem;
    }
    
    .filter-input {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .screener-filter-actions {
        flex-direction: column;
    }
    
    .screener-clear-btn,
    .screener-run-btn {
        flex: none;
        width: 100%;
    }
    
    .screener-results-table {
        min-width: 600px;
        font-size: 0.78rem;
    }
    
    .screener-results-table th,
    .screener-results-table td {
        padding: 0.5rem 0.375rem;
    }
    
    .stock-name {
        max-width: 100px;
    }
}

@media (max-width: 480px) {
    .screener-preset-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .screener-results-table {
        min-width: 550px;
        font-size: 0.72rem;
    }
}

/* ===== Fund Screener Results List ===== */
.screener-results-list {
    max-height: 400px;
    overflow-y: auto;
}

.screener-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-cream);
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 1rem;
}

.screener-result-item:hover {
    background: rgba(212, 175, 55, 0.08);
}

.screener-result-item:last-child {
    border-bottom: none;
}

.result-main {
    flex: 1;
    min-width: 0;
}

.result-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-manager {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-metrics {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.result-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.metric-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
    text-transform: uppercase;
}

.metric-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-value.positive {
    color: #22c55e;
}

.metric-value.negative {
    color: #ef4444;
}

.result-action {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.screener-result-item:hover .result-action {
    background: rgba(212, 175, 55, 0.2);
    transform: scale(1.1);
}

.analyze-icon {
    font-size: 1rem;
}

/* Mobile Responsive Fund Results */
@media (max-width: 768px) {
    .screener-result-item {
        flex-wrap: wrap;
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .result-main {
        flex: 1 1 60%;
    }
    
    .result-metrics {
        flex: 1 1 100%;
        order: 3;
        justify-content: space-around;
        padding-top: 0.5rem;
        border-top: 1px dashed var(--border-cream);
    }
    
    .result-action {
        order: 2;
    }
    
    .result-metric {
        min-width: auto;
    }
}

/* ===== Share Button & Menu ===== */
.share-btn {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.share-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    color: #D4AF37;
}

.share-btn svg {
    width: 16px;
    height: 16px;
}

/* Share Menu Overlay */
.share-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.share-menu {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 24px;
    min-width: 300px;
    max-width: 90%;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

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

.share-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.share-menu-header h3 {
    color: #D4AF37;
    font-size: 1.2rem;
    margin: 0;
}

.share-menu-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.share-menu-close:hover {
    color: #fff;
}

.share-menu-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.share-option:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.3);
    transform: translateY(-2px);
}

.share-option svg {
    width: 28px;
    height: 28px;
}

.share-menu-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 30px;
    color: #888;
}

.share-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top-color: #D4AF37;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Mobile adjustments */
@media (max-width: 480px) {
    .share-menu {
        min-width: auto;
        width: 90%;
        padding: 20px;
    }
    
    .share-menu-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .share-option {
        padding: 14px 10px;
        font-size: 0.85rem;
    }
    
    .share-option svg {
        width: 24px;
        height: 24px;
    }
}

/* ===== Comparison Summary Box Styles ===== */
.comparison-summary-box {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    border: 1px solid var(--primary-gold, #D4AF37);
    direction: rtl;
}

.summary-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.summary-title {
    color: var(--primary-gold, #D4AF37);
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
}

.summary-companies {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.company-badge {
    background: rgba(212, 175, 55, 0.15);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.company-badge.company-1 {
    border: 1px solid var(--primary-gold, #D4AF37);
}

.company-badge.company-2 {
    border: 1px solid #3B82F6;
}

.vs-badge {
    color: #9ca3af;
    font-size: 0.85rem;
    font-weight: 600;
}

.summary-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
}

.summary-bullet {
    display: flex;
    align-items: flex-start;
    padding: 10px 12px;
    margin: 6px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: #e5e7eb;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: background 0.2s ease;
}

.summary-bullet:hover {
    background: rgba(212, 175, 55, 0.1);
}

.summary-bullet::before {
    content: "•";
    color: var(--primary-gold, #D4AF37);
    font-weight: bold;
    font-size: 1.2rem;
    margin-left: 10px;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .comparison-summary-box {
        padding: 16px;
    }
    
    .summary-title {
        font-size: 1.1rem;
    }
    
    .summary-companies {
        flex-direction: column;
        gap: 8px;
    }
    
    .company-badge {
        font-size: 0.85rem;
        padding: 5px 12px;
    }
    
    .summary-bullet {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
}

/* ===== Unified Comparison Table Styles ===== */
.unified-comparison-table-wrapper {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 16px 0;
    direction: rtl;
}

.unified-table-title {
    background: var(--dark-tertiary, #3a3a3a);
    color: var(--primary-gold, #D4AF37);
    padding: 14px 20px;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
}

.unified-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    font-feature-settings: "tnum" on, "lnum" on;
    font-variant-numeric: tabular-nums lining-nums;
}

.unified-comparison-table thead {
    background: var(--dark-tertiary, #3a3a3a);
}

.unified-comparison-table th {
    padding: 12px 16px;
    text-align: center;
    font-weight: bold;
    color: var(--primary-gold, #D4AF37);
    border-bottom: 2px solid var(--primary-gold, #D4AF37);
    white-space: nowrap;
}

.unified-comparison-table th:first-child {
    text-align: right;
    width: 40%;
}

.unified-comparison-table tbody tr.section-header td {
    background: linear-gradient(135deg, #f0e6d2 0%, #e8dcc8 100%);
    color: var(--dark-primary, #1a1a1a);
    font-weight: bold;
    font-size: 0.95rem;
    padding: 10px 16px;
    text-align: right;
    border-bottom: 1px solid #d4c4a8;
}

.unified-comparison-table tbody tr.even {
    background: #fdfcfa;
}

.unified-comparison-table tbody tr.odd {
    background: #f5f2eb;
}

.unified-comparison-table tbody tr:hover:not(.section-header) {
    background: rgba(212, 175, 55, 0.1);
}

.unified-comparison-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #e8e5e0;
}

.unified-comparison-table td.metric-name {
    text-align: right;
    color: var(--text-primary, #1F2937);
    font-weight: 500;
}

.unified-comparison-table td.metric-value {
    text-align: center;
    color: var(--text-primary, #1F2937);
    font-weight: 600;
    font-family: 'Roboto Mono', 'SF Mono', 'Consolas', monospace;
}

/* Mobile responsive for unified table */
@media (max-width: 600px) {
    .unified-comparison-table {
        font-size: 0.85rem;
    }
    
    .unified-comparison-table th,
    .unified-comparison-table td {
        padding: 8px 10px;
    }
    
    .unified-table-title {
        font-size: 1rem;
        padding: 12px 16px;
    }
    
    .unified-comparison-table tbody tr.section-header td {
        font-size: 0.9rem;
        padding: 8px 10px;
    }
}

/* ========================================
   PORTFOLIO ANALYSIS STYLES
   ======================================== */

.portfolio-table-wrapper {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.portfolio-table-wrapper .table-title {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    color: var(--primary-gold, #D4AF37);
    padding: 14px 20px;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: right;
    border-bottom: 2px solid var(--primary-gold, #D4AF37);
}

.portfolio-holdings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.portfolio-holdings-table thead {
    background: var(--dark-tertiary, #3a3a3a);
}

.portfolio-holdings-table th {
    padding: 12px 14px;
    text-align: center;
    font-weight: bold;
    color: var(--primary-gold, #D4AF37);
    border-bottom: 2px solid var(--primary-gold, #D4AF37);
    white-space: nowrap;
}

.portfolio-holdings-table th:first-child {
    text-align: right;
}

.portfolio-holdings-table tbody tr:nth-child(odd) {
    background: #f9f8f5;
}

.portfolio-holdings-table tbody tr:nth-child(even) {
    background: #ffffff;
}

.portfolio-holdings-table tbody tr:hover {
    background: rgba(212, 175, 55, 0.1);
}

.portfolio-holdings-table td {
    padding: 12px 14px;
    text-align: center;
    border-bottom: 1px solid #e8e5e0;
    font-family: 'Roboto Mono', 'SF Mono', monospace;
}

.portfolio-holdings-table td:first-child {
    text-align: right;
    font-family: 'IBM Plex Sans Arabic', sans-serif;
}

.portfolio-holdings-table td .symbol-code {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary, #6b7280);
    margin-top: 2px;
}

.portfolio-holdings-table td.gain {
    color: var(--gain-green, #10B981);
    font-weight: 600;
}

.portfolio-holdings-table td.loss {
    color: var(--loss-red, #EF4444);
    font-weight: 600;
}

.portfolio-summary {
    background: linear-gradient(135deg, #f5f2eb 0%, #ece7db 100%);
    padding: 16px 20px;
    border-top: 1px solid #d4c4a8;
}

.portfolio-summary .summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #d4c4a8;
}

.portfolio-summary .summary-row:last-child {
    border-bottom: none;
}

.portfolio-summary .summary-row span {
    color: var(--text-secondary, #6b7280);
    font-size: 0.95rem;
}

.portfolio-summary .summary-row strong {
    font-size: 1rem;
    color: var(--text-primary, #1F2937);
    font-family: 'Roboto Mono', 'SF Mono', monospace;
}

.portfolio-summary .summary-row.total {
    background: rgba(212, 175, 55, 0.1);
    margin: 8px -20px;
    padding: 12px 20px;
    border-radius: 8px;
}

.portfolio-summary .summary-row.total strong {
    color: var(--primary-gold, #D4AF37);
    font-size: 1.1rem;
}

.portfolio-summary .summary-row.gain strong {
    color: var(--gain-green, #10B981);
}

.portfolio-summary .summary-row.loss strong {
    color: var(--loss-red, #EF4444);
}

/* Portfolio Chart Containers */
.portfolio-chart-container {
    margin: 16px 0;
    border-radius: 12px;
    background: var(--cream-bg, #FAF8F3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.portfolio-chart-container .chart-title {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    color: var(--primary-gold, #D4AF37);
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: bold;
    text-align: right;
}

/* Mobile responsive for portfolio */
@media (max-width: 768px) {
    .portfolio-holdings-table {
        font-size: 0.8rem;
    }
    
    .portfolio-holdings-table th,
    .portfolio-holdings-table td {
        padding: 8px 6px;
    }
    
    .portfolio-holdings-table th:nth-child(3),
    .portfolio-holdings-table td:nth-child(3),
    .portfolio-holdings-table th:nth-child(4),
    .portfolio-holdings-table td:nth-child(4) {
        display: none;
    }
    
    .portfolio-summary .summary-row {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
}

