/* Global Scope */
.bs-ai-wrapper {
    --bs-font: 'iransansx', 'Tahoma', sans-serif;
    --bs-primary: #DC2626;
    --bs-bg: #F8FAFC;
    --bs-border: #E2E8F0;
    --bs-text: #1E293B;
    --bs-muted: #64748B;
    
    font-family: var(--bs-font);
    direction: rtl;
    box-sizing: border-box;
    text-align: right;
    line-height: 1.6;
}

.bs-ai-wrapper * { box-sizing: border-box; }

/* 1. Widget/Result Card */
.bs-widget-container {
    overflow: hidden;
    margin: 20px 0;
    width: 100%;
}

.bs-card {
    background: #fff;
    border: 1px solid var(--bs-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* 2. Header & Badges */
.bs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 15px;
    margin-bottom: 20px;
}
.bs-asset-title { font-size: 22px; font-weight: 800; color: #111827; }
.bs-badge { 
    background: #fee2e2; color: #b91c1c; 
    padding: 4px 10px; border-radius: 6px; 
    font-size: 12px; font-weight: 600; 
}

/* 3. Stats Grid */
.bs-grid-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.bs-stat-box { background: #f8fafc; padding: 12px; border-radius: 10px; text-align: center; }
.bs-stat-label { font-size: 12px; color: var(--bs-muted); margin-bottom: 4px; }
.bs-stat-value { font-size: 16px; font-weight: 700; color: #334155; }

/* 4. Gauges */
.bs-gauges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}
.bs-meter-bar {
    height: 10px; background: #e2e8f0; 
    border-radius: 5px; overflow: hidden; margin-top: 8px;
}
.bs-meter-fill { height: 100%; background: #22C55E; transition: width 1s ease; }
.bs-sentiment-text { font-size: 12px; margin-top: 4px; color: var(--bs-muted); }

/* 5. Content Styling (Fixing the issue) */
.bs-analysis-content { margin-bottom: 24px; }
.bs-headline {
    font-size: 18px; font-weight: 700; 
    color: #1e293b; margin-bottom: 12px;
}

/* Specific styling for AI Generated HTML content */
.bs-analysis-body {
    font-size: 15px;
    color: #334155;
    text-align: justify;
}
.bs-analysis-body p { margin-bottom: 12px !important; line-height: 1.8 !important; }
.bs-analysis-body strong { color: #0f172a; font-weight: 700; }
.bs-analysis-body ul { list-style: disc inside; margin: 10px 0; }

/* 6. Pros & Cons */
.bs-pros-cons {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
    border-top: 1px solid #f1f5f9; padding-top: 20px;
}
.bs-pros-cons h4 { font-size: 16px; font-weight: 700; margin-bottom: 12px; margin-top: 0; }
.bs-list-item { 
    display: flex; gap: 8px; align-items: flex-start; 
    font-size: 14px; margin-bottom: 8px; color: #475569;
}

/* 7. Search Input & Dropdown */
.bs-search-box { position: relative; max-width: 600px; margin: 0 auto; z-index: 50; }
.bs-input {
    width: 100%; padding: 12px 16px;
    border: 2px solid #cbd5e1; border-radius: 12px;
    font-size: 16px; outline: none; transition: all 0.2s;
}
.bs-input:focus { border-color: var(--bs-primary); background: #fff; }

.bs-results-dropdown {
    display: none; position: absolute; top: 110%; left: 0; right: 0;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    max-height: 300px; overflow-y: auto;
}
.bs-search-item {
    padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
    cursor: pointer; display: flex; justify-content: space-between;
}
.bs-search-item:hover { background: #f8fafc; }
.bs-item-symbol { font-weight: 700; color: #0f172a; }
.bs-item-name { font-size: 13px; color: #64748B; }

/* 8. Loading & Error */
.bs-loading {
    display: flex; flex-direction: column; 
    align-items: center; justify-content: center; 
    padding: 40px; gap: 15px; color: var(--bs-muted);
}
.bs-error-msg { 
    color: #b91c1c; background: #fef2f2; 
    padding: 15px; border-radius: 8px; 
    text-align: center; margin: 20px; 
}

@media (max-width: 768px) {
    .bs-grid-stats { grid-template-columns: repeat(2, 1fr); }
    .bs-pros-cons { grid-template-columns: 1fr; }
    .bs-gauges { grid-template-columns: 1fr; }
}