:root {
    --bg-main: #0b0e14;
    --bg-card: #121722;
    --bg-card-hover: #182030;
    --bg-elevated: #1a2234;
    --border-color: #232c42;
    --border-light: #2c3853;
    
    --text-primary: #f0f3f8;
    --text-secondary: #9aa7be;
    --text-muted: #5e6e8c;
    
    --accent-blue: #2962ff;
    --accent-blue-hover: #1e4bd8;
    --accent-cyan: #00d2ff;
    
    --color-up: #00c087;
    --color-up-bg: rgba(0, 192, 135, 0.12);
    --color-down: #ff3b69;
    --color-down-bg: rgba(255, 59, 105, 0.12);
    --color-neutral: #848e9c;
    --color-neutral-bg: rgba(132, 142, 156, 0.12);
    
    --badge-strong-buy: #00e676;
    --badge-buy: #00b0ff;
    --badge-neutral: #78909c;
    --badge-sell: #ff9100;
    --badge-strong-sell: #ff1744;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Ticker Bar */
.ticker-wrap {
    width: 100%;
    overflow: hidden;
    height: 38px;
    background-color: #080a0f;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    white-space: nowrap;
    position: relative;
    z-index: 100;
}

.ticker-move {
    display: inline-flex;
    animation: tickerAnim 200s linear infinite;
    gap: 28px;
    padding-left: 100%;
}

.ticker-wrap:hover .ticker-move {
    animation-play-state: paused;
}

@keyframes tickerAnim {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.ticker-item:hover {
    background: var(--bg-card-hover);
}

.ticker-symbol {
    font-weight: 700;
    color: var(--text-primary);
}

.ticker-price {
    color: var(--text-secondary);
}

/* Header */
.main-header {
    background: rgba(18, 23, 34, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-container {
    max-width: 1540px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-blue), #6200ea);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    box-shadow: 0 4px 14px rgba(41, 98, 255, 0.4);
}

.logo-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-pro {
    font-size: 11px;
    background: linear-gradient(90deg, #ff007a, #7928ca);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.logo-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.last-sync-badge {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 4px 14px rgba(41, 98, 255, 0.3);
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover, .btn-outline.active {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

/* Main Container */
.dashboard-container {
    max-width: 1540px;
    margin: 24px auto;
    padding: 0 24px 60px;
}

/* Stat Cards */
.overview-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
    border-color: var(--border-light);
}

.stat-card {
    padding: 20px;
}

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

.stat-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.stat-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    background: rgba(41, 98, 255, 0.08);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px 10px 40px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--accent-blue);
}

.filter-selects {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 9px 14px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

select:focus {
    border-color: var(--accent-blue);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background: #0e131d;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}

.data-table tr:hover td {
    background: var(--bg-card-hover);
}

.cell-symbol {
    display: flex;
    align-items: center;
    gap: 12px;
}

.symbol-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: var(--accent-cyan);
    border: 1px solid var(--border-color);
}

.symbol-name-col .symbol-ticker {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.symbol-name-col .symbol-full {
    font-size: 11px;
    color: var(--text-muted);
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Price & Number Styling */
.mono-num {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.badge-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
}

.badge-change.up {
    color: var(--color-up);
    background: var(--color-up-bg);
}

.badge-change.down {
    color: var(--color-down);
    background: var(--color-down-bg);
}

.badge-change.flat {
    color: var(--color-neutral);
    background: var(--color-neutral-bg);
}

/* Recommendation Badges */
.badge-rating {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-rating.strong-buy {
    background: rgba(0, 230, 118, 0.15);
    color: var(--badge-strong-buy);
    border: 1px solid rgba(0, 230, 118, 0.4);
}

.badge-rating.buy {
    background: rgba(0, 176, 255, 0.15);
    color: var(--badge-buy);
    border: 1px solid rgba(0, 176, 255, 0.4);
}

.badge-rating.neutral {
    background: rgba(120, 144, 156, 0.15);
    color: var(--badge-neutral);
    border: 1px solid rgba(120, 144, 156, 0.4);
}

.badge-rating.sell {
    background: rgba(255, 145, 0, 0.15);
    color: var(--badge-sell);
    border: 1px solid rgba(255, 145, 0, 0.4);
}

.badge-rating.strong-sell {
    background: rgba(255, 23, 68, 0.15);
    color: var(--badge-strong-sell);
    border: 1px solid rgba(255, 23, 68, 0.4);
}

/* RSI pill */
.rsi-badge {
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
}

.rsi-overbought {
    background: rgba(255, 59, 105, 0.2);
    color: #ff5252;
}

.rsi-oversold {
    background: rgba(0, 230, 118, 0.2);
    color: #00e676;
}

.rsi-neutral {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

/* Pagination */
.pagination-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-btn-group {
    display: flex;
    gap: 6px;
}

/* Ideas Grid */
.ideas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.idea-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.idea-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-blue);
}

.idea-image-box {
    width: 100%;
    height: 180px;
    background: #080a0f;
    position: relative;
    overflow: hidden;
}

.idea-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.idea-symbol-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-cyan);
}

.idea-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.idea-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    line-height: 1.4;
}

.idea-desc {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
    flex: 1;
}

.idea-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.idea-author {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3, .card-header h4 {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 16px 20px;
}

.movers-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.show {
    display: flex;
    animation: fadeIn 0.25s ease;
}

.modal-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 1280px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}

.btn-close {
    background: var(--bg-elevated);
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-close:hover {
    background: var(--color-down);
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.modal-stat-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
}

.modal-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.modal-stat-val {
    font-size: 18px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.tv-chart-box {
    height: 520px;
    width: 100%;
}

.detail-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}

.gauge-container {
    height: 380px;
    width: 100%;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-blue);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.3s ease;
}

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

/* Helpers */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--color-up) !important; }
.text-danger { color: var(--color-down) !important; }
.text-warning { color: #f59e0b !important; }
.text-primary { color: var(--accent-blue) !important; }
.text-idx { color: #00d2ff !important; }
.text-muted { color: var(--text-muted) !important; }
.mt-4 { margin-top: 24px; }
.py-5 { padding: 40px 0; }
.py-3 { padding: 20px 0; }

@media (max-width: 900px) {
    .detail-split-grid {
        grid-template-columns: 1fr;
    }
    .tv-chart-box {
        height: 380px;
    }
}
