/* ==========================================================================
   1. MARKET LAYOUT & STRUCTURE
   ========================================================================== */
.market-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 1.5rem; 
}

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

.market-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .market-layout { grid-template-columns: 2fr 1fr; }
}

.sticky-wrapper {
    position: sticky;
    top: 100px;
}

/* ==========================================================================
   2. DASHBOARD HEADER — status badge aligned right
   ========================================================================== */
.dashboard-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.dashboard-header .connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;        /* push to right */
    margin-top: -2.5rem;      /* pull up alongside title */
    align-self: flex-end;
}

/* ==========================================================================
   3. FILTER PILLS
   ========================================================================== */
.filter-tabs { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.filter-pill {
    padding: 0.75rem 1.5rem; 
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    background-color: #e2e8f0;
    color: #334155;
}

.filter-pill:hover { background-color: #cbd5e1; }
.filter-pill.active { background: var(--color-primary); color: white; }

[data-theme="dark"] .filter-pill {
    background-color: #1e293b;
    color: #94a3b8;
}

/* ==========================================================================
   4. PULSE ROW
   ========================================================================== */
.market-pulse-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0 2rem 0;
}

.pulse-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: var(--radius-xl);
    text-align: center;
    transition: transform var(--transition);
}

.pulse-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

.pulse-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.pulse-price {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    font-family: monospace;
}

/* ==========================================================================
   5. ASSET CARDS — fixed layout
   ========================================================================== */
.asset-list { 
    display: flex; 
    flex-direction: column; 
    gap: 1rem; 
}

.asset-card {
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl); 
    padding: 1.25rem 1.5rem;
    /* Grid: main info | price values | delete btn */
    display: grid !important;
    grid-template-columns: 1fr auto 36px;
    align-items: center;
    gap: 0.75rem;
    transition: all var(--transition);
    position: relative;
}

.asset-card:hover { 
    border-color: var(--color-primary); 
    transform: translateX(5px); 
}

/* Delete button — top right, compact */
.asset-card .delete-btn {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #ef4444;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    line-height: 1;
    opacity: 1;
    transition: all 0.2s;
    order: 3;
    justify-self: end;
    align-self: center;
    min-width: 32px;
    text-align: center;
}

.asset-card .delete-btn:hover { 
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    transform: scale(1.05);
}

/* Left section: star + name */
.asset-main { 
    display: flex; 
    align-items: center; 
    gap: 1rem;
    order: 1;
}

.asset-details {
    display: flex;
    flex-direction: column;
}

.asset-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.symbol { 
    font-weight: 700; 
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0;
}

.full-name { 
    font-size: 0.8125rem; 
    color: var(--text-secondary);
    margin: 0;
}

/* Right section: price + change */
.asset-values {
    text-align: right;
    order: 2;
}

