/* ===== ROOT VARIABLES ===== */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a1f2e;
    --bg-card-hover: #222839;
    --bg-accent: #162033;
    --border: #1e293b;
    --border-light: #2d3748;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --green: #00e676;
    --green-dim: #00c853;
    --green-bg: rgba(0, 230, 118, 0.08);
    --green-border: rgba(0, 230, 118, 0.2);
    --red: #ff5252;
    --red-dim: #ff1744;
    --red-bg: rgba(255, 82, 82, 0.08);
    --red-border: rgba(255, 82, 82, 0.2);
    --gold: #ffd740;
    --gold-bg: rgba(255, 215, 64, 0.08);
    --blue: #448aff;
    --blue-bg: rgba(68, 138, 255, 0.08);
    --purple: #b388ff;
    --orange: #ffab40;
    --cyan: #18ffff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== SECTION LABEL ===== */
.section-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.section-label i {
    color: var(--blue);
    font-size: 14px;
}

/* ===== HEADER ===== */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: linear-gradient(180deg, #111827 0%, #0f1320 100%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
}

.header-left { flex: 0 0 auto; }

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid var(--green-border);
    border-radius: 12px;
}

.logo-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #00e676 0%, #18ffff 50%, #00e676 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 500;
}

.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.market-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px;
    border-radius: 20px;
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--red);
    transition: var(--transition);
}

.market-status.open {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    animation: pulse 2s infinite;
}

.market-status.open .status-dot { background: var(--green); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.header-time {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 2px;
}

.header-right {
    flex: 0 0 auto;
    max-width: 380px;
}

.quote-box {
    max-width: 360px;
    padding: 10px 16px;
    background: var(--bg-accent);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    transition: var(--transition);
}

.quote-box:hover {
    border-color: var(--gold);
    background: var(--gold-bg);
}

.quote-icon {
    color: var(--gold);
    font-size: 11px;
    opacity: 0.6;
    position: absolute;
    top: 8px;
    left: 10px;
}

.quote-text {
    font-size: 11.5px;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-left: 16px;
}

.quote-author {
    font-size: 10.5px;
    color: var(--gold);
    font-weight: 600;
    text-align: right;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* ===== TICKER TAPE ===== */
.ticker-tape-wrapper {
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    overflow: hidden;
    height: 46px;
}

/* ===== KPI SECTION — New layout with Tickers strip + custom cards ===== */
.kpi-section {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding: 16px 24px;
    align-items: stretch;
}

.kpi-tickers-strip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    height: 100px;
    min-width: 0;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-width: 220px;
}

.kpi-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.kpi-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

/* ADV/DEC */
.adv-dec-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.adv-dec-nums {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
}

.adv-num {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--green);
}

.dec-num {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--red);
}

.adv-dec-sep {
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--text-muted);
}

.adv-dec-ratio {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    font-family: var(--font-mono);
}

/* SENTIMENT */
.sentiment-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.sentiment-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-muted);
    border: 2px solid var(--text-muted);
}

.sentiment-icon.bullish {
    background: var(--green-bg);
    color: var(--green);
    border-color: var(--green);
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.3);
}

.sentiment-icon.bearish {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red);
    box-shadow: 0 0 20px rgba(255, 82, 82, 0.3);
}

.sentiment-text {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1px;
}

.sentiment-text.bullish { color: var(--green); }
.sentiment-text.bearish { color: var(--red); }
.sentiment-text.selective { color: var(--gold); }

.sentiment-icon.selective {
    background: var(--gold-bg);
    color: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(255, 215, 64, 0.3);
}

.sentiment-detail {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    font-family: var(--font-mono);
}

/* ===== MBI (MARKET BREADTH) SECTION ===== */
.mbi-section {
    padding: 0 24px 16px;
}

.mbi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.mbi-content {
    display: block;
}

.mbi-table-wrapper {
    padding: 16px;
    overflow: hidden;
}

.mbi-current {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.mbi-em-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.mbi-em-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 800;
}

.mbi-em-status {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
}

.mbi-em-cyan { color: var(--cyan); }
.mbi-em-green { color: var(--green); }
.mbi-em-yellow { color: var(--gold); }
.mbi-em-orange { color: var(--orange); }
.mbi-em-red { color: var(--red); }

.mbi-table-scroll {
    max-height: 320px;
    overflow-y: auto;
}

