:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-elev: #243349;
    --border: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-hover: #2563eb;
    --up: #22c55e;
    --up-soft: rgba(34, 197, 94, 0.12);
    --down: #ef4444;
    --down-soft: rgba(239, 68, 68, 0.12);
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    background-image: radial-gradient(circle at 20% -10%, rgba(59, 130, 246, 0.15), transparent 40%);
}

a { color: inherit; }

/* ---------- Navigation ---------- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 5%;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.logo {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--accent-blue);
    text-decoration: none;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    margin-left: 1.6rem;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover { color: var(--accent-blue); }

.btn-login {
    border: 1px solid var(--accent-blue);
    padding: 0.45rem 1.1rem;
    border-radius: 6px;
    transition: all 0.25s ease;
}

.btn-login:hover { background-color: var(--accent-blue); color: #fff; }

.market-status {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.market-status .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--up);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ---------- Hero ---------- */
.hero {
    text-align: center;
    padding: 6rem 2rem 4rem;
    background: linear-gradient(180deg, var(--bg-dark) 0%, #172033 100%);
}

.hero-content { max-width: 780px; margin: 0 auto; }

.pill {
    display: inline-block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.82rem;
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: 3.3rem;
    line-height: 1.15;
    margin-bottom: 1.3rem;
}

.grad {
    background: linear-gradient(90deg, #3b82f6, #22c55e);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 620px;
    margin: 0 auto 2.2rem;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: white;
    text-decoration: none;
    padding: 0.9rem 2rem;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: bold;
    transition: transform 0.15s, background-color 0.3s;
}

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

.btn-ghost {
    border: 1px solid var(--border);
    color: var(--text-main);
    text-decoration: none;
    padding: 0.9rem 2rem;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    transition: border-color 0.25s;
}

.btn-ghost:hover { border-color: var(--accent-blue); }

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.6rem; color: var(--text-main); }
.hero-stats span { color: var(--text-muted); font-size: 0.85rem; }

/* ---------- Generic section ---------- */
.section { padding: 4rem 5%; max-width: 1200px; margin: 0 auto; }
.section-head { text-align: center; margin-bottom: 2.5rem; }
.section-head h2 { font-size: 2.2rem; margin-bottom: 0.6rem; }
.muted { color: var(--text-muted); max-width: 680px; margin: 0 auto; }

/* ---------- Ticker board ---------- */
.ticker-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1rem;
}

.ticker {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.ticker:hover { border-color: var(--accent-blue); box-shadow: var(--shadow); }
.ticker.selected { border-color: var(--accent-blue); }

.ticker .sym { font-weight: 700; letter-spacing: 0.02em; }
.ticker .name { color: var(--text-muted); font-size: 0.75rem; margin-bottom: 0.7rem; }
.ticker .ltp { font-size: 1.5rem; font-weight: 700; transition: color 0.25s; }
.ticker .chg { font-size: 0.85rem; font-weight: 600; }

.flash-up   { animation: flashUp 0.6s ease; }
.flash-down { animation: flashDown 0.6s ease; }
@keyframes flashUp   { 0% { background: var(--up-soft); }   100% { background: var(--bg-card); } }
@keyframes flashDown { 0% { background: var(--down-soft); } 100% { background: var(--bg-card); } }

.up   { color: var(--up); }
.down { color: var(--down); }

/* ---------- Trade section ---------- */
.trade-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-card, .order-card, .positions-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
}

.chart-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.symbol-select {
    background: var(--bg-elev);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
    font-weight: 700;
}

.chart-ltp { font-size: 1.4rem; font-weight: 700; margin-left: 0.8rem; }
.chart-change { font-size: 0.95rem; font-weight: 600; margin-left: 0.4rem; }

.range-toggle { display: flex; gap: 0.3rem; }
.range-btn {
    background: var(--bg-elev);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.range-btn:hover { color: var(--text-main); }
.range-btn.active { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }

#price-chart { width: 100%; display: block; }

/* ---------- Order ticket ---------- */
.order-card h3, .positions-card h3 { margin-bottom: 1rem; }

.balance-row, .est-row {
    display: flex;
    justify-content: space-between;
    padding: 0.55rem 0;
    color: var(--text-muted);
    border-bottom: 1px dashed var(--border);
}
.balance-row strong, .est-row strong { color: var(--text-main); }

.fld { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.9rem 0; }
.fld span { color: var(--text-muted); font-size: 0.85rem; }
.fld strong { font-size: 1.1rem; }
.fld input {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    padding: 0.6rem 0.7rem;
    font-size: 1rem;
}

.order-actions { display: flex; gap: 0.8rem; margin-top: 1rem; }
.btn-buy, .btn-sell {
    flex: 1;
    border: none;
    border-radius: 8px;
    padding: 0.8rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    transition: filter 0.2s, transform 0.1s;
}
.btn-buy { background: var(--up); }
.btn-sell { background: var(--down); }
.btn-buy:hover, .btn-sell:hover { filter: brightness(1.1); }
.btn-buy:active, .btn-sell:active { transform: scale(0.98); }

.order-msg { margin-top: 0.9rem; font-size: 0.9rem; min-height: 1.2rem; }
.order-msg.ok { color: var(--up); }
.order-msg.err { color: var(--down); }

/* ---------- Positions ---------- */
.pos-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.pnl-total { color: var(--text-muted); }

.table-wrap { overflow-x: auto; }
.positions-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.positions-table th, .positions-table td {
    text-align: right;
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
.positions-table th:first-child, .positions-table td:first-child { text-align: left; }
.positions-table th { color: var(--text-muted); font-weight: 600; }
.empty-row td { text-align: center; color: var(--text-muted); padding: 1.5rem; }

.pnl-neutral { color: var(--text-muted); }

.close-btn {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    transition: all 0.2s;
}
.close-btn:hover { color: var(--down); border-color: var(--down); }

/* ---------- Features ---------- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}
.feature-card {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform 0.2s, border-color 0.2s;
}
.feature-card:hover { transform: translateY(-4px); border-color: var(--accent-blue); }
.feat-icon { font-size: 2rem; margin-bottom: 0.8rem; }
.feature-card h3 { margin-bottom: 0.7rem; color: var(--accent-blue); }
.feature-card p { color: var(--text-muted); }

/* ---------- Platform ---------- */
.platform-section { text-align: center; }
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}
.platform-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
}
.platform-img { height: 54px; margin-bottom: 1rem; }
.platform-card h3 { margin-bottom: 0.6rem; }
.platform-card p { color: var(--text-muted); font-size: 0.95rem; }
code {
    background: var(--bg-elev);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85em;
}

/* ---------- Coming soon ---------- */
.coming-soon { text-align: center; }
.coming-card {
    background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(34,197,94,0.10));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    max-width: 760px;
    margin: 0 auto;
}
.soon-badge {
    display: inline-block;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--accent-blue);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
}
.coming-card h2 { font-size: 2rem; margin-bottom: 1rem; }
.coming-card p { color: var(--text-muted); max-width: 620px; margin: 0 auto 1rem; }
.soon-note { font-size: 0.9rem; opacity: 0.85; }

/* ---------- Footer ---------- */
footer {
    text-align: center;
    padding: 2.5rem 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    margin-top: 2rem;
    font-size: 0.9rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .trade-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2.4rem; }
    .market-status { display: none; }
    .nav-links a { margin-left: 1rem; font-size: 0.88rem; }
}
