/* ============================================================
   Nexus Design System — shared across all valuable-dashboards
   ------------------------------------------------------------
   Import this file FIRST in every dashboard's HTML, then layer
   dashboard-specific styles on top in assets/style.css.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Fonts */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    /* Theme transition (apply to themed elements) */
    --theme-transition:
        background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);

    /* Light theme — Nexus Sand & Teal */
    --bg-primary: #f8f6f0;
    --bg-secondary: #f0ede4;
    --card-bg: #ffffff;
    --card-hover-shadow: 0 12px 30px rgba(15, 118, 110, 0.08);

    --text-primary: #1c1c1a;
    --text-secondary: #5c5a54;
    --text-muted: #8c8980;

    --border-color: #e6e3db;
    --border-hover: #0f766e;

    --accent-teal: #0f766e;
    --accent-teal-hover: #115e59;
    --accent-teal-light: rgba(15, 118, 110, 0.08);

    --status-green: #15803d;
    --status-green-bg: rgba(22, 163, 74, 0.1);
    --status-amber: #b45309;
    --status-amber-bg: rgba(217, 119, 6, 0.1);
    --status-red: #b91c1c;
    --status-red-bg: rgba(220, 38, 38, 0.1);

    --map-tile-filter: none;
    --chart-grid-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    /* Dark theme — Nexus Charcoal & Cyan-Teal */
    --bg-primary: #0a0b0b;
    --bg-secondary: #121313;
    --card-bg: #161818;
    --card-hover-shadow: 0 12px 30px rgba(20, 184, 166, 0.1);

    --text-primary: #f2f4f4;
    --text-secondary: #9ea5a5;
    --text-muted: #646b6b;

    --border-color: #262a2a;
    --border-hover: #14b8a6;

    --accent-teal: #14b8a6;
    --accent-teal-hover: #2dd4bf;
    --accent-teal-light: rgba(20, 184, 166, 0.1);

    --status-green: #4ade80;
    --status-green-bg: rgba(74, 222, 128, 0.1);
    --status-amber: #fbbf24;
    --status-amber-bg: rgba(251, 191, 36, 0.1);
    --status-red: #f87171;
    --status-red-bg: rgba(248, 113, 113, 0.1);

    --map-tile-filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
    --chart-grid-color: rgba(255, 255, 255, 0.05);
}

/* ---------- Reset & base ---------- */

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    transition: var(--theme-transition);
    padding-bottom: 3rem;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

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

a:hover { color: var(--accent-teal-hover); }

/* ---------- Layout container ---------- */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---------- Sticky glass header ---------- */

header.nx-header {
    background: var(--bg-primary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--theme-transition);
}

.nx-nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

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

.nx-logo svg { color: var(--accent-teal); }

.nx-nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nx-nav-links a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.nx-nav-links a.active {
    color: var(--accent-teal);
    font-weight: 600;
}

/* ---------- Theme toggle button ---------- */

.btn-theme {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--theme-transition);
}

.btn-theme:hover {
    border-color: var(--accent-teal);
    background: var(--accent-teal-light);
}

.btn-theme .moon-icon { display: none; }
[data-theme="dark"] .btn-theme .sun-icon { display: none; }
[data-theme="dark"] .btn-theme .moon-icon { display: block; }

/* ---------- Hero ---------- */

.nx-hero {
    padding: 2.5rem 0 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.nx-hero-layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
}

.nx-hero h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.nx-hero p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* "Live tracker" pill */
.nx-live-badge {
    background: var(--accent-teal-light);
    border: 1px solid var(--border-hover);
    color: var(--accent-teal);
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nx-pulse {
    width: 8px;
    height: 8px;
    background: var(--accent-teal);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7);
    animation: nx-pulse 1.6s infinite;
}

@keyframes nx-pulse {
    0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7); }
    70%  { transform: scale(1);    box-shadow: 0 0 0 8px rgba(20, 184, 166, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); }
}

/* ---------- KPI cards grid ---------- */

.nx-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.nx-kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    transition: var(--theme-transition), transform 0.2s ease;
}

.nx-kpi-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--card-hover-shadow);
    transform: translateY(-2px);
}

.nx-kpi-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.nx-kpi-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.nx-kpi-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* ---------- Generic card / section ---------- */

.nx-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--theme-transition);
}

.nx-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.nx-card p {
    margin-bottom: 0.75rem;
}

.nx-card p:last-child {
    margin-bottom: 0;
}

.nx-card ul {
    list-style: disc;
    padding-left: 1.35rem;
    margin: 0.5rem 0 1rem;
}

.nx-card ul li {
    margin-bottom: 0.55rem;
    line-height: 1.55;
}

.nx-card ul li:last-child {
    margin-bottom: 0;
}

/* ---------- Status chips ---------- */

.nx-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}

.nx-chip.is-green { background: var(--status-green-bg); color: var(--status-green); }
.nx-chip.is-amber { background: var(--status-amber-bg); color: var(--status-amber); }
.nx-chip.is-red   { background: var(--status-red-bg);   color: var(--status-red); }
.nx-chip.is-teal  { background: var(--accent-teal-light); color: var(--accent-teal); }

/* ---------- Network footer (cross-link to other dashboards) ---------- */

.nx-network-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
}

/* Keep horizontal inset when footer also uses .container (avoid padding shorthand zeroing sides). */
.nx-network-footer.container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.nx-network-footer-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0;
}

.nx-network-footer a {
    color: var(--text-secondary);
}

.nx-network-footer a:hover { color: var(--accent-teal); }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .nx-hero h1 { font-size: 1.6rem; }
    .nx-kpi-value { font-size: 1.5rem; }
}
