/* ═══════════════════════════════════════════
   QuietAlpha - Design System
   ═══════════════════════════════════════════ */

/* ---------- Base ---------- */
body {
    background-color: #0b0f19;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Logo Mark ---------- */
.qa-logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #00d4aa, #00b894);
    color: #0b0f19;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}
.qa-logo-mark.text-xs {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.6rem;
    border-radius: 0.375rem;
}
.qa-logo-mark.text-lg {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.25rem;
    border-radius: 0.75rem;
}

/* ---------- Desktop Navbar ---------- */
.navbar-qa {
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(30, 38, 54, 0.8);
}

.nav-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 0.375rem;
    transition: all 0.15s ease;
    text-decoration: none;
}
.nav-link:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.05);
}
.nav-link.nav-active {
    color: #00d4aa;
    background: rgba(0, 212, 170, 0.08);
}

/* ---------- Mobile Bottom Nav ---------- */
.mobile-nav {
    background: rgba(11, 15, 25, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(30, 38, 54, 0.8);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
    transition: color 0.15s ease;
    min-width: 3.5rem;
}
.mobile-nav-item:hover,
.mobile-nav-item:active {
    color: rgba(255, 255, 255, 0.7);
}
.mobile-nav-active {
    color: #00d4aa !important;
}

/* ---------- Cards ---------- */
.card-dark {
    background-color: #141925;
    border: 1px solid #1e2636;
    border-radius: 0.75rem;
}

/* ---------- Signal Card Borders ---------- */
.signal-hold { border-left: 3px solid #3b82f6; }
.signal-long { border-left: 3px solid #00d4aa; }
.signal-close { border-left: 3px solid #ef4444; }
.signal-defensif { border-left: 3px solid #f59e0b; }
.signal-offensif { border-left: 3px solid #00d4aa; }

/* ---------- Hero Banners ---------- */
.hero-ok {
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.08), rgba(0, 212, 170, 0.02));
    border: 1px solid rgba(0, 212, 170, 0.2);
}
.hero-action {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.02));
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.hero-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.02));
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ---------- KPI Row ---------- */
.kpi-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.kpi-item {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 0.75rem 0.5rem;
}

/* ---------- Login ---------- */
.login-glow {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 212, 170, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.login-card {
    background: rgba(20, 25, 37, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(30, 38, 54, 0.8);
    border-radius: 1rem;
    padding: 2rem;
}

.input-qa {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid #1e2636;
    border-radius: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s ease;
}
.input-qa:focus {
    border-color: #00d4aa;
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.15);
    outline: none;
}
.input-qa:focus-visible {
    outline: none;
}
.input-qa::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.btn-qa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.5rem;
    background: linear-gradient(135deg, #00d4aa, #00b894);
    color: #0b0f19;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-qa:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.25);
}
.btn-qa:active {
    transform: translateY(0);
}

/* ---------- HTMX Loading ---------- */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

/* ---------- Chart Containers ---------- */
.sparkline-container { height: 100px; width: 100%; }
.chart-sm { height: 120px; }
.chart-md { height: 300px; }
.chart-lg { height: 400px; }
.chart-donchian { height: 280px; }
.sparkline-mini { height: 40px; width: 100%; overflow: hidden; }

/* ---------- Chat Bubbles ---------- */
.chat-user {
    background-color: #1e2636;
    border-radius: 1rem 1rem 0.25rem 1rem;
    max-width: 80%;
    margin-left: auto;
}
.chat-assistant {
    background-color: #141925;
    border: 1px solid #1e2636;
    border-radius: 1rem 1rem 1rem 0.25rem;
    max-width: 80%;
}

/* ---------- Toast Animations ---------- */
.toast-enter {
    animation: slideIn 0.3s ease-out;
}
.toast-exit {
    animation: slideOut 0.3s ease-in forwards;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ---------- Metric Grid ---------- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

/* ---------- Regime Badge ---------- */
.regime-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* ---------- Responsive Table ---------- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---------- Responsive Tabs (mobile) ---------- */
@media (max-width: 640px) {
    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .tabs .tab {
        flex-shrink: 0;
        font-size: 0.8rem;
        padding-inline: 0.5rem;
    }
    .metrics-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* ---------- Markdown Content ---------- */
.prose-dark {
    color: #cbd5e1;
}
.prose-dark h1, .prose-dark h2, .prose-dark h3 {
    color: #f1f5f9;
}
.prose-dark code {
    background: #1e2636;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}
.prose-dark pre {
    background: #0b0f19;
    border: 1px solid #1e2636;
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
}
.prose-dark a {
    color: #00d4aa;
}
.prose-dark table {
    width: 100%;
    border-collapse: collapse;
}
.prose-dark th, .prose-dark td {
    border: 1px solid #1e2636;
    padding: 0.5rem;
}
.prose-dark th {
    background: #141925;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #1e2636;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #2a3345;
}
