/* ============================================================
   AlphaScout Admin — Design System
   Strategy: pre-built Tailwind base + manual utility classes
   NO JIT CDN. All new utilities defined here or in base.html
   ============================================================ */

/* ── Design Tokens ── */
/* TASK-D (2026-06-18): hide Alpine x-cloak elements before Alpine loads */
[x-cloak] { display: none !important; }

:root {
    --brand:        #6366f1;
    --brand-2:      #8b5cf6;
    --brand-hover:  #4f46e5;
    --cyan:         #06b6d4;
    --cyan-2:       #00f2fe;
    --success:      #10b981;
    --danger:       #f43f5e;
    --warning:      #f59e0b;
    --bg:           #0d1322;
    --bg-panel:     rgba(23, 33, 56, 0.85);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-dim:   rgba(255, 255, 255, 0.05);
    --text-primary: #f1f5f9;
    --text-muted:   #94a3b8;
    --text-faint:   #64748b;
    --glow-brand:   0 0 20px rgba(99, 102, 241, 0.35);
    --glow-success: 0 0 16px rgba(16, 185, 129, 0.35);
    --glow-danger:  0 0 16px rgba(244, 63, 94, 0.35);
    --glow-cyan:    0 0 16px rgba(6, 182, 212, 0.35);
    --radius-card:  14px;
    --radius-pill:  999px;
    --blur-glass:   16px;
    --font-ui:      'Inter', system-ui, sans-serif;
    --font-display: 'Outfit', 'Inter', system-ui, sans-serif;
}

/* ── Global Reset Extras ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-ui);
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99, 102, 241, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 90% 80%, rgba(6, 182, 212, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 10% 40%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
    min-height: 100vh;
    color: var(--text-primary);
}

/* ── Custom Scrollbars ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(15, 20, 35, 0.6); }
::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.4); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.7); }
* { scrollbar-width: thin; scrollbar-color: rgba(99,102,241,0.4) rgba(15,20,35,0.6); }

/* ── Glass Card ── */
.glass-card {
    background: var(--bg-panel);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-card);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ── Glow Utilities ── */
.glow-brand   { box-shadow: var(--glow-brand); }
.glow-success { box-shadow: var(--glow-success); }
.glow-danger  { box-shadow: var(--glow-danger); }
.glow-cyan    { box-shadow: var(--glow-cyan); }

/* ── Gradient Text ── */
.text-gradient-brand {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 50%, var(--cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Navigation (glassmorphic) ── */
.nav-glass {
    background: rgba(8, 12, 20, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 20px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-link {
    position: relative;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.375rem 0.625rem;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
    letter-spacing: 0.01em;
}
.nav-link:hover {
    color: #fff;
    background: rgba(99, 102, 241, 0.1);
}
.nav-link.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    border-radius: 2px 2px 0 0;
}

/* Nav icon */
.nav-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 5px;
    opacity: 0.8;
    vertical-align: -2px;
}

/* ── Bot Online Indicator ── */
.bot-online-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--success); }
    50%       { opacity: 0.55; box-shadow: 0 0 14px var(--success); }
}
/* Status modifiers: honest health indicator (no fake "always green"). */
.bot-online-dot.is-unknown {
    background: #9ca3af;          /* gray: status not yet known */
    box-shadow: 0 0 6px #9ca3af;
    animation: none;
}
.bot-online-dot.is-offline {
    background: #f87171;          /* red: /health failed */
    box-shadow: 0 0 6px #f87171;
    animation: none;
}

