/* =============================================================================
   CNNECT Systems Directory — style.css
   Based on staging_dashboard / prod_dashboard style.css (same visual system),
   kept in sync manually — each dashboard/site vhost here is self-contained.
   Aesthetic: Obsidian Control Room
   Fonts: Bebas Neue (headings) · Barlow (UI) · DM Mono (technical/code)
============================================================================= */

/* ── Custom properties ───────────────────────────────────────────────────── */
:root {
    /* Backgrounds */
    --bg-base:       #07090f;
    --bg-surface:    #0c1220;
    --bg-card:       #101828;
    --bg-card-hover: #142034;

    /* Borders */
    --border:        rgba(255, 255, 255, 0.07);
    --border-hover:  rgba(255, 255, 255, 0.13);
    --border-accent: rgba(0, 217, 255, 0.25);

    /* Text */
    --text-primary:   #dde6f0;
    --text-secondary: #6e87a0;
    --text-muted:     #3d5268;

    /* Accent */
    --accent:      #00d9ff;
    --accent-dim:  rgba(0, 217, 255, 0.08);
    --accent-glow: rgba(0, 217, 255, 0.25);

    /* Status (kept for shared alert styling) */
    --failed:        #ff4757;
    --failed-bg:     rgba(255, 71, 87, 0.1);
    --failed-border: rgba(255, 71, 87, 0.25);

    /* Type */
    --font-head: 'Bebas Neue', 'Arial Narrow', sans-serif;
    --font-ui:   'Barlow', system-ui, sans-serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;

    /* Layout */
    --header-h:   64px;
    --sidebar-w:  220px;
    --max-w:      1440px;
    --r:          6px;
    --r-lg:       10px;
}

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

html { font-size: 15px; }

body {
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-ui);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-ui); }
strong { font-weight: 600; }

/* ── Site Header ─────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0 36px;
    gap: 24px;
    background: rgba(7, 9, 15, 0.88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ── Logo area ───────────────────────────────────────────────────────────── */
.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 176px;
}

.logo-img {
    width: 24px;
}

.brand-name {
    display: block;
    font-family: var(--font-head);
    font-size: 22px;
    letter-spacing: 0.08em;
    line-height: 1;
    color: var(--text-primary);
}

.brand-sub {
    display: block;
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ── Header right ────────────────────────────────────────────────────────── */
.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.current-user {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

.btn-logout {
    padding: 6px 14px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--r);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-logout:hover {
    color: var(--failed);
    border-color: var(--failed-border);
    background: var(--failed-bg);
}

/* ── Page body (sidebar + main) ──────────────────────────────────────────── */
.page-body {
    display: flex;
    align-items: flex-start;
    max-width: var(--max-w);
    margin: 0 auto;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    padding: 36px 20px;
    position: sticky;
    top: var(--header-h);
    align-self: flex-start;
}

.sidebar-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding: 0 12px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: var(--r);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.sidebar-link:hover {
    color: var(--accent);
    background: var(--accent-dim);
    border-color: var(--border-accent);
}

/* ── Main content ────────────────────────────────────────────────────────── */
.main-content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 36px 36px 44px;
}

/* ── System grid ─────────────────────────────────────────────────────────── */
.system-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ── System block ────────────────────────────────────────────────────────── */
.system-block {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.system-block:hover {
    border-color: var(--border-hover);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.system-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.system-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--r);
    object-fit: contain;
    background: var(--bg-surface);
    border: 1px solid var(--border);
}

.dashboard-icon {
    width: 44px;
    height: 44px;
    margin-right: 8px;
}

.system-head-text { min-width: 0; }

.system-name {
    font-family: var(--font-head);
    font-size: 21px;
    font-weight: 400;
    letter-spacing: 0.03em;
    line-height: 1.15;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.system-sub {
    margin-top: 4px;
    font-size: 11.5px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    white-space: wrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.system-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}
.system-actions a { flex: 1 1 calc(50% - 4px); text-align: center; }

.action-btn-img {
    width: 20px;
    margin-right: 12px;
}

.img-invert {
    filter: invert(0.8);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    background: var(--accent);
    color: #07090f;
    border: none;
    border-radius: var(--r);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
}
.btn-primary:hover {
    background: #33e5ff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-primary.full-width {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-hover);
    border-radius: var(--r);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
}
.btn-secondary:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.18);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 24px;
    text-align: center;
    color: var(--text-muted);
}
.empty-icon {
    font-size: 52px;
    opacity: 0.18;
    margin-bottom: 18px;
    line-height: 1;
}
.empty-state p {
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse 100% 70% at 50% -10%, rgba(0, 217, 255, 0.05) 0%, transparent 60%),
        var(--bg-base);
}

.login-wrap {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 44px 40px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 38px;
}

.login-brand {
    display: block;
    font-family: var(--font-head);
    font-size: 30px;
    letter-spacing: 0.1em;
    line-height: 1;
    color: var(--text-primary);
}

.login-sub {
    display: block;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 3px;
}

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--r);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--r);
    font-size: 13px;
    margin-bottom: 22px;
    line-height: 1.45;
}
.alert-error {
    background: var(--failed-bg);
    border: 1px solid var(--failed-border);
    color: var(--failed);
}

.login-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 22px;
    letter-spacing: 0.02em;
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .system-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
    .page-body      { flex-direction: column; }
    .sidebar        { position: static; width: 100%; padding: 20px 20px 0; }
    .sidebar-nav    { flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 768px) {
    .site-header    { padding: 0 20px; gap: 16px; }
    .header-logo .brand-name { font-size: 18px; }
    .main-content   { padding: 24px 20px 32px; }
    .system-grid    { grid-template-columns: 1fr; }
    .system-actions a { flex-basis: 100%; }
    .login-card     { padding: 32px 28px; }
    .current-user   { display: none; }
}