.mbi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.mbi-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.mbi-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 6px 5px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    white-space: nowrap;
}

.mbi-table td {
    padding: 5px 5px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
    white-space: nowrap;
}

.mbi-em-cell {
    font-weight: 700;
}

.mbi-row-cyan { background: rgba(24, 255, 255, 0.06); }
.mbi-row-cyan .mbi-em-cell { color: var(--cyan); }
.mbi-row-green { background: rgba(0, 230, 118, 0.06); }
.mbi-row-green .mbi-em-cell { color: var(--green); }
.mbi-row-yellow { background: rgba(255, 215, 64, 0.06); }
.mbi-row-yellow .mbi-em-cell { color: var(--gold); }
.mbi-row-red { background: rgba(255, 82, 82, 0.06); }
.mbi-row-red .mbi-em-cell { color: var(--red); }

.mbi-rules {
    padding: 16px 20px;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mbi-rules-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.mbi-rule {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.mbi-rule strong {
    color: var(--text-primary);
}

.mbi-rule-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.mbi-caution { background: var(--gold); }
.mbi-bullish { background: var(--green); }
.mbi-danger { background: var(--red); }
.mbi-strong { background: var(--cyan); }

.mbi-legend {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.mbi-legend-title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.mbi-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mbi-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
}

.mbi-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.mbi-red-swatch { background: var(--red); opacity: 0.7; }
.mbi-yellow-swatch { background: var(--gold); opacity: 0.7; }
.mbi-green-swatch { background: var(--green); opacity: 0.7; }
.mbi-cyan-swatch { background: var(--cyan); opacity: 0.7; }

/* ===== STOCK ANALYSER ===== */
.analyser-section {
    padding: 0 24px 16px;
}

.analyser-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.analyser-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(179, 136, 255, 0.15);
    color: var(--purple);
    letter-spacing: 0.5px;
    margin-left: 8px;
    border: 1px solid rgba(179, 136, 255, 0.3);
}

.analyser-content {
    padding: 20px;
}

.analyser-input-area {
    margin-bottom: 20px;
}

.analyser-search {
    display: flex;
    gap: 10px;
}

.analyser-input {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 1px;
    text-transform: uppercase;
    outline: none;
    transition: var(--transition);
}

.analyser-input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(179, 136, 255, 0.15);
}

.analyser-input::placeholder {
    color: var(--text-muted);
    text-transform: none;
    font-weight: 400;
    letter-spacing: 0;
}