/* ── Logo ── */
.logo-text {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.03em;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 60%, var(--cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── KPI Cards ── */
.kpi-card {
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.kpi-card.kpi-pnl::before    { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.kpi-card.kpi-winrate::before { background: linear-gradient(90deg, var(--success), var(--cyan)); }
.kpi-card.kpi-bets::before    { background: linear-gradient(90deg, var(--cyan), var(--brand)); }
.kpi-card.kpi-signals::before { background: linear-gradient(90deg, var(--brand-2), var(--warning)); }

.kpi-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.kpi-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
    line-height: 1;
    letter-spacing: -0.03em;
}
.kpi-sub {
    font-size: 0.7rem;
    color: var(--text-faint);
    margin-top: 0.375rem;
}
.kpi-icon-bg {
    position: absolute;
    top: 1rem; right: 1rem;
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: var(--brand);
}

/* ── Chart containers ── */
.chart-container {
    position: relative;
}

/* ── Status Pills ── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
}
.status-pill::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-pill-won {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}
.status-pill-won::before { background: var(--success); box-shadow: 0 0 4px var(--success); }

.status-pill-lost {
    background: rgba(244, 63, 94, 0.12);
    color: #fb7185;
    border-color: rgba(244, 63, 94, 0.3);
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.15);
}
.status-pill-lost::before { background: var(--danger); box-shadow: 0 0 4px var(--danger); }

.status-pill-active {
    background: rgba(6, 182, 212, 0.12);
    color: #22d3ee;
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.1);
}
.status-pill-active::before { background: var(--cyan); box-shadow: 0 0 4px var(--cyan); animation: pulse-dot 2s ease-in-out infinite; }

.status-pill-resolved {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    border-color: rgba(100, 116, 139, 0.25);
}
.status-pill-resolved::before { background: #64748b; }

.status-pill-filled,
.status-pill-paper {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.1);
}
.status-pill-filled::before,
.status-pill-paper::before { background: var(--brand); box-shadow: 0 0 4px var(--brand); animation: pulse-dot 2.5s ease-in-out infinite; }

.status-pill-paper_won {
    background: rgba(16, 185, 129, 0.08);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.2);
}
.status-pill-paper_won::before { background: #6ee7b7; }

.status-pill-paper_lost {
    background: rgba(244, 63, 94, 0.08);
    color: #fda4af;
    border-color: rgba(244, 63, 94, 0.2);
}
.status-pill-paper_lost::before { background: #fda4af; }

/* ── Table rows ── */
tr { transition: background-color 180ms ease; }

.signal-row:hover {
    background: rgba(99, 102, 241, 0.06) !important;
    box-shadow: inset 3px 0 0 var(--brand);
}

/* ── Signal Drawer animation ── */
@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}
.drawer-animate {
    animation: slide-in-right 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* ── Signal Drawer metric cards ── */
.metric-mini-card {
    background: rgba(15, 20, 35, 0.7);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 0.75rem;
    transition: border-color 0.2s ease;
}
.metric-mini-card:hover { border-color: rgba(99, 102, 241, 0.25); }
.metric-label { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.metric-value { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; margin-top: 0.25rem; color: var(--text-primary); }
.metric-value-accent { color: var(--success); }
.metric-value-edge { font-size: 1.2rem; color: var(--success); }

.reasoning-block {
    background: rgba(8, 12, 20, 0.8);
    border: 1px solid var(--border-glass);
    border-left: 2px solid var(--brand);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.75rem;
    line-height: 1.7;
    color: #cbd5e1;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* ── Range Inputs ── */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 99px;
    background: rgba(99, 102, 241, 0.2);
    outline: none;
    cursor: pointer;
    border: none;
    padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.6), 0 0 0 2px rgba(99, 102, 241, 0.2);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.8), 0 0 0 3px rgba(99, 102, 241, 0.25);
    transform: scale(1.15);
}
input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
    border: none;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 99px;
}
input[type="range"]::-moz-range-track {
    height: 4px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 99px;
}

/* ── HTMX indicators ── */
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }

/* ── Skeleton loader (for HTMX) ── */
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, rgba(30,40,60,0.5) 25%, rgba(50,65,90,0.6) 50%, rgba(30,40,60,0.5) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}

/* ── Button — Primary Glow ── */
.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
    transition: box-shadow 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
    position: relative;
    overflow: hidden;
    display: inline-flex;      /* TASK-C (2026-06-18): center text in fixed-height buttons */
    align-items: center;
    justify-content: center;
}
.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
    border-radius: inherit;
}
.btn-primary:hover {
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.55);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* ── Chart period buttons (moved from dashboard.html inline <style>, R1 2026-07-17) ── */
.chart-period-btn {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
    border-radius: 0.25rem !important;
    background: rgba(15, 22, 40, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: var(--text-muted) !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    outline: none !important;
    box-shadow: none !important;
}
.chart-period-btn:hover {
    border-color: rgba(99, 102, 241, 0.4) !important;
    color: #fff !important;
}
.chart-period-btn.active {
    background: rgba(99, 102, 241, 0.2) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
    color: #a5b4fc !important;
}

/* ── Focus states for inputs ── */
select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2), 0 0 12px rgba(99, 102, 241, 0.15);
}

