/* ============================================================
   FinSentinel — Design System Tokens & Base Styles
   ============================================================ */

/* --- DESIGN TOKENS --- */
:root {
    /* Core Backgrounds */
    --bg-primary: #030712;
    --bg-secondary: #0a1122;
    --bg-elevated: rgba(17, 24, 39, 0.6);
    --bg-card: rgba(31, 41, 55, 0.4);
    --bg-card-solid: #111827;
    --bg-input: rgba(17, 24, 39, 0.8);

    /* Text */
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;

    /* Accent Colors */
    --color-emerald: #34d399;
    --color-emerald-soft: rgba(52, 211, 153, 0.15);
    --color-emerald-border: rgba(16, 185, 129, 0.3);

    --color-red: #ef4444;
    --color-red-soft: rgba(239, 68, 68, 0.15);
    --color-red-border: rgba(239, 68, 68, 0.3);

    --color-amber: #f59e0b;
    --color-amber-soft: rgba(245, 158, 11, 0.15);
    --color-amber-border: rgba(245, 158, 11, 0.3);

    --color-blue: #3b82f6;
    --color-blue-soft: rgba(59, 130, 246, 0.15);
    --color-blue-border: rgba(59, 130, 246, 0.3);

    --color-purple: #a855f7;
    --color-purple-soft: rgba(168, 85, 247, 0.15);
    --color-purple-border: rgba(168, 85, 247, 0.3);

    --color-cyan: #22d3ee;
    --color-cyan-soft: rgba(34, 211, 238, 0.15);

    /* Borders & Dividers */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(55, 65, 81, 0.8);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow-emerald: 0 0 12px rgba(52, 211, 153, 0.3);
    --shadow-glow-red: 0 0 12px rgba(239, 68, 68, 0.3);
    --shadow-glow-blue: 0 0 12px rgba(59, 130, 246, 0.3);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --text-xs: 0.6875rem;
    --text-sm: 0.75rem;
    --text-base: 0.8125rem;
    --text-md: 0.875rem;
    --text-lg: 1rem;
    --text-xl: 1.125rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;

    /* Transition */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Sidebar */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 56px;
}

/* --- RESET & BASE --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
    font-size: var(--text-md);
}

a {
    color: var(--color-blue);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

img, svg {
    display: inline-block;
    vertical-align: middle;
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    color: inherit;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    outline: none;
    transition: border-color var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 2px var(--color-blue-soft);
}

/* --- SCROLLBAR --- */
.custom-scrollbar {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* --- SHARED COMPONENTS --- */

/* Glass Panel */
.glass-panel {
    background: var(--bg-elevated);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transition: border-color var(--transition-base);
}

.glass-panel:hover {
    border-color: var(--border-strong);
}

/* Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    line-height: 1.4;
}

.badge--approve {
    background: var(--color-emerald-soft);
    color: var(--color-emerald);
    border-color: var(--color-emerald-border);
}

.badge--flag {
    background: var(--color-amber-soft);
    color: var(--color-amber);
    border-color: var(--color-amber-border);
}

.badge--block {
    background: var(--color-red-soft);
    color: var(--color-red);
    border-color: var(--color-red-border);
}

.badge--info {
    background: var(--color-blue-soft);
    color: var(--color-blue);
    border-color: var(--color-blue-border);
}

/* Progress Bar */
.progress-bar-bg {
    width: 100%;
    background: rgba(31, 41, 55, 1);
    height: 4px;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 500ms ease, background-color 500ms ease;
}

.progress-bar--emerald { background-color: var(--color-emerald); }
.progress-bar--red { background-color: var(--color-red); }
.progress-bar--blue { background-color: var(--color-blue); }
.progress-bar--amber { background-color: var(--color-amber); }

/* Indicator Dot */
.indicator-dot {
    height: 8px;
    width: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.indicator-dot--connected {
    background-color: var(--color-emerald);
    box-shadow: var(--shadow-glow-emerald);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.indicator-dot--disconnected {
    background-color: var(--color-red);
    box-shadow: var(--shadow-glow-red);
}

.indicator-dot--warning {
    background-color: var(--color-amber);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

/* Mono Value */
.mono {
    font-family: var(--font-mono);
}

/* Section Title */
.section-title {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 var(--space-md) 0;
}

/* --- ANIMATIONS --- */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes blockGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.1); }
    50% { box-shadow: 0 0 25px rgba(239, 68, 68, 0.25); }
}

@keyframes premiumGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(168, 85, 247, 0.2); }
    50% { box-shadow: 0 0 35px rgba(168, 85, 247, 0.4); }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Spinner */
.spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--text-dim);
    border-top-color: var(--color-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Empty / Waiting State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: var(--space-2xl);
    text-align: center;
    gap: var(--space-md);
    height: 100%;
}

.empty-state svg {
    opacity: 0.3;
}

.empty-state p {
    font-size: var(--text-sm);
}

/* --- UTILITY CLASSES --- */
.hidden { display: none !important; }
.text-emerald { color: var(--color-emerald); }
.text-red { color: var(--color-red); }
.text-amber { color: var(--color-amber); }
.text-blue { color: var(--color-blue); }
.text-purple { color: var(--color-purple); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }
