/* Deal Card Styles — shared between dashboard and deal-single page */

/* Status badges */
.status-badge {
    display: inline-block;
    position: relative;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    margin-top: 4px;
    cursor: default;
    white-space: nowrap;
}
.status-badge-sell { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.status-badge-near-target { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.status-badge-hold { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.status-badge-buy { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.status-badge-wait { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.status-badge-caution { background: #fefce8; color: #b45309; border: 1px solid #fde68a; }

/* TV Rating badges */
.tv-rating-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-radius: 6px;
    padding: 2px 7px;
    white-space: nowrap;
}
.tv-strong-buy { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.tv-buy { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.tv-neutral { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.tv-sell { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.tv-strong-sell { background: #fde8e8; color: #991b1b; border: 1px solid #f87171; }

/* Symbol type tags */
.symbol-type-tag {
    display: block;
    font-size: 0.7rem;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 1px 5px;
    margin-top: 3px;
    word-break: break-word;
    max-width: 185px;
}
.symbol-type-tag.tag-merger { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.symbol-type-tag.tag-find { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.symbol-type-tag.tag-finviz { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }

/* Deal card */
.deal-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    padding: 16px 0 24px;
}
.deal-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    border-right: 1px solid #cbd5e1;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, transform 0.15s;
}
.deal-card.card-positive { border-color: #86efac; border-right-color: #10b981; }
.deal-card.card-negative { border-color: #fecaca; border-right-color: #ef4444; }
.deal-card.card-neutral  { border-color: #cbd5e1; border-right-color: #94a3b8; }
.deal-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.10); transform: translateY(-1px); }

.deal-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}
.deal-card-ticker { font-size: 1.25rem; font-weight: 800; color: #0f172a; letter-spacing: 0.3px; }
.deal-card-name { font-size: 0.72rem; color: #64748b; margin-top: 2px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-card-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: contain; background: #f8fafc; border: 1px solid #e2e8f0; flex-shrink: 0; }
.deal-card-logo-fallback { width: 42px; height: 42px; border-radius: 10px; background: linear-gradient(135deg,#e0e7ff,#c7d2fe); display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 800; color: #4f46e5; flex-shrink: 0; }
.deal-card-badge-row { margin-bottom: 10px; height: 26px; }
.deal-card-price { font-size: 1.75rem; font-weight: 800; color: #0f172a; direction: ltr; text-align: right; margin-bottom: 3px; letter-spacing: -0.5px; }

.deal-card-metrics-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; direction: ltr; }
.deal-card-metrics-row > div { flex: 1; }

.deal-card-change { font-size: 1.15rem; font-weight: 700; direction: ltr; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.deal-card-change.up { color: #059669; }
.deal-card-change.down { color: #dc2626; }
.deal-card-change.flat { color: #94a3b8; }
.deal-card-change .dcm-label { font-size: 0.85rem; font-weight: 700; color: #64748b; margin-bottom: 4px; direction: rtl; text-align: right; width: 100%; }

.deal-card-profit { font-size: 1.15rem; font-weight: 700; direction: ltr; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.deal-card-profit.up { color: #059669; }
.deal-card-profit.down { color: #dc2626; }
.deal-card-profit .dcp-label { font-size: 0.85rem; font-weight: 700; color: #64748b; margin-bottom: 4px; direction: rtl; text-align: right; width: 100%; }

.deal-card-rvol { font-size: 1.15rem; font-weight: 700; direction: ltr; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.deal-card-rvol .dcrvol-label { font-size: 0.85rem; font-weight: 700; color: #64748b; margin-bottom: 4px; direction: rtl; text-align: right; width: 100%; }

.deal-card-rsi { font-size: 1.15rem; font-weight: 700; direction: ltr; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.deal-card-rsi .dcrsi-label { font-size: 0.85rem; font-weight: 700; color: #64748b; margin-bottom: 4px; direction: rtl; text-align: right; width: 100%; }

.deal-card-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #f1f5f9; padding-top: 10px; }

.deal-card-sma-row { display: flex; flex-direction: column; align-items: flex-end; margin-top: 8px; border-top: 1px solid #f1f5f9; padding-top: 8px; width: 100%; }
.deal-card-sma-row .sma-label { font-size: 0.85rem; font-weight: 700; color: #64748b; margin-bottom: 4px; direction: rtl; text-align: right; width: 100%; }
.deal-card-sma-row .sma-value-wrap { display: flex; align-items: center; justify-content: space-between; font-size: 1.15rem; direction: ltr; width: 100%; }
.deal-card-sma-row .sma-value-wrap .crr-val { font-size: 1.15rem; font-weight: 700; }
.deal-card-sma-row .sma-value-wrap .crr-diff { font-size: 1.15rem; font-weight: 700; }

.deal-card-curl-text { font-size: 0.78rem; color: #64748b; margin-top: 8px; border-top: 1px solid #f1f5f9; padding-top: 8px; width: 100%; text-align: right; direction: rtl; font-weight: 500; }

/* Range rows */
.deal-card-ranges { border-top: 1px solid #f1f5f9; padding-top: 8px; margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.card-range-row { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; direction: ltr; }
.crr-label { color: #94a3b8; font-weight: 600; }
.crr-val { font-weight: 700; color: #0f172a; }
.crr-val.red { color: #dc2626; }
.crr-val.blue { color: #2563eb; }
.crr-diff.up { color: #059669; font-weight: 700; text-align: right; }
.crr-diff.down { color: #dc2626; font-weight: 700; text-align: right; }

.card-range-slider { direction: ltr; padding: 6px 0 2px; }
.card-range-slider .crs-title { display: block; width: 100%; text-align: right; font-size: 0.68rem; font-weight: 700; color: #64748b; margin-bottom: 0; unicode-bidi: plaintext; }
.card-range-slider .range-bar-track { height: 6px; margin: 10px 0 6px; background: linear-gradient(to right,#ef4444,#f59e0b,#22c55e); border-radius: 3px; position: relative; }
.card-range-slider .range-bar-fill { display: none; }
.card-range-slider .range-bar-pointer { width: 12px; height: 12px; top: -3px; border: 2px solid #fff; background: #2563eb; position: absolute; border-radius: 50%; transform: translateX(-50%); }
.card-range-slider .crs-values { display: flex; justify-content: space-between; }
.card-range-slider .crs-val { font-weight: 800; font-size: 0.75rem; color: #0f172a; display: block; }

/* Deal Expanded — card wrapper */
.ep-card-actions { display: flex; align-items: center; gap: 5px; padding: 6px 4px 0; direction: ltr; }
.ep-action-btn { display: inline-flex; align-items: center; justify-content: center; background: none; border: 1px solid #e2e8f0; border-radius: 6px; padding: 3px 7px; font-size: 0.72rem; color: #94a3b8; text-decoration: none; cursor: pointer; transition: color 0.15s, border-color 0.15s; font-family: inherit; }
.ep-action-btn:hover { color: #2563eb; border-color: #2563eb; }
.ep-card-footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #f1f5f9; margin-top: 10px; padding-top: 8px; direction: rtl; }
.ep-card-num { font-size: 0.68rem; color: #94a3b8; font-weight: 600; }
.ep-card { background: #fff; border-radius: 14px; border: 1px solid #e2e8f0; padding: 14px 16px; margin-top: 6px; }

/* Deal Expanded — header */
.ep-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ep-header-left { display: flex; align-items: center; gap: 10px; }
.ep-header-logo { width: 38px; height: 38px; border-radius: 9px; object-fit: contain; border: 1px solid #e2e8f0; background: #f8fafc; flex-shrink: 0; }
.ep-header-ticker { font-size: 1.3rem; font-weight: 800; color: #0f172a; }
.ep-header-name { font-size: 0.72rem; color: #64748b; margin-top: 1px; }
.ep-header-right { text-align: left; }
.ep-header-price { font-size: 1.6rem; font-weight: 800; color: #0f172a; direction: ltr; }
.ep-header-updated { font-size: 0.68rem; color: #94a3b8; margin-top: 2px; }

/* Deal Expanded — 3 sections */
.ep-metrics-row { display: flex; justify-content: space-between; align-items: flex-start; direction: rtl; margin-bottom: 12px; }
.ep-metrics-right { display: flex; gap: 16px; align-items: flex-start; direction: ltr; }
.ep-metric { text-align: center; }
.ep-metric-left { text-align: left; }
.ep-metric-right { text-align: right; }
.ep-metric-label { font-size: 0.68rem; font-weight: 600; color: #94a3b8; margin-bottom: 2px; }
.ep-metrics-row > .ep-metric,
.ep-entry-row > .ep-metric { text-align: left; }
.ep-metric-value { font-size: 1.3rem; font-weight: 800; color: #0f172a; display: block; }

.ep-range-section { border-top: 1px solid #f1f5f9; padding-top: 12px; margin-bottom: 12px; }
.ep-range-title { font-size: 0.68rem; font-weight: 700; color: #64748b; margin-bottom: 8px; text-align: right; }
.ep-range-bar { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(to right,#ef4444,#f59e0b,#22c55e); }
.ep-range-dot { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: #2563eb; transform: translate(-50%,-50%); border: 2px solid #fff; box-shadow: 0 0 0 1.5px #2563eb; }
.ep-range-values { display: flex; justify-content: space-between; margin-top: 6px; direction: ltr; }
.ep-range-col-left { text-align: left; }
.ep-range-col-center { text-align: center; }
.ep-range-col-right { text-align: right; }
.ep-range-val { font-size: 0.75rem; font-weight: 400; color: #0f172a; }
.ep-range-val.red { color: #dc2626; }
.ep-range-val.green { color: #059669; }
.ep-range-lbl { font-size: 0.62rem; color: #94a3b8; }

.ep-entry-row { display: flex; justify-content: space-between; align-items: flex-start; direction: rtl; border-top: 1px solid #f1f5f9; padding-top: 12px; }
.ep-entry-group { display: flex; align-items: flex-end; gap: 12px; direction: ltr; }
.ep-entry-input-wrap { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.ep-entry-input { display: block; width: 65px; border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 5px 8px; font-size: 0.85rem; font-weight: 700; color: #0f172a; outline: none; text-align: left; }
.ep-save-btn { display: block; background: #e2e8f0; color: #475569; border: none; border-radius: 6px; padding: 2px 6px; font-size: 0.65rem; font-weight: 600; cursor: pointer; margin-top: 4px; }

.ep-reg-date { font-size: 0.58rem; color: #94a3b8; text-align: left; margin-top: 8px; direction: ltr; }

/* Deal Expanded — TV signal + AI inline (inside main card) */
.ep-signal-ai { border-top: 1px solid #f1f5f9; margin-top: 12px; padding-top: 12px; }
.ep-signal-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ep-signal-center { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 10px; border-bottom: 1px solid #f1f5f9; padding-bottom: 10px; }
.ep-tv-circle { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ep-tv-circle span { font-size: 0.95rem; font-weight: 800; }
.ep-ai-inline-text { font-size: 0.76rem; color: #374151; line-height: 1.6; direction: rtl; margin-bottom: 8px; }
.ep-ai-empty { display: none; }

/* Deal Expanded — AI Analysis card */
.ep-ai-card { background: #fff; border-radius: 14px; border: 1px solid #e2e8f0; padding: 14px 16px; margin-top: 10px; }
.ep-ai-prompt { width: 100%; min-height: 80px; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; font-size: 0.72rem; color: #475569; font-family: inherit; resize: vertical; direction: rtl; margin-top: 8px; outline: none; }
.ep-ai-prompt:focus { border-color: #2563eb; }
.ep-ai-result { margin-top: 10px; border-top: 1px solid #f1f5f9; padding-top: 10px; }
.ep-ai-text { font-size: 0.78rem; color: #0f172a; line-height: 1.6; direction: rtl; margin-bottom: 8px; }
.ep-ai-prices { display: flex; gap: 16px; direction: rtl; }
.ep-ai-price-item { font-size: 0.72rem; color: #64748b; }
.ep-ai-price-item strong { color: #0f172a; font-size: 0.85rem; }

/* Deal Expanded — TradingView header + refresh button */
.ep-tv-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ep-tv-actions { display: flex; gap: 4px; align-items: center; }
.ep-tv-refresh-btn, .ep-tv-json-btn, .ep-tv-action-btn { background: none; border: 1px solid #e2e8f0; border-radius: 6px; padding: 3px 8px; font-size: 0.68rem; color: #64748b; cursor: pointer; display: flex; align-items: center; gap: 4px; }
.ep-tv-refresh-btn:hover, .ep-tv-json-btn:hover, .ep-tv-action-btn:hover { background: #f1f5f9; color: #0f172a; }
.ep-tv-json-btn.active { background: #eff6ff; border-color: #2563eb; color: #2563eb; }
.ep-json-view { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; font-size: 0.72rem; color: #334155; direction: ltr; text-align: left; overflow-x: auto; margin-top: 8px; white-space: pre; }
.bi-spin { animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Deal Expanded — TradingView separate card */
.ep-tv-card { background: #fff; border-radius: 14px; border: 1px solid #e2e8f0; padding: 14px 16px; margin-top: 10px; }
.ep-tv-title { font-size: 0.68rem; font-weight: 700; color: #94a3b8; letter-spacing: 0.05em; margin-bottom: 8px; text-align: right; }
.ep-tv-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid #f1f5f9; direction: rtl; }
.ep-tv-row-last { border-bottom: none; }
.ep-tv-label { font-size: 0.72rem; color: #64748b; }
.ep-tv-value { font-size: 0.78rem; font-weight: 700; color: #0f172a; }
.card-range-slider .crs-lbl { font-size: 0.62rem; font-weight: 600; color: #94a3b8; display: block; }

.ep-claude-text {
    font-size: 0.78rem;
    color: #334155;
    line-height: 1.55;
    margin-top: 6px;
    white-space: pre-wrap;
    direction: rtl;
    text-align: right;
}

.ep-claude-header {
    display: flex;
    align-items: center;
    gap: 15px;
}
