:root {
    --bg-app: #0f1115;
    --bg-card: #181b21;
    --bg-card-hover: #1e2229;
    --border-color: #2a2e36;
    --text-primary: #e0e0e0;
    --text-secondary: #9ca3af;
    --accent-color: #3b82f6;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

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

.logo-icon {
    font-size: 24px;
}

h1 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    font-size: 11px;
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-controls {
    display: flex;
    gap: 24px;
    align-items: center;
}

.symbol-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.symbol-display .label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.symbol-display .value {
    font-weight: 700;
    font-size: 16px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success-color);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    transition: transform 0.2s, border-color 0.2s;
}

.metric-card:hover {
    border-color: #3f444e;
    transform: translateY(-1px);
}

.metric-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.metric-value {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.metric-value.large {
    font-size: 24px;
}

.metric-value-group {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 20px;
    font-weight: 600;
}

.metric-value-group .separator {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 16px;
}

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

.mono {
    font-family: var(--font-mono);
}

/* Colors */
.ok { color: var(--success-color); }
.bad { color: var(--danger-color); }
.warn { color: var(--warning-color); }
.bid { color: #ef5350; } /* Red for Sell/Bid */
.ask { color: #26a69a; } /* Green for Buy/Ask */

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Chart Section */
.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    height: 500px;
}

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

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.chart-controls {
    display: flex;
    gap: 16px;
    align-items: center;
}

#chart-container {
    flex: 1;
    width: 100%;
    min-height: 0;
}

/* Trading Panel */
.trading-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="number"], input[type="text"] {
    background: #0f1115;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

.btn {
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-buy {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-color);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-buy:hover {
    background: rgba(34, 197, 94, 0.25);
}

.btn-sell {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-sell:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-secondary {
    background: #2a2e36;
    color: var(--text-primary);
}

.btn-price {
    font-family: var(--font-mono);
    font-size: 12px;
    opacity: 0.8;
}

/* Tables */
.tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .tables-grid {
        grid-template-columns: 1fr;
    }
}

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

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

.data-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #23272e;
    white-space: nowrap;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.empty-state {
    text-align: center;
    padding: 32px !important;
    color: var(--text-secondary);
    font-style: italic;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    width: 36px;
    height: 20px;
    background-color: #2a2e36;
    border-radius: 20px;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .3s;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(16px);
}

.toggle-switch .label {
    font-size: 13px;
    color: var(--text-secondary);
}

.select-control {
    background: #0f1115;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Action Buttons in Table */
.action-btn {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    background: #2a2e36;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    margin-right: 4px;
}

.action-btn:hover {
    background: #3f444e;
}

.action-btn.danger {
    color: var(--danger-color);
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
}

.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}
