/* Custom overrides on top of Tailwind */

.tab-btn {
    color: #6b7785;
    border: 1px solid transparent;
    transition: all 150ms;
}
.tab-btn:hover {
    color: #e5e7eb;
    background: #1f262d;
}
.tab-btn.active {
    color: #e5e7eb;
    background: #1f262d;
    border-color: #2c3540;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-watching { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.status-activated { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.status-confirmed { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.status-traded { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.status-invalidated, .status-trade_invalidated, .status-trade_failed { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.status-stopped, .status-skipped_pair_collision { background: rgba(107, 119, 133, 0.2); color: #9ca3af; }
.status-waiting_targets { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.status-waiting_position { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }

input[type="text"], input[type="number"], input[type="password"], select {
    color: #e5e7eb;
}
input[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.editable-field {
    background: #0b0d10;
    border: 1px solid #1f262d;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    width: 100%;
}
.editable-field:focus {
    outline: none;
    border-color: #3b82f6;
}

table.detail-table { width: 100%; font-size: 13px; }
table.detail-table td { padding: 4px 8px; vertical-align: top; }
table.detail-table td:first-child { color: #6b7785; width: 140px; }

button.action-btn {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    transition: all 150ms;
}
button.action-btn-danger {
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
button.action-btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}
button.action-btn-primary {
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
}
button.action-btn-primary:hover {
    background: rgba(59, 130, 246, 0.15);
}

/* History sub-tabs + log service buttons share the look */
.subtab-btn, .logsvc-btn {
    color: #6b7785;
    border: 1px solid transparent;
    transition: all 150ms;
    background: transparent;
}
.subtab-btn:hover, .logsvc-btn:hover {
    color: #e5e7eb;
    background: #1f262d;
}
.subtab-btn.active, .logsvc-btn.active {
    color: #e5e7eb;
    background: #1f262d;
    border-color: #2c3540;
}

/* History tables */
table.history-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}
table.history-table thead th {
    text-align: left;
    color: #6b7785;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    border-bottom: 1px solid #1f262d;
    background: #13171b;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
}
table.history-table thead th:hover { color: #e5e7eb; }
table.history-table thead th.sort-asc::after { content: " ▲"; color: #3b82f6; }
table.history-table thead th.sort-desc::after { content: " ▼"; color: #3b82f6; }
table.history-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid #1a1f25;
    vertical-align: top;
}
table.history-table tbody tr:hover { background: rgba(31, 38, 45, 0.4); }
table.history-table tbody tr:last-child td { border-bottom: none; }

/* Loading spinner — used on first-load of Active Trades (and any future tab
   needing an initial fetch indicator). The wrapper div toggles `hidden` via JS. */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #1f262d;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Log viewer */
.logs-pane {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #d1d5db;
    white-space: pre;
    overflow: auto;
    max-height: calc(100vh - 280px);
    min-height: 400px;
}
