:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --border: #334155;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg-dark); color: var(--text-main); height: 100vh; display: flex; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 100; display: none; justify-content: center; align-items: center; }
.modal-content { background: var(--bg-card); padding: 40px; border-radius: 12px; border: 1px solid var(--border); width: 400px; text-align: center; }
.modal-content h2 { margin-bottom: 20px; color: var(--accent); }
.modal-content p { color: var(--text-muted); margin-bottom: 20px; font-size: 0.9rem; line-height: 1.5; }
.modal-content ol { text-align: left; margin: 0 auto 20px; padding-left: 20px; color: var(--text-muted); font-size: 0.9rem; }
.modal-content li { margin-bottom: 8px; }
.modal-content a { color: var(--accent); }
.modal-content .small { font-size: 0.75rem; opacity: 0.5; margin-top: 15px; }

/* Sidebar */
.sidebar { width: 250px; background: var(--bg-card); padding: 20px; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.logo { font-size: 1.5rem; font-weight: bold; margin-bottom: 40px; color: white; display:flex; align-items: center; gap: 10px; }
.badge { background: var(--accent); font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; color: white; }
nav a { display: block; padding: 12px; color: var(--text-muted); text-decoration: none; border-radius: 8px; margin-bottom: 5px; transition: 0.2s; }
nav a:hover, nav a.active { background: var(--border); color: white; }

/* Main Content */
.main-content { flex: 1; padding: 30px; overflow-y: auto; }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.api-status { font-size: 0.9rem; color: var(--success); display: flex; align-items: center; gap: 8px; }
.dot { height: 8px; width: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 8px var(--success); }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.card { background: var(--bg-card); padding: 20px; border-radius: 12px; border: 1px solid var(--border); position: relative; }
.card h3 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 10px; font-weight: normal; }
.card .value { font-size: 1.8rem; font-weight: bold; }
.value.highlight { color: var(--accent); }

/* Content Grid */
.content-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }

/* Forms & Search */
.form-group { margin-bottom: 15px; position: relative; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-muted); }
input { width: 100%; padding: 12px; background: #0f172a; border: 1px solid var(--border); color: white; border-radius: 6px; font-size: 1rem; }
input:focus { outline: none; border-color: var(--accent); }
.price-display { font-size: 1.5rem; font-weight: bold; margin-bottom: 5px; }

/* Search Results Dropdown */
.search-results {
    list-style: none;
    position: absolute;
    top: 100%; left: 0; width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.hidden { display: none; }
.search-results li {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #334155;
    font-size: 0.9rem;
    display: flex; justify-content: space-between;
}
.search-results li:hover { background: #334155; }
.search-results li span { color: var(--text-muted); font-size: 0.8rem; }

/* Buttons */
.trade-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
button { padding: 12px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; color: white; transition: 0.2s; width: 100%; }
button:hover { opacity: 0.9; }
.btn-buy { background: var(--success); }
.btn-sell { background: var(--danger); }

/* Table */
.portfolio-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.portfolio-table th { text-align: left; padding: 10px; color: var(--text-muted); font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.portfolio-table td { padding: 15px 10px; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }

/* Mobile */
@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; padding: 10px; flex-direction: row; justify-content: space-between; }
    .logo { margin-bottom: 0; }
    .stats-grid, .content-grid { grid-template-columns: 1fr; }
    .modal-content { width: 90%; }
}