/* Polygoal Dashboard — custom styles */

:root {
    --pg-green: #22c55e;
    --pg-red: #ef4444;
    --pg-yellow: #eab308;
    --pg-blue: #3b82f6;
    --pg-purple: #a855f7;
    --pg-cyan: #06b6d4;
    --pg-muted: #6b7280;
}

body {
    font-size: 0.875rem;
}

/* Navbar brand */
.navbar-brand {
    letter-spacing: 0.05em;
    color: var(--pg-cyan) !important;
}

/* Tables */
.table-dashboard {
    font-size: 0.8125rem;
}

.table-dashboard th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pg-muted);
}

.table-dashboard th:hover {
    color: var(--pg-cyan);
}

.table-dashboard th .sort-icon::after {
    content: ' \2195';
    opacity: 0.4;
}

.table-dashboard th.sort-asc .sort-icon::after {
    content: ' \2191';
    opacity: 1;
}

.table-dashboard th.sort-desc .sort-icon::after {
    content: ' \2193';
    opacity: 1;
}

.table-dashboard tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.table-dashboard tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

/* Value colors */
.text-pnl-positive { color: var(--pg-green) !important; }
.text-pnl-negative { color: var(--pg-red) !important; }

/* Signal type badges */
.badge-entry { background-color: var(--pg-green) !important; }
.badge-exit { background-color: var(--pg-yellow) !important; color: #000 !important; }
.badge-full-exit { background-color: var(--pg-red) !important; }
.badge-cluster { background-color: var(--pg-purple) !important; }

/* Signal status badges */
.badge-confirmed { background-color: var(--pg-green) !important; }
.badge-skipped { background-color: var(--pg-red) !important; }
.badge-candidate, .badge-pending { background-color: var(--pg-yellow) !important; color: #000 !important; }

/* Metric cards */
.metric-card {
    text-align: center;
    padding: 1.25rem 1rem;
}

.metric-card .metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.metric-card .metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pg-muted);
    margin-top: 0.25rem;
}

.metric-card.primary {
    border-color: var(--pg-cyan) !important;
}

/* Score cards in trader detail */
.score-card {
    text-align: center;
    padding: 0.75rem;
}

.score-card .score-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.score-card .score-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pg-muted);
}

/* Wallet address monospace */
.wallet-addr {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
}

/* Truncate long usernames */
.username-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Filters row */
.filters-row {
    margin-bottom: 1rem;
}

.filters-row .form-select,
.filters-row .form-control {
    font-size: 0.8125rem;
}

/* Loading spinner */
.spinner-container {
    text-align: center;
    padding: 3rem;
}

/* Pagination */
.pagination .page-link {
    font-size: 0.8125rem;
}

/* Tabs in trader detail */
.nav-tabs .nav-link {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Live indicator */
.live-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--pg-green);
    animation: pulse 2s infinite;
    margin-right: 0.5rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--pg-muted);
}

/* Responsive table wrapper */
.table-responsive {
    border-radius: 0.375rem;
}

/* Trading tier badges */
.tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-badge.tier-disabled {
    background: #374151;
    color: #9ca3af;
}

.tier-badge.tier-shadow {
    background: #1e3a5f;
    color: #93c5fd;
}

.tier-badge.tier-prerelease {
    background: #14532d;
    color: #86efac;
}

.tier-badge.tier-monitoring {
    background: #374151;
    color: #d1d5db;
}

.tier-badge.tier-live {
    background: #7c2d12;
    color: #fdba74;
}

/* Recommendation badges */
.badge.rec-promote {
    background: #14532d;
    color: #86efac;
}

.badge.rec-demote {
    background: #7f1d1d;
    color: #fca5a5;
}

.badge.rec-hold {
    background: #1e3a5f;
    color: #93c5fd;
}

.badge.rec-watch {
    background: #713f12;
    color: #fde68a;
}

.badge.rec-collect {
    background: #374151;
    color: #9ca3af;
}

/* Tier select dropdown */
.tier-select {
    background: #1f2937;
    color: #e5e7eb;
    border: 1px solid #374151;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8rem;
    cursor: pointer;
}

.tier-select:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Tier filter tabs */
.tier-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: #1f2937;
    border-radius: 8px;
    padding: 4px;
    width: fit-content;
}

.tier-tab {
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}

.tier-tab:hover {
    color: #e5e7eb;
}

.tier-tab.active {
    background: #3b82f6;
    color: #ffffff;
}

/* Refresh indicator */
.refresh-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
}

.refresh-pulse {
    font-size: 0.6rem;
    color: #4b5563;
    transition: color 0.3s;
}

.refresh-pulse.active {
    color: #22c55e;
    animation: pulse-fade 1s ease-out;
}

