/**
 * Ecosystem Navigation Bar
 * Slim 36px bar above each app's header.
 * Includes theme selector, auth controls, and app links.
 */

.ecosystem-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    height: 36px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.8rem;
    user-select: none;
}

.ecosystem-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 16px;
}

/* Brand / Community Name */
.ecosystem-nav-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-secondary, #b0b3b8);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: color 0.2s;
}

.ecosystem-nav-brand:hover {
    color: var(--brand-primary, #a78bfa);
}

.ecosystem-nav-brand-icon {
    font-size: 0.7rem;
    color: var(--brand-primary, #a78bfa);
}

.ecosystem-nav-brand-text {
    display: none;
}

/* App Links */
.ecosystem-nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
}

.ecosystem-nav-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-muted, #8a8d91);
    font-weight: 500;
    font-size: 0.75rem;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

.ecosystem-nav-link:hover {
    color: var(--text-primary, #e4e6eb);
    background: rgba(255, 255, 255, 0.06);
}

.ecosystem-nav-link.active {
    color: var(--brand-primary, #a78bfa);
    background: rgba(167, 139, 250, 0.12);
}

/* Upcoming (Coming Soon) links — clickable but visually dimmed */
.ecosystem-nav-link.upcoming {
    opacity: 0.4;
    position: relative;
}

.ecosystem-nav-link.upcoming:hover {
    opacity: 0.75;
    color: var(--text-primary, #e4e6eb);
    background: rgba(255, 255, 255, 0.04);
}

.ecosystem-nav-link.upcoming.active {
    opacity: 0.85;
}

@media (hover: hover) {
    .ecosystem-nav-link.upcoming:hover::after {
        content: attr(title);
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 6px;
        padding: 4px 10px;
        border-radius: 4px;
        background: rgba(20, 20, 30, 0.95);
        border: 1px solid rgba(167, 139, 250, 0.25);
        color: var(--brand-primary, #a78bfa);
        font-size: 0.65rem;
        font-weight: 500;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        white-space: nowrap;
        z-index: 210;
        pointer-events: none;
    }
}

.ecosystem-nav-icon {
    font-size: 0.85rem;
    line-height: 1;
}

.ecosystem-nav-label {
    line-height: 1;
}

/* Push site-header down when ecosystem nav is present */
.ecosystem-nav ~ .site-header {
    position: sticky;
    top: 36px;
}

/* ── Right Section ───────────────────────────────────────── */

.eco-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Theme Selector (matches app-level .theme-selector, scaled for 36px bar) ── */

.eco-theme-wrap {
    position: relative;
}

.eco-theme-toggle {
    background: var(--bg-secondary, rgba(15,15,26,0.88));
    border: 1px solid var(--border, #1e1e35);
    border-radius: var(--radius-full, 9999px);
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.eco-theme-toggle:hover {
    background: var(--bg-hover, rgba(26,26,48,0.9));
    border-color: var(--brand-primary, #a78bfa);
}

.eco-theme-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--holo-gradient, linear-gradient(90deg, #00ff88, #00ccff, #ff6600, #ff0066, #aa00ff, #00ff88));
    background-size: 300% 300%;
    animation: holoShift 3s linear infinite;
}

[data-theme="cyber-neon"] .eco-theme-indicator {
    background: linear-gradient(135deg, #00ffff, #ff00ff);
    animation: none;
}
[data-theme="neon-spectrum"] .eco-theme-indicator {
    background: linear-gradient(135deg, #00ff88, #00ccff, #ff0066);
    animation: none;
}
[data-theme="terminal-gold"] .eco-theme-indicator {
    background: linear-gradient(135deg, #f0b429, #2dd4bf);
    animation: none;
}

.eco-theme-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card, rgba(18,18,30,0.95));
    border: 1px solid var(--border, #1e1e35);
    border-radius: var(--radius-sm, 8px);
    box-shadow: var(--shadow-lg, 0 10px 25px rgba(0,0,0,0.6));
    min-width: 220px;
    padding: 8px;
    margin-top: 8px;
    z-index: 210;
}

.eco-theme-menu.open { display: block; }

.eco-theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    color: var(--text-secondary, #b0b3b8);
    font-size: 0.85rem;
    font-family: inherit;
    transition: background 0.2s;
}

.eco-theme-option:hover {
    background: var(--bg-hover, rgba(26,26,48,0.9));
    color: var(--text-primary, #e4e6eb);
}

.eco-theme-option.active {
    color: var(--brand-primary, #a78bfa);
    background: var(--brand-light, rgba(0,255,136,0.12));
}

.eco-theme-swatch {
    display: flex;
    gap: 2px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.eco-theme-swatch span {
    width: 6px;
    height: 20px;
}

.eco-theme-option-label {
    flex: 1;
    text-align: left;
}

.eco-theme-check {
    opacity: 0;
    font-size: 0.75rem;
}

.eco-theme-option.active .eco-theme-check {
    opacity: 1;
}

/* ── User Badge (matches app-level .user-badge, scaled for 36px bar) ── */

.eco-user-wrap { position: relative; }

.eco-user-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 50%;
    background: var(--bg-secondary, rgba(15,15,26,0.88));
    border: 1px solid var(--border, #1e1e35);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary, #e4e6eb);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
}

.eco-user-toggle:hover {
    background: var(--bg-hover, rgba(26,26,48,0.9));
    border-color: var(--brand-primary, #a78bfa);
}

.eco-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--brand-primary, #a78bfa);
    color: var(--text-inverse, #0a0a0f);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.eco-user-avatar-anon {
    background: var(--bg-hover, rgba(26,26,48,0.9));
    color: var(--text-muted, #8a8d91);
    border: 1px solid var(--border, #1e1e35);
}

.eco-user-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card, rgba(18,18,30,0.95));
    border: 1px solid var(--border, #1e1e35);
    border-radius: var(--radius-sm, 8px);
    box-shadow: var(--shadow-lg, 0 10px 25px rgba(0,0,0,0.6));
    min-width: 200px;
    padding: 6px;
    margin-top: 8px;
    z-index: 210;
}

.eco-user-menu.open { display: block; }

.eco-user-menu a {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary, #b0b3b8);
    text-decoration: none;
}

.eco-user-menu a:hover {
    background: var(--bg-hover, rgba(26,26,48,0.9));
    color: var(--text-primary, #e4e6eb);
}

.eco-user-menu-name {
    padding: 8px 12px 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary, #e4e6eb);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eco-user-menu hr {
    border: none;
    border-top: 1px solid var(--border, #1e1e35);
    margin: 4px 0;
}

/* (Auth buttons removed — logged-out users now use avatar dropdown) */

/* ── Responsive ──────────────────────────────────────────── */

/* 1024px+: full labels + brand text */
@media (min-width: 1024px) {
    .ecosystem-nav-brand-text {
        display: inline;
    }
}

/* Below 1024px: hide upcoming app labels (icon-only for Coming Soon) */
@media (max-width: 1024px) {
    .ecosystem-nav-link.upcoming .ecosystem-nav-label {
        display: none;
    }
}

/* Below 768px: icon-only for ALL apps */
@media (max-width: 768px) {
    .ecosystem-nav-label {
        display: none;
    }

    .ecosystem-nav-link {
        padding: 4px 6px;
    }
}

/* Below 480px: ultra-compact (auth icon-only, tighter spacing) */
@media (max-width: 480px) {
    .ecosystem-nav-inner {
        padding: 0 8px;
        gap: 8px;
    }

    .ecosystem-nav-icon {
        font-size: 0.9rem;
    }

    .eco-nav-right {
        gap: 4px;
    }
}