/* ── Alert / notification strip ── */
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}
.alert-error {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fda4af;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

/* ── Section header ── */
.section-header {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.section-sub {
    font-size: 0.8rem;
    color: var(--text-faint);
    margin-top: 0.25rem;
}

/* ── Misc helper classes ── */
.backdrop-blur-md {
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
}

.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.mr-6  { margin-right: 1.5rem; }
.mt-2  { margin-top: 0.5rem; }
.mt-3  { margin-top: 0.75rem; }
.mt-4  { margin-top: 1rem; }
.mt-5  { margin-top: 1.25rem; }
.mt-6  { margin-top: 1.5rem; }
.mb-2  { margin-bottom: 0.5rem; }
.mb-3  { margin-bottom: 0.75rem; }
.mb-5  { margin-bottom: 1.25rem; }
.mb-8  { margin-bottom: 2rem; }
.p-3   { padding: 0.75rem; }
.p-4   { padding: 1rem; }
.p-8   { padding: 2rem; }
.px-2  { padding-left: 0.5rem; padding-right: 0.5rem; }
.pb-3  { padding-bottom: 0.75rem; }
.col-span-2 { grid-column: span 2 / span 2; }
.flex-shrink-0 { flex-shrink: 0; }
.leading-relaxed { line-height: 1.625; }
.font-medium { font-weight: 500; }
.text-base { font-size: 1rem; line-height: 1.5; }
.mx-auto { margin-left: auto; margin-right: auto; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.tracking-wider { letter-spacing: 0.08em; }

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ── Custom Profile Menu & Dropdown (Strict CSS overrides, NO Tailwind utility dependency) ── */
.profile-menu-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    color: #cbd5e1 !important;
    transition: background-color 0.2s ease, color 0.2s ease !important;
    box-shadow: none !important;
    outline: none !important;
}
.profile-menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
}

.profile-avatar-circle {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background-color: #6366f1 !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3) !important;
    overflow: hidden !important;
}

.profile-dropdown-menu {
    position: absolute !important;
    right: 0 !important;
    margin-top: 8px !important;
    width: 220px !important;
    border-radius: 12px !important;
    background-color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5) !important;
    padding: 8px !important;
    z-index: 1000 !important;
    /* display managed by Alpine x-show -- no CSS override here (TASK-D 2026-06-18) */
}

.profile-dropdown-header {
    padding: 8px 12px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    margin-bottom: 6px !important;
    text-align: left !important;
}

.profile-dropdown-header-title {
    font-size: 0.65rem !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    font-weight: 600 !important;
}

.profile-dropdown-header-email {
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    color: #f1f5f9 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    margin-top: 2px !important;
}

.profile-dropdown-item {
    width: 100% !important;
    text-align: left !important;
    background: transparent !important;
    border: none !important;
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
    color: #94a3b8 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease, color 0.15s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: none !important;
    outline: none !important;
}

.profile-dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

.profile-dropdown-item-logout {
    color: #f87171 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    margin-top: 4px !important;
    padding-top: 8px !important;
    border-radius: 0 !important;
}

.profile-dropdown-item-logout:hover {
    background-color: rgba(248, 113, 113, 0.08) !important;
    color: #fca5a5 !important;
    border-radius: 6px !important;
}

/* ── Custom Tab System (Strict CSS overrides, NO Tailwind utility dependency) ── */
.tab-container-custom {
    display: flex !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    gap: 1.5rem !important;
}

.tab-btn-custom {
    background: transparent !important;
    border: none !important;
    padding-top: 0.85rem !important;
    padding-bottom: 0.85rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: #64748b !important;
    cursor: pointer !important;
    transition: color 0.2s ease, border-color 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    position: relative !important;
    outline: none !important;
    box-shadow: none !important;
}

.tab-btn-custom:hover {
    color: #cbd5e1 !important;
}

.tab-btn-custom.active-tab {
    color: #ffffff !important;
    font-weight: 600 !important;
}

.tab-btn-custom.active-tab::after {
    content: '' !important;
    position: absolute !important;
    bottom: -1px !important;
    left: 0 !important;
    right: 0 !important;
    height: 2px !important;
    background: var(--brand) !important;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5) !important;
    border-radius: 2px 2px 0 0 !important;
}
