/* layout.css — Horizontal top-nav layout (v3.1) */
/* Sidebar removed — all nav lives in single horizontal top bar. */

/* ── Topbar (single row: logo + nav + gates + theme) ────────── */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-4);
    z-index: 100;
}

.topbar-brand {
    display: flex; align-items: center; gap: var(--space-2);
    font-weight: var(--weight-semibold);
    font-size: var(--text-md);
    color: var(--text-primary);
    text-decoration: none;
    margin-right: var(--space-3);
}
.topbar-brand svg { flex-shrink: 0; }

.topbar-nav {
    display: flex; align-items: center; gap: 2px;
    flex: 1;
}

.nav-item {
    display: inline-flex; align-items: center; gap: var(--space-2);
    height: 30px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
    white-space: nowrap;
}
.nav-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-item.active { background: var(--bg-elevated); color: var(--text-primary); }
.nav-icon { width: 14px; height: 14px; opacity: 0.7; }
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }

.topbar-right {
    display: flex; align-items: center; gap: var(--space-2);
    margin-left: auto;
}

.topbar-status {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-right: var(--space-2);
}
.status-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
.status-dot.dot-ok { background: var(--success); box-shadow: 0 0 6px var(--success-soft); }
.status-dot.dot-warning { background: var(--warning); box-shadow: 0 0 6px var(--warning-soft); }
.status-dot.dot-error { background: var(--danger); box-shadow: 0 0 6px var(--danger-soft); }

.icon-btn {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.icon-btn svg { width: 16px; height: 16px; }

.version-tag {
    font-size: 10px; color: var(--text-muted);
    font-weight: var(--weight-medium);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
}

/* ── Gates dropdown ─────────────────────────────────────────── */
.gates-trigger {
    display: inline-flex; align-items: center; gap: var(--space-2);
    height: 30px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    border: 1px solid var(--border-default);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.gates-trigger:hover { background: var(--bg-overlay); border-color: var(--border-strong); }
.gates-trigger .count {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: var(--weight-semibold);
}

.gates-menu {
    position: fixed;
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-height: 480px;
    overflow: hidden;
    display: flex; flex-direction: column;
    z-index: 200;
    animation: menu-in 0.12s ease;
}
.gates-menu-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-elevated);
}
.gates-menu-actions { display: flex; gap: var(--space-1); }
.gates-menu-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-1);
}
.gates-menu-group {
    padding: var(--space-2) var(--space-2) var(--space-1);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    font-weight: var(--weight-medium);
    display: flex; justify-content: space-between; align-items: center;
}
.gates-menu-group button {
    font-size: 10px;
    color: var(--accent);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    background: transparent;
}
.gates-menu-group button:hover { background: var(--accent-soft); }

.gate-item {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s;
}
.gate-item:hover { background: var(--bg-elevated); }
.gate-item.deprecated { opacity: 0.5; }
.gate-checkbox {
    width: 14px; height: 14px;
    accent-color: var(--accent);
    flex-shrink: 0;
    cursor: pointer;
}
.gate-info { flex: 1; min-width: 0; }
.gate-name {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
}
.gate-processor {
    font-size: 10px;
    color: var(--text-muted);
}

@keyframes menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Main Content (full-width, no sidebar offset) ───────────── */
.main-content {
    margin-top: var(--topbar-height);
    padding: var(--space-5);
    min-height: calc(100vh - var(--topbar-height));
    flex: 1;
    width: 100%;
}

/* ── Left sidebar (only on /checker) ───────────────────────── */
.gate-sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--gate-panel-width);
    background: var(--bg-base);
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    z-index: 30;
}

.gate-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-default);
    min-height: 48px;
    gap: var(--space-2);
}

.gate-sidebar-close {
    width: 28px; height: 28px;
    flex-shrink: 0;
}

.gate-sidebar-toggle { color: var(--text-secondary); }

/* Mobile-only utility (hidden on desktop) */
.mobile-only { display: none !important; }

@media (max-width: 768px) {
    .mobile-only { display: inline-flex !important; }
}

.gate-sidebar-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    display: flex; align-items: center; gap: var(--space-2);
}

.gate-sidebar-search {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-default);
}

.gate-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-1) var(--space-2);
}

.gate-sidebar-group {
    padding: var(--space-3) var(--space-2) var(--space-1);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: var(--weight-medium);
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; background: var(--bg-base); z-index: 1;
    border-left: 2px solid var(--accent);
    padding-left: calc(var(--space-2) + 2px);
}
.gate-sidebar-group button {
    font-size: 10px; color: var(--accent);
    padding: 2px 6px; border-radius: var(--radius-sm);
    background: transparent; border: none; cursor: pointer;
}
.gate-sidebar-group button:hover { background: var(--accent-soft); }

/* Selected gate highlight */
.gate-item:has(.gate-radio:checked) {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    padding-left: calc(var(--space-2) - 3px);
}
.gate-item:has(.gate-radio:checked) .gate-name {
    color: var(--accent);
    font-weight: var(--weight-semibold);
}

.gate-sidebar-footer {
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--border-default);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* When sidebar visible: shift main content */
body.has-gate-sidebar .main-content {
    margin-left: var(--gate-panel-width);
    width: calc(100% - var(--gate-panel-width));
}

@media (max-width: 768px) {
    .gate-sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
    .gate-sidebar.mobile-open { transform: translateX(0); }
    body.has-gate-sidebar .main-content { margin-left: 0; width: 100%; }
    /* Backdrop overlay when sidebar open on mobile */
    body.has-gate-sidebar .main-content::before {
        content: '';
        position: fixed;
        inset: var(--topbar-height) 0 0 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 25;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    body.has-gate-sidebar.sidebar-open .main-content::before {
        opacity: 1;
        pointer-events: auto;
    }
}

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
    gap: var(--space-3);
}

.page-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    display: flex; align-items: center; gap: var(--space-2);
    margin: 0;
}

.page-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: 2px;
}

.page-actions { display: flex; align-items: center; gap: var(--space-2); }

.container { max-width: var(--container-max); margin: 0 auto; }

@media (max-width: 768px) {
    .topbar { padding: 0 var(--space-3); gap: var(--space-2); }
    .nav-item .label { display: none; }
    .nav-item { padding: 0 var(--space-2); }
    .topbar-status { display: none; }
}