.analyser-btn {
    background: linear-gradient(135deg, var(--purple), #7c4dff);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.analyser-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(179, 136, 255, 0.4);
}

.analyser-quick-picks {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.quick-pick {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.5px;
}

.quick-pick:hover {
    color: var(--purple);
    border-color: var(--purple);
    background: rgba(179, 136, 255, 0.08);
}

.analyser-result {
    min-height: 200px;
}

.analyser-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.analyser-placeholder i {
    font-size: 40px;
    color: var(--purple);
    opacity: 0.3;
    margin-bottom: 12px;
}

.analyser-placeholder p {
    font-size: 14px;
    margin-bottom: 20px;
}

.analyser-method-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

.method-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.method-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(179, 136, 255, 0.15);
    color: var(--purple);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.analyser-loading, .analyser-error {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.analyser-error {
    color: var(--red);
}

.analyser-error i {
    font-size: 24px;
}

/* Analysis Result */
.analysis-result {
    animation: slide-up 0.3s ease-out;
}

.analysis-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.analysis-symbol {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.analysis-company {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.analysis-ltp {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

.analysis-change {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 2px;
}

.analysis-change.positive { color: var(--green); background: var(--green-bg); }
.analysis-change.negative { color: var(--red); background: var(--red-bg); }

.analysis-verdict-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid;
}

.analysis-verdict-bar.strong-candidate {
    background: rgba(0, 230, 118, 0.08);
    border-color: var(--green-border);
}
.analysis-verdict-bar.watchlist {
    background: rgba(255, 215, 64, 0.08);
    border-color: rgba(255, 215, 64, 0.2);
}
.analysis-verdict-bar.weak {
    background: rgba(255, 171, 64, 0.08);
    border-color: rgba(255, 171, 64, 0.2);
}
.analysis-verdict-bar.avoid {
    background: rgba(255, 82, 82, 0.08);
    border-color: var(--red-border);
}

.score-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid;
    flex-shrink: 0;
}

.strong-candidate .score-circle { border-color: var(--green); }
.watchlist .score-circle { border-color: var(--gold); }
.weak .score-circle { border-color: var(--orange); }
.avoid .score-circle { border-color: var(--red); }

.score-num {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}

.strong-candidate .score-num { color: var(--green); }
.watchlist .score-num { color: var(--gold); }
.weak .score-num { color: var(--orange); }
.avoid .score-num { color: var(--red); }

.score-label {
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 600;
}

.verdict-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
}

.strong-candidate .verdict-title { color: var(--green); }
.watchlist .verdict-title { color: var(--gold); }
.weak .verdict-title { color: var(--orange); }
.avoid .verdict-title { color: var(--red); }

.verdict-summary {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.analysis-note {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--purple);
    margin-bottom: 16px;
}

.analysis-price-levels {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.price-level {
    text-align: center;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.pl-label {
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.pl-val {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.pl-val.green { color: var(--green); }
.pl-val.red { color: var(--red); }

.analysis-checks-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.analysis-checks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.check-item {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.check-item:hover {
    background: var(--bg-card-hover);
}

.check-item.pass {
    border-left: 3px solid var(--green);
}

.check-item.fail {
    border-left: 3px solid var(--red);
    opacity: 0.75;
}

.check-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.check-icon {
    font-size: 14px;
}

.check-item.pass .check-icon { color: var(--green); }
.check-item.fail .check-icon { color: var(--red); }

.check-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}

.check-weight {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.check-item.pass .check-weight {
    color: var(--green);
    background: var(--green-bg);
}

.check-item.fail .check-weight {
    color: var(--text-muted);
    background: var(--bg-secondary);
}

.check-value {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.check-detail {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== CHART SECTION (FULL WIDTH) ===== */
.chart-section-full {
    padding: 0 24px 16px;
}

/* ===== CHART ROW (Legacy) ===== */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 16px;
    padding: 0 24px 16px;
}

.chart-main {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.chart-container {
    height: 500px;
}

.chart-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-widget-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    flex: 1;
}

.sidebar-widget-container {
    height: 560px;
    overflow: hidden;
}

.sidebar-panel {
    height: 100%;
}

.sidebar-panel > div {
    height: 100%;
}

/* ===== 3 COLUMN SECTION ===== */
.three-col-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 0 24px 16px;
}

.col-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.col-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}

.col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 6px;
}

.col-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gold);
}

.col-title i { font-size: 15px; }
.gainers-title { color: var(--green); }
.losers-title { color: var(--red); }

.col-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--gold-bg);
    color: var(--gold);
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 215, 64, 0.2);
}

.badge-green { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.badge-red { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }

.col-description {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 18px 10px;
}

.stock-list {
    max-height: 440px;
    overflow-y: auto;
    padding: 0 6px 6px;
}

.stock-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 1px solid transparent;
}

.stock-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
}

.stock-rank {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    width: 22px;
    text-align: center;
    font-weight: 600;
}

.stock-info { flex: 1; margin-left: 10px; }

.stock-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.stock-fullname {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.stock-price { text-align: right; }

.stock-ltp {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.stock-pct {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 2px;
    display: inline-block;
}

.stock-pct.positive { color: var(--green); background: var(--green-bg); }
.stock-pct.negative { color: var(--red); background: var(--red-bg); }
.stock-pct.near-ath { color: var(--gold); background: var(--gold-bg); }

.ath-distance-bar {
    width: 60px;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.ath-distance-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--green));
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ===== WATCHLIST SECTION ===== */
.watchlist-section { padding: 0 24px 16px; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i { color: var(--blue); }

.watchlist-tabs { display: flex; gap: 8px; }

.wl-tab {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 7px 18px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.wl-tab:hover { background: var(--bg-card-hover); border-color: var(--border-light); }
.wl-tab.active { background: var(--blue-bg); border-color: var(--blue); color: var(--blue); }

.watchlist-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 400px;
}

.wl-panel { display: none; height: 400px; }
.wl-panel.active { display: block; }

/* ===== BOTTOM SECTION (News, Heatmap, Trump) ===== */
.bottom-section {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    padding: 0 24px 16px;
}

.bottom-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.bottom-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.card-header h3 i { color: var(--blue); }
.trump-card .card-header h3 i { color: var(--orange); }

.live-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--red-bg);
    color: var(--red);
    letter-spacing: 1px;
    border: 1px solid var(--red-border);
    animation: pulse 2s infinite;
}

