/* ═══════════════════════════════════════════════════════════
   EWI Markets Hub
   ═══════════════════════════════════════════════════════════ */

/* ── Hub layout ─────────────────────────────────────────────────────────────── */

.mkt-hub {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height, 70px));
    overflow: hidden;
}

/* ── Category tabs ───────────────────────────────────────────────────────────── */

.mkt-hub__tabs {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-alt, #111);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}

.mkt-hub__tabs::-webkit-scrollbar {
    display: none;
}

.mkt-hub__tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.mkt-hub__tab:hover {
    color: var(--text);
    border-color: var(--border);
}

.mkt-hub__tab.is-active {
    background: rgba(77, 163, 255, 0.1);
    border-color: rgba(77, 163, 255, 0.3);
    color: var(--accent, #4DA3FF);
}

/* ── Body ────────────────────────────────────────────────────────────────────── */

.mkt-hub__body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */

.mkt-hub__sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--bg-alt, #111);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 12px 0;
    position: relative;
    transition: width 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.mkt-hub__sidebar.is-collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
}

.mkt-hub__sidebar-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    z-index: 10;
    line-height: 0;
}

.mkt-hub__sidebar-toggle:hover {
    color: var(--text);
}

.mkt-hub__sidebar-cat {
    display: none;
    padding: 0 8px;
}

.mkt-hub__sidebar-cat.is-active {
    display: block;
}

.mkt-hub__group {
    margin-bottom: 16px;
}

.mkt-hub__group-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint, #555);
    padding: 0 8px;
    margin: 0 0 6px;
}

.mkt-hub__asset-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.12s;
}

.mkt-hub__asset-btn:hover {
    background: var(--bg-hover, #1a1a1a);
    color: var(--text);
}

.mkt-hub__asset-btn.is-active {
    background: rgba(77, 163, 255, 0.1);
    color: var(--accent, #4DA3FF);
}

.mkt-hub__asset-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mkt-hub__live-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4caf50;
    flex-shrink: 0;
    animation: mkt-pulse-dot 2s infinite;
}

.mkt-hub__asset-price {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-faint, #555);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ── Main panel ──────────────────────────────────────────────────────────────── */

.mkt-hub__panel {
    flex: 1;
    overflow-y: auto;
    background: var(--bg, #0f0f0f);
    min-width: 0;
}

/* ── Welcome screen ──────────────────────────────────────────────────────────── */

.mkt-hub__welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    padding: 40px 20px;
}

.mkt-hub__welcome-inner h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text);
}

.mkt-hub__welcome-inner p {
    color: var(--text-muted);
    margin: 0 0 24px;
    max-width: 400px;
}

.mkt-hub__quick-assets {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.mkt-hub__quick-btn {
    padding: 10px 20px;
    background: rgba(77, 163, 255, 0.1);
    border: 1px solid rgba(77, 163, 255, 0.2);
    border-radius: 8px;
    color: var(--accent, #4DA3FF);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.mkt-hub__quick-btn:hover {
    background: rgba(77, 163, 255, 0.2);
    border-color: rgba(77, 163, 255, 0.4);
}

/* ── Content area ────────────────────────────────────────────────────────────── */

.mkt-hub__content {
    min-height: 100%;
}

/* ── Loading spinner ─────────────────────────────────────────────────────────── */

.mkt-hub__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 0;
}

.mkt-hub__loading p {
    margin: 0;
    font-size: 0.875rem;
}

.mkt-hub__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent, #4DA3FF);
    border-radius: 50%;
    animation: mkt-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

/* ── Animations ──────────────────────────────────────────────────────────────── */

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

@keyframes mkt-pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ── Sidebar collapsed — toggle floats left ──────────────────────────────────── */

.mkt-hub__sidebar.is-collapsed .mkt-hub__sidebar-toggle {
    position: fixed;
    left: 0;
    top: calc(var(--header-height, 70px) + 60px);
    background: var(--bg-alt, #111);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 6px 6px 0;
    padding: 8px 6px;
}

/* ── Mobile ──────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .mkt-hub__body {
        flex-direction: column;
    }

    .mkt-hub__sidebar {
        width: 100%;
        height: auto;
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0;
    }

    .mkt-hub__sidebar-cat {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 4px;
        padding: 8px;
        overflow-x: auto;
    }

    .mkt-hub__sidebar-cat.is-active {
        display: flex;
    }

    .mkt-hub__group {
        display: flex;
        flex-direction: row;
        gap: 4px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .mkt-hub__group-label {
        display: none;
    }

    .mkt-hub__asset-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .mkt-hub__asset-price {
        display: none;
    }

    .mkt-hub__sidebar-toggle {
        display: none;
    }

    .mkt-hub__sidebar.is-collapsed .mkt-hub__sidebar-toggle {
        display: none;
    }
}