.refresh-pulse.error {
    color: #ef4444;
}

.refresh-pulse.loading {
    color: #f59e0b;
    animation: pulse-blink 0.5s infinite;
}

@keyframes pulse-fade {
    0% { color: #22c55e; transform: scale(1.5); }
    100% { color: #4b5563; transform: scale(1); }
}

@keyframes pulse-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.refresh-time {
    color: #6b7280;
}

/* Loading state with animated spinner */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: #9ca3af;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #374151;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tab loading overlay */
.tab-loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

/* Nav active state — more visible */
.navbar-nav .nav-link.active {
    color: #ffffff !important;
    font-weight: 600;
    border-bottom: 2px solid var(--pg-blue);
    padding-bottom: calc(0.5rem - 2px);
}

/* Pipeline health dot */
.health-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #6b7280;
    transition: background-color 0.3s;
    text-decoration: none;
}

.health-dot.health-ok {
    background-color: var(--pg-green);
}

.health-dot.health-degraded {
    background-color: var(--pg-yellow);
    animation: pulse 2s infinite;
}

.health-dot.health-down {
    background-color: var(--pg-red);
    animation: pulse 1s infinite;
}

/* PnL color classes (reinforced) */
.pnl-positive { color: var(--pg-green) !important; }
.pnl-negative { color: var(--pg-red) !important; }
.pnl-zero { color: var(--pg-muted) !important; }

/* Metric card tooltip cursor */
.metric-card[title],
.score-card[title] {
    cursor: help;
}

/* Command Center — Status bar */
.status-bar {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border: 1px solid #374151;
    background: #1f2937;
}

.status-bar.mode-live {
    border-left: 4px solid var(--pg-red);
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.3);
}

.status-bar.mode-warn {
    border-left: 4px solid var(--pg-yellow);
    background: rgba(234,179,8,0.08);
    border-color: rgba(234,179,8,0.3);
}

.status-bar.mode-ready {
    border-left: 4px solid var(--pg-green);
    background: rgba(34,197,94,0.08);
    border-color: rgba(34,197,94,0.3);
}

.status-bar.mode-paper {
    border-left: 4px solid var(--pg-muted);
    background: rgba(107,114,128,0.08);
    border-color: rgba(107,114,128,0.3);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pg-muted);
    margin-right: 6px;
    vertical-align: middle;
}

.mode-live .status-dot {
    background: var(--pg-red);
    animation: pulse 1s infinite;
}

.mode-warn .status-dot {
    background: var(--pg-yellow);
    animation: pulse 2s infinite;
}

.mode-ready .status-dot {
    background: var(--pg-green);
}

.adapt-toggle {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--pg-muted);
    border: 1px solid #374151;
    border-radius: 4px;
    padding: 2px 8px;
    transition: color 0.15s, border-color 0.15s;
}

.adapt-toggle:hover {
    color: var(--pg-cyan);
    border-color: var(--pg-cyan);
}

/* Condition pills */
.condition-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 6px;
}

.condition-pill.ok {
    background: rgba(34,197,94,0.15);
    color: var(--pg-green);
}

.condition-pill.fail {
    background: rgba(239,68,68,0.15);
    color: var(--pg-red);
}

.kill-btn {
    font-size: 0.8rem;
}

/* Shadow Copy page — specific styles */
.num {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.8125rem;
}

.shadow-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--pg-muted);
    font-weight: 700;
    padding: 6px 12px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.shadow-metric-row {
    display: flex;
    gap: 8px;
}

.shadow-metric-row > * {
    flex: 1;
    min-width: 0;
}

.shadow-metric-row .metric-card .metric-value {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
}

.rec-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rec-keep    { background: rgba(34, 197, 94, 0.15);   color: var(--pg-green); }
.rec-monitor { background: rgba(234, 179, 8, 0.15);   color: var(--pg-yellow); }
.rec-demote  { background: rgba(239, 68, 68, 0.15);   color: var(--pg-red); }
.rec-na      { background: rgba(107, 114, 128, 0.15); color: var(--pg-muted); }

.trade-open td { opacity: 0.8; }

/* Pure-CSS tooltips via data-tooltip attribute */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: #e5e7eb;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    white-space: normal;
    width: 240px;
    text-align: left;
    line-height: 1.5;
    border: 1px solid #374151;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1050;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

.condition-pill[data-tooltip]::after {
    width: 220px;
}

/* Tooltip indicator on table header spans */
.table-dashboard th span[data-tooltip] {
    border-bottom: 1px dashed rgba(107, 114, 128, 0.45);
    cursor: help;
}

/* Status bar inline tooltips */
.status-bar span[data-tooltip] {
    cursor: help;
}

