/* ═══════════════════════════════════════════════════════════════════════════
   HyperFlow — Dark Trading Terminal Theme
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Base palette */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2332;
    --bg-card: #151c2c;
    --bg-card-hover: #1c2640;
    --bg-input: #0d1321;

    /* Borders */
    --border-primary: #1e293b;
    --border-secondary: #2d3a4f;
    --border-accent: #3b82f6;

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #60a5fa;

    /* Trading colors */
    --green: #22c55e;
    --green-dim: rgba(34, 197, 94, 0.15);
    --green-text: #4ade80;
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.15);
    --red-text: #f87171;
    --yellow: #eab308;
    --yellow-dim: rgba(234, 179, 8, 0.15);
    --blue: #3b82f6;
    --blue-dim: rgba(59, 130, 246, 0.15);
    --purple: #a855f7;
    --purple-dim: rgba(168, 85, 247, 0.15);
    --orange: #f97316;

    /* Sizing */
    --nav-height: 56px;
    --sidebar-width: 240px;

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

    /* 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 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

/* ── Reset ────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--text-accent);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--blue);
}

/* ── Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ── Navigation ───────────────────────────────────────────────────────── */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    padding: 0 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-logo span {
    background: linear-gradient(135deg, var(--blue), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-primary:hover {
    background: #2563eb;
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
    border-color: var(--border-secondary);
    background: var(--bg-card-hover);
}

.btn-danger {
    background: var(--red-dim);
    color: var(--red-text);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

/* ── Layout ───────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: calc(100vh - var(--nav-height));
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* ── Page sections ────────────────────────────────────────────────────── */
.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.25rem;
    transition: border-color 0.15s;
}

.card:hover {
    border-color: var(--border-secondary);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-primary);
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── KPI Cards ────────────────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.25rem;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
}

.kpi-change {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.kpi-change.positive {
    color: var(--green-text);
}

.kpi-change.negative {
    color: var(--red-text);
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
    border-bottom: 1px solid var(--border-primary);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}

tbody td {
    padding: 0.6rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
    white-space: nowrap;
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

.td-right {
    text-align: right;
}

.buy {
    color: var(--green-text);
}

.sell {
    color: var(--red-text);
}

/* ── Orderbook ────────────────────────────────────────────────────────── */
.orderbook-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.orderbook-side {
    position: relative;
}

.orderbook-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 0.2rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    position: relative;
}

.orderbook-row .depth-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    opacity: 0.1;
    pointer-events: none;
}

.bid-bar {
    right: 0;
    background: var(--green);
}

.ask-bar {
    left: 0;
    background: var(--red);
}

.orderbook-spread {
    text-align: center;
    padding: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border-primary);
    border-bottom: 1px solid var(--border-primary);
}

/* ── Alerts Panel ─────────────────────────────────────────────────────── */
.alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
}

.alert-type-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.alert-type-badge.price {
    background: var(--blue-dim);
    color: var(--text-accent);
}

.alert-type-badge.whale {
    background: var(--purple-dim);
    color: var(--purple);
}

.alert-type-badge.liquidation {
    background: var(--red-dim);
    color: var(--red-text);
}

.alert-type-badge.volume {
    background: var(--yellow-dim);
    color: var(--yellow);
}

/* ── Forms / Inputs ───────────────────────────────────────────────────── */
input,
select,
textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    transition: border-color 0.15s;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-group {
    margin-bottom: 1rem;
}

/* ── Landing Page ─────────────────────────────────────────────────────── */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 6rem 2rem 4rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--blue) 50%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.2s;
}

.feature-card:hover {
    border-color: var(--blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ── Dashboard Grid ───────────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    gap: 1rem;
}

.dashboard-grid .full-width {
    grid-column: 1 / -1;
}

/* ── Settings ─────────────────────────────────────────────────────────── */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-primary);
}

.plan-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.5rem;
}

.plan-card.current {
    border-color: var(--blue);
    box-shadow: var(--shadow-glow);
}

.plan-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.plan-price {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    margin: 0.75rem 0;
}

.plan-features {
    list-style: none;
    margin-top: 1rem;
}

.plan-features li {
    padding: 0.3rem 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.plan-features li::before {
    content: '✓ ';
    color: var(--green-text);
}

/* ── Loading / Status ─────────────────────────────────────────────────── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-secondary);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.status-dot.offline {
    background: var(--red);
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .plan-cards {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .nav-links {
        display: none;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
