/* Praxis Dashboard - Mobile-First Dark Theme */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-hover: #22222e;
    --text-primary: #ffffff;
    --text-secondary: #8888a0;
    --text-muted: #555566;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --border: #2a2a3a;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
    padding-bottom: 80px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 100;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.version {
    font-size: 12px;
    color: var(--text-muted);
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 16px 0;
}

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

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-value.positive { color: var(--success); }
.stat-value.negative { color: var(--danger); }
.stat-value.warning { color: #f59e0b; }
.stat-value.neutral { color: var(--text-primary); }
.stat-value.dim { color: var(--text-muted); }

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

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

/* Mode Badge */
.mode-badge {
    text-align: center;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    margin: 16px 0;
}

.mode-badge.dry-run {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.mode-badge.live {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 12px;
    margin: 16px 0;
}

.tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.position-header, .signal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.token-symbol {
    font-size: 18px;
    font-weight: 700;
}

.position-details, .signal-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.toast {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    pointer-events: auto;
}

.toast.success {
    background: var(--success);
    color: white;
}

.toast.error {
    background: var(--danger);
    color: white;
}

.toast.info {
    background: var(--accent);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Scrollbar - Modern, minimal, translucent */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 110, 140, 0.2);
    border-radius: 4px;
    border: 1px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 110, 140, 0.5);
    border: 1px solid transparent;
    background-clip: padding-box;
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 110, 140, 0.3) transparent;
}

@keyframes pulse-danger {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.trade-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.trade-row.buy {
    border-left: 3px solid var(--success);
}

.trade-row.sell {
    border-left: 3px solid var(--danger);
}

/* Responsive */
@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .btn {
        min-width: calc(50% - 6px);
    }
    
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
}

/* ============================================
   Protocol Identifier Badges
   When adding new protocols, add a .proto-<name> class.
   ============================================ */

.protocol-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* PumpFun — blue/indigo */
.proto-pumpfun {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.35);
}

/* PumpSwap — teal/cyan */
.proto-pumpswap {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.35);
}

/* Mayhem — orange/amber */
.proto-mayhem {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Unknown / future protocols — grey */
.proto-unknown {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.35);
}

@media (max-width: 400px) {
}

@media (max-width: 400px) {
}

@media (max-width: 600px) {
}

@media (max-width: 400px) {
}

@media (max-width: 600px) {
}

@media (max-width: 400px) {
}

.strategy-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s ease;
}

.strategy-card.active {
    border-color: var(--success);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.2);
}

.strategy-card.inactive {
    opacity: 0.6;
    border-color: var(--text-muted);
}

@media (max-width: 500px) {
}

/* ==================== STRATEGY DETAIL VIEW ==================== */

.strategy-detail {
    padding: 0;
}

.strategy-detail.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

/* Badge for counts */
.badge {
    display: inline-block;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* Strategy card clickable cursor */
.strategy-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.strategy-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* New trade highlight animation */
@keyframes newTradeHighlight {
    0% {
        background: rgba(99, 102, 241, 0.3);
        transform: scale(1.02);
    }
    100% {
        background: var(--bg-card);
        transform: scale(1);
    }
}

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

/* Fade out animation for deleted items */
@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

/* ── King of the Hill ─────────────────────────────── */
.king-section {
    margin: 8px 0;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--warning);
    border-radius: 12px;
    position: relative;
}
.king-section.inactive {
    border-color: var(--border);
    opacity: 0.6;
}
.king-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.king-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--warning);
}
.king-mode-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}
.king-mode-badge.auto { background: var(--success); color: #000; }
.king-mode-badge.manual { background: var(--accent); color: #fff; }
.king-pnl {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin: 6px 0;
}
.king-pnl.positive { color: var(--success); }
.king-pnl.negative { color: var(--danger); }
.king-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.king-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}
.king-alert-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--warning);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 13px;
    color: var(--warning);
    z-index: 999;
    animation: kingFadeInOut 4s ease forwards;
}
@keyframes kingFadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* King⇄Shadow view switch (_kcViewSwitchBtn, king-core.js) — the VIEW KING
   button on the King's Shadow page and VIEW SHADOW on the king page, inside
   the .king-mode-section chrome bar. Card-level surface so it reads as a
   button on the bar: the old inline style used --bg-tertiary (#141414),
   nearly identical to the bar's --bg-secondary (#12121a), leaving the
   control invisible. Hover/active/focus states need a class — inline styles
   cannot carry pseudo-classes. */
.kc-view-switch {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    white-space: nowrap;
    /* Mobile: the seat chrome bar wraps (flex-wrap on .king-mode-section);
       the button itself must never be crushed into a stacked two-line chip —
       it keeps its single-line width and wraps to its own row instead. */
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.kc-view-switch:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent-hover);
}
.kc-view-switch:active {
    transform: translateY(1px);
}
.kc-view-switch:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
/* Right-anchor when the switch is the bar's only trailing control (the
   shadow page); on the king page it trails the seat facts / RECONCILE. */
.kc-view-switch-right {
    margin-left: auto;
}