/* Badge colors */
.badge { 
    padding: 2px 8px; 
    border-radius: 4px; 
    font-size: 0.7rem; 
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-stock  { background: rgba(59,130,246,0.12);  color: #60a5fa; }
.badge-etf    { background: rgba(245,158,11,0.12);  color: #fbbf24; }
.badge-crypto { background: rgba(139,92,246,0.12);  color: #a78bfa; }

/* ==========================================================================
   6. PRICE INFO
   ========================================================================== */
.price-value { font-size: 1.25rem; font-weight: 700; font-family: monospace; }
.price-change { font-size: 0.875rem; font-weight: 600; margin-top: 2px; }
.price-change.up   { color: var(--color-emerald); }
.price-change.down { color: #f87171; }

.section-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 1rem; }

/* ==========================================================================
   7. WATCHLIST SIDEBAR
   ========================================================================== */
.watchlist-card {
    border: 2px dashed rgba(148, 163, 184, 0.4);   /* more visible dashed border */
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    min-height: 120px;
}

[data-theme="dark"] .watchlist-card {
    background: rgba(15, 23, 42, 0.3);
    border-color: var(--border-color);
}

.watchlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

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

/* Empty state */
.watchlist-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    gap: 0.5rem;
}

.watchlist-empty-icon { font-size: 1.5rem; opacity: 0.5; }

/* ==========================================================================
   8. DARK THEME OVERRIDES
   ========================================================================== */
[data-theme="dark"] .asset-card {
    background: rgba(30, 41, 59, 0.4); 
    backdrop-filter: blur(10px);
    border-color: var(--border-subtle, var(--border-color));
}

[data-theme="dark"] .asset-card:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: var(--color-primary);
}

/* Search CSS moved to global.css */

/* ==========================================================================
   10. RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    .header-search { max-width: 180px; margin: 0 0.75rem; }
    .asset-card { padding: 1rem; }
    .dashboard-header .connection-status { 
        margin-left: 0; 
        margin-top: 0.5rem;
        align-self: flex-start;
    }
}

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

/* ==========================================================================
   11. PAGE TRANSITIONS
   ========================================================================== */
.page-enter-active,
.page-leave-active {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.page-enter-from {
    opacity: 0;
    transform: translateY(6px);
}

.page-leave-to {
    opacity: 0;
    transform: translateY(-6px);
}

/* ── Light Mode Overrides ─────────────────────────────────────────────────── */
:root:not([data-theme="dark"]) .asset-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}
:root:not([data-theme="dark"]) .asset-card:hover {
    border-color: #C5BAFF;
    box-shadow: 0 4px 16px rgba(197,186,255,0.3);
}
:root:not([data-theme="dark"]) .filter-pill {
    background: #ffffff;
    border-color: var(--border-color);
    color: var(--text-secondary);
}
:root:not([data-theme="dark"]) .filter-pill:hover {
    background: var(--bg-tertiary);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
:root:not([data-theme="dark"]) .filter-pill.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}
:root:not([data-theme="dark"]) .watchlist-section {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}
:root:not([data-theme="dark"]) .section-title {
    color: var(--text-primary);
}

/* ==========================================================================
   MARKET VIEW CONTAINER
   ========================================================================== */
.market-view-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* ==========================================================================
   MARKET HEADER
   ========================================================================== */
.market-page-header {
    padding: 2rem 0 1.5rem;
}

.market-subtitle {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ==========================================================================
   CONNECTION STATUS
   ========================================================================== */
.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.connection-dot--live { background-color: #10b981; }
.connection-dot--connecting { background-color: #ef4444; }

.connection-text {
    font-size: 0.875rem;
    font-weight: 500;
}

.connection-text--live { color: #10b981; }
.connection-text--connecting { color: #ef4444; }

/* ==========================================================================
   FILTER PILL ROW
   ========================================================================== */
.filter-pill-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   ASSET VALUES
   ========================================================================== */
.asset-price {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-primary);
}

.asset-change {
    font-size: 0.875rem;
}

/* ==========================================================================
   WATCHLIST ITEM
   ========================================================================== */
.watchlist-sym   { font-weight: bold; color: var(--text-primary); }
.watchlist-price { font-size: 0.8rem; color: #94a3b8; }

.watchlist-remove-btn {
    color: #ef4444;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    align-self: center;
}

/* ==========================================================================
   STAR / WATCHLIST TOGGLE BUTTON
   ========================================================================== */
.star-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.star-btn--active   { color: #fbbf24; }
.star-btn--inactive { color: #94a3b8; }

/* ==========================================================================
   WATCHLIST HINT TEXT
   ========================================================================== */
.watchlist-hint {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ==========================================================================
   RECOMMENDATIONS PAGE  (shares market.css)
   ========================================================================== */

.reco-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.reco-header { margin-bottom: 2rem; }

.reco-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 0.4rem;
}

.reco-subtitle {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
}

/* ── Filter tabs ── */
.reco-filter-row {
    display: flex;
    gap: 0.6rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.reco-filter-btn {
    padding: 8px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.reco-filter-btn.active {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
}

/* ── Signal list ── */
.reco-signal-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── Signal card ── */
.reco-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.reco-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.reco-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.reco-card-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.reco-sym-badge {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    flex-shrink: 0;
}

.reco-sym-badge--sm { font-size: 0.75rem; }
.reco-sym-badge--md { font-size: 1rem; }

.reco-sym-name {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
}

.reco-badge-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.reco-type-badge {
    font-size: 0.7rem;
    padding: 3px 9px;
    border-radius: 100px;
    font-weight: 600;
    border: 1px solid;
}

.reco-source-badge {
    font-size: 0.7rem;
    padding: 3px 9px;
    border-radius: 100px;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.reco-action {
    text-align: right;
}

.reco-action-label {
    font-size: 1.75rem;
    font-weight: 800;
    color: #10b981;
}

.reco-action-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ── Rationale box ── */
.reco-rationale {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.reco-rationale-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reco-rationale-text {
    margin: 0;
    line-height: 1.65;
    color: var(--text-primary);
}

/* ── Stats grid ── */
.reco-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.reco-stats-grid--2col {
    grid-template-columns: repeat(2, 1fr);
}

.reco-stat-box {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.reco-stat-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reco-stat-value {
    font-size: 1.35rem;
    font-weight: 800;
}

.reco-stat-value--loading {
    color: var(--text-secondary);
    font-size: 1rem;
}

.reco-stat-upside {
    font-size: 0.72rem;
    color: #10b981;
    margin-top: 2px;
}

/* ── AI section ── */
.reco-ai-section { margin-top: 3rem; }

.reco-ai-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.reco-ai-label {
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(236,72,153,0.15));
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

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

/* ── AI card ── */
.reco-ai-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    margin-bottom: 1.25rem;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(139, 92, 246, 0.25);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.reco-ai-card:hover {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 4px 24px rgba(139, 92, 246, 0.12);
}

.reco-ai-accent-strip {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #ec4899, #3b82f6);
}

.reco-ai-sym-badge {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
    flex-shrink: 0;
}

.reco-ai-type-badge {
    font-size: 0.75rem;
    padding: 3px 9px;
    border-radius: 100px;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.reco-ai-pick-badge {
    font-size: 0.75rem;
    padding: 3px 9px;
    border-radius: 100px;
    font-weight: 600;
    background: rgba(236, 72, 153, 0.1);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.reco-ai-confidence-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.reco-ai-rationale {
    background: linear-gradient(135deg, rgba(139,92,246,0.06), rgba(236,72,153,0.04));
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(139, 92, 246, 0.1);
}

.reco-ai-rationale-label {
    font-size: 0.75rem;
    color: #a78bfa;
    margin-bottom: 0.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reco-confidence-bar-track {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 6px;
}

.reco-confidence-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s;
}

/* ── Disclaimer ── */
.reco-disclaimer {
    margin-top: 2.5rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.2);
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .reco-stats-grid { grid-template-columns: 1fr; }
    .reco-stats-grid--2col { grid-template-columns: 1fr; }
}