.news-list {
    padding: 8px;
    max-height: 420px;
    overflow-y: auto;
}

.news-item {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    color: inherit;
}

.news-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
}

.news-item-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.news-number {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--blue);
    background: var(--blue-bg);
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.trump-card .news-number {
    color: var(--orange);
    background: rgba(255, 171, 64, 0.1);
}

.news-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
}

.news-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
    padding-left: 32px;
}

.news-source { font-size: 10px; color: var(--text-muted); font-weight: 600; }
.news-time { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

.news-tag {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--orange);
    color: var(--bg-primary);
    letter-spacing: 0.5px;
}

/* HEATMAP */
.heatmap-container {
    height: 420px;
    padding: 8px;
    overflow-y: auto;
}

.custom-heatmap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    height: 100%;
}

.heatmap-cell {
    border-radius: var(--radius-sm);
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.heatmap-cell:hover {
    transform: scale(1.03);
    z-index: 2;
    box-shadow: var(--shadow);
}

.heatmap-cell-name { font-size: 12px; font-weight: 800; color: #fff; letter-spacing: 0.5px; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.heatmap-cell-change { font-family: var(--font-mono); font-size: 15px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.5); margin-top: 3px; }
.heatmap-cell-fullname { font-size: 9px; color: rgba(255,255,255,0.7); margin-top: 2px; }

/* ===== CALENDAR + GLOBAL HEATMAP ROW ===== */
.calendar-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 0 24px 16px;
}

.calendar-card, .heatmap-global-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.calendar-container {
    height: 460px;
}

.global-heatmap-container {
    height: 460px;
}

/* ===== FOOTER ===== */
.dashboard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
}

.footer-sep { margin: 0 8px; opacity: 0.3; }

/* ===== LOADING ===== */
.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 12px;
    color: var(--text-muted);
    font-size: 12px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SHIMMER LOADING SKELETON ===== */
.shimmer-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.shimmer-pulse {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.shimmer-rank { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; }
.shimmer-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.shimmer-name { width: 80px; height: 14px; }
.shimmer-sub { width: 120px; height: 10px; }
.shimmer-price { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.shimmer-num { width: 70px; height: 14px; }
.shimmer-pct { width: 50px; height: 12px; }

/* ===== SOURCE BADGES ===== */
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 6px;
}

.source-badge .source-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}

.source-badge.live {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green-border);
}
.source-badge.live .source-dot { background: var(--green); }

.source-badge.cached {
    background: var(--gold-bg);
    color: var(--gold);
    border: 1px solid rgba(255, 215, 64, 0.2);
}
.source-badge.cached .source-dot { background: var(--gold); }

.source-badge.offline {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red-border);
}
.source-badge.offline .source-dot { background: var(--red); }

/* ===== NO DATA STATE ===== */
.no-data {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

/* ===== KITE CONNECT BUTTON ===== */
.kite-status-bar {
    margin-top: 4px;
}

.kite-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    background: rgba(255, 171, 64, 0.1);
    border: 1px solid rgba(255, 171, 64, 0.3);
    color: var(--orange);
}

.kite-login-btn:hover {
    background: rgba(255, 171, 64, 0.2);
    border-color: var(--orange);
    box-shadow: 0 0 15px rgba(255, 171, 64, 0.2);
    transform: translateY(-1px);
}

.kite-login-btn i {
    font-size: 11px;
}

.kite-login-btn.connected {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
    pointer-events: none;
}

.kite-login-btn.connected:hover {
    box-shadow: none;
    transform: none;
}

/* ===== KPI INDEX CARDS (replaces broken TradingView tickers) ===== */
.kpi-indices-strip {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.kpi-index-card {
    flex: 1;
    min-width: 100px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    text-align: center;
    transition: var(--transition);
}

.kpi-index-card.up {
    border-color: var(--green-border);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(0, 230, 118, 0.04) 100%);
}

.kpi-index-card.down {
    border-color: var(--red-border);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(255, 82, 82, 0.04) 100%);
}

