/* ==========================================================================
   Ecosystem Base Styles
   Shared boilerplate for all apps: reset, body, layout, header, logo,
   navigation, matrix rain, holoShift animation, mobile responsive.
   Load order: THIS → ecosystem-nav.css → ecosystem-themes.css →
               ecosystem-components.css → app.css
   ========================================================================== */

/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: transparent;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark, var(--accent)); }
img { max-width: 100%; height: auto; }

/* ── Matrix Rain Canvas ───────────────────────────────────────── */
#matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* ── Layout ───────────────────────────────────────────────────── */
main {
    flex: 1;
    position: relative;
    z-index: 1;
}

.main {
    padding: 2rem;
    max-width: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Site Header ──────────────────────────────────────────────── */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Logo ─────────────────────────────────────────────────────── */
.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.site-logo img {
    height: 32px;
    width: auto;
}

.site-logo-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.site-logo-icon svg {
    width: 100%;
    height: 100%;
}

.site-logo-text {
    background: linear-gradient(135deg, var(--brand-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-version {
    font-size: 0.75rem;
    color: var(--brand-primary);
    background: var(--brand-light);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

/* ── HoloShift Animation ─────────────────────────────────────── */
@keyframes holoShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Animated logo for holo themes */
[data-theme="spectrum-holo"] .site-logo-text,
[data-theme="holographic"] .site-logo-text,
[data-theme="matrix-green"] .site-logo-text {
    background: var(--holo-gradient);
    background-size: 300% 300%;
    animation: holoShift 4s linear infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Navigation ───────────────────────────────────────────────── */
.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.main-nav a {
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.main-nav a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.main-nav a.active {
    background: var(--brand-light);
    color: var(--brand-primary);
    font-weight: 600;
}

/* ── Nav Dropdown ─────────────────────────────────────────────── */
.nav-dropdown { position: relative; }

.nav-dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    background: none;
    border: none;
    font-family: inherit;
}

.nav-dropdown-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-dropdown-toggle.active {
    background: var(--brand-light);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    min-width: 180px;
    padding: 6px;
    z-index: 200;
    margin-top: 4px;
}

.nav-dropdown-menu.open { display: block; }

.nav-dropdown-menu a {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.nav-dropdown-menu a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ── Mobile Toggle ────────────────────────────────────────────── */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
}

/* ── Page Header ──────────────────────────────────────────────── */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-muted);
}

/* ── Header Link ──────────────────────────────────────────────── */
.header-link {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.header-link:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

/* ── Theme-Specific Header Effects ────────────────────────────── */
.site-header {
    border-bottom-color: transparent;
    background-image: linear-gradient(var(--bg-card, var(--bg-secondary)), var(--bg-card, var(--bg-secondary))),
                       var(--holo-gradient);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    background-size: 100% 100%, 100% 100%;
    border-bottom: 1px solid transparent;
}

[data-moving-borders] .site-header {
    background-size: 100% 100%, 300% 300%;
    animation: holoShift 4s linear infinite;
}

[data-theme="cyber-neon"] .site-header {
    box-shadow: 0 2px 20px rgba(0,255,255,0.08);
}

[data-theme="terminal-gold"] .site-header {
    border-bottom-color: rgba(240,180,41,0.2);
}

/* ── Responsive: Mobile Nav ───────────────────────────────────── */
@media (max-width: 768px) {
    .main-nav { display: none; }
    .main-nav.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        padding: 12px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.4);
        z-index: 200;
    }
    .mobile-toggle { display: block; }
    .header-right .btn { display: none; }
    .main { padding: 1rem; }
}