.kpi-index-name {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.kpi-index-value {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.kpi-index-change {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}

.kpi-index-change.positive { color: var(--green); }
.kpi-index-change.negative { color: var(--red); }

.kpi-tv-card {
    flex: 1;
    min-width: 100px;
    height: 80px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    overflow: hidden;
}

/* ===== KITE TICKER (CNBC-style marquee) ===== */
.kite-ticker-container {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(17, 24, 39, 0.5) 100%);
    border-bottom: 2px solid var(--blue);
    padding: 0;
    overflow: hidden;
    height: 48px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.kite-ticker-strip {
    display: flex;
    gap: 0;
    padding: 0;
    animation: scroll-ticker linear infinite;
    animation-play-state: paused;
    height: 100%;
}

.kite-ticker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    padding: 0 20px;
    border-right: 1px solid var(--border);
    height: 100%;
    flex-shrink: 0;
    transition: background 0.2s;
}

.kite-ticker-item:hover {
    background: rgba(68, 138, 255, 0.08);
}

.ticker-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue);
}

.ticker-dot.positive {
    background: var(--green);
}

.ticker-dot.negative {
    background: var(--red);
}

.ticker-symbol {
    font-weight: 800;
    font-size: 12px;
    color: var(--text-primary);
    letter-spacing: 1px;
    min-width: 70px;
    text-transform: uppercase;
}

.ticker-price {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 90px;
    text-align: right;
}

.ticker-change {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    min-width: 65px;
    text-align: right;
}

.ticker-change.positive {
    color: var(--green);
}

.ticker-change.negative {
    color: var(--red);
}

@keyframes scroll-ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-error {
    padding: 12px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    height: 100%;
    display: flex;
    align-items: center;
}

/* ===== SIDEBAR WATCHLIST TABS ===== */
.watchlist-sidebar-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.sidebar-tab {
    flex: 1;
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
}

.sidebar-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.sidebar-tab.active {
    background: var(--blue-bg);
    color: var(--blue);
    border-color: var(--blue);
}

.sidebar-tab i {
    font-size: 9px;
}

.sidebar-panel {
    display: none;
    height: 100%;
    overflow-y: auto;
}

.sidebar-panel.active {
    display: block;
}

/* ===== KITE WATCHLIST (custom list) ===== */
.kite-watchlist {
    padding: 0;
}

.kite-watchlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    transition: background 0.2s;
}

.kite-watchlist-item:hover {
    background: var(--bg-card-hover);
}

.kite-wl-symbol {
    font-weight: 700;
    color: var(--text-primary);
    flex: 0 0 60px;
}

.kite-wl-price {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    flex: 0 0 70px;
    text-align: right;
}

.kite-wl-change {
    font-family: var(--font-mono);
    font-weight: 600;
    flex: 0 0 50px;
    text-align: right;
}

.kite-wl-change.positive { color: var(--green); }
.kite-wl-change.negative { color: var(--red); }

/* ===== SECTOR HEATMAP HOVER & MODAL ===== */
.heatmap-cell {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.heatmap-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    filter: brightness(1.15);
    z-index: 10;
}

.heatmap-cell::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.heatmap-cell:hover::after {
    opacity: 1;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slide-up 0.3s ease-out;
}

@keyframes slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

.modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 16px;
}

.modal-stocks {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.modal-loading,
.modal-empty,
.modal-error {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.modal-stock-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.modal-stock-item:hover {
    background: var(--bg-card-hover);
}

.modal-stock-item:last-child {
    border-bottom: none;
}

.modal-rank {
    font-weight: 700;
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 30px;
    text-align: center;
}

.modal-stock-info {
    flex: 1;
    margin: 0 12px;
}

.modal-stock-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
}

.modal-stock-company {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.modal-stock-price {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 120px;
}

.modal-ltp {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    min-width: 70px;
}

.modal-change {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 12px;
    min-width: 50px;
    text-align: right;
}

.modal-change.positive {
    color: var(--green);
}

.modal-change.negative {
    color: var(--red);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1400px) {
    .kpi-section { grid-template-columns: 1fr; }
    .kpi-tickers-strip { height: 80px; }
    .kpi-card { min-width: auto; }
    .chart-row { grid-template-columns: 1fr 340px; }
    .bottom-section { grid-template-columns: 1fr 1fr; }
    .calendar-section { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
    .three-col-section { grid-template-columns: 1fr; }
    .bottom-section { grid-template-columns: 1fr; }
    .chart-row { grid-template-columns: 1fr; }
    .sidebar-widget-container { height: 350px; }
    .dashboard-header { flex-direction: column; gap: 12px; }
    .header-right { max-width: 100%; }
    .quote-box { max-width: 100%; }
}
