/* ── VLAN View overlay ─────────────────────────────────────────── */
/* Chrome (surfaces / text / borders) reads the shared theme tokens, so the
   poster follows the active theme — white in light mode, dark in the dark
   skins. The per-VLAN accent colours are content/brand and stay as-is. */

#vlan-view {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, sans-serif;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
#vlan-view.open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Top bar ───────────────────────────────────────────────────── */

#vlan-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

#vlan-back {
    background: var(--surface-2);
    color: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 12px;
    font-family: system-ui, sans-serif;
}
#vlan-back:hover { background: var(--hover); }

#vlan-topbar .vlan-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
}
#vlan-topbar .vlan-subtitle { font-size: 12px; color: var(--ink-mute); }
#vlan-topbar .vlan-spacer { flex: 1; }
#vlan-topbar .vlan-hint { font-size: 11px; color: var(--ink-faint); }

/* ── Poster scroll area ────────────────────────────────────────── */

#vlan-poster {
    flex: 1;
    overflow: auto;
    padding: 56px 64px;
}

#vlan-poster-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 72px;
    width: max-content;
    min-width: 100%;
    /* subtle entrance */
    transform: translateY(14px);
    transition: transform 0.4s ease;
}
#vlan-view.open #vlan-poster-inner { transform: none; }

.vlan-links {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    z-index: 0;
}

.vlan-empty {
    color: var(--ink-mute);
    font-size: 14px;
    max-width: 320px;
    line-height: 1.6;
}

/* ── Core node ─────────────────────────────────────────────────── */

.vlan-core {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 2px solid var(--line-strong);
    border-radius: 12px;
    padding: 18px 22px;
    min-width: 132px;
    box-shadow: var(--float-shadow);
}
.vlan-core-icon { width: 46px; height: 46px; color: var(--ink-soft); }
.vlan-core-icon svg { width: 100%; height: 100%; }
.vlan-core-name {
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    color: var(--ink);
}
.vlan-core-sub {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ink-mute);
}

/* ── Zones column ──────────────────────────────────────────────── */

.vlan-zones {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 36px;
}

.vlan-zone {
    --accent: #94a3b8;
    flex: 0 0 auto;
    width: 320px;
    background: var(--surface);
    border: 1.5px solid var(--accent);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--float-shadow);
}
.vlan-zone-unassigned { opacity: 0.92; border-style: dashed; }

.vlan-zone-header {
    padding: 12px 14px 11px;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(127, 127, 127, 0.05), rgba(127, 127, 127, 0));
}
.vlan-zone-title {
    display: flex;
    align-items: baseline;
    gap: 9px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--accent);
    text-transform: uppercase;
}
.vlan-name { min-width: 8px; }
.vlan-id {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--ink-mute);
    background: var(--surface-2);
    border: 1px solid var(--line);
    padding: 1px 7px;
    border-radius: 10px;
    letter-spacing: 0.02em;
    text-transform: none;
    white-space: nowrap;
}
.vlan-zone-subnet {
    margin-top: 5px;
    font-size: 11.5px;
    color: var(--ink-mute);
    font-family: 'Courier New', monospace;
}
.vlan-zone-subnet .vlan-subnet { color: var(--ink-soft); }
.vlan-zone-subnet .vlan-subnet.derived { color: var(--ink-faint); font-style: italic; }

.vlan-zone-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.vlan-zone-empty {
    font-size: 11px;
    color: var(--ink-faint);
    padding: 4px 2px;
}

/* ── Device cards ──────────────────────────────────────────────── */

.vlan-card {
    --accent: #94a3b8;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 8px 10px;
}
.vlan-card:hover { background: var(--hover); }

.vlan-card-main { flex: 1; min-width: 0; }
.vlan-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.vlan-card-ip {
    font-size: 11px;
    color: var(--ink-mute);
    font-family: 'Courier New', monospace;
    margin-top: 1px;
    min-height: 13px;
}
.vlan-card-ip:empty::before {
    content: attr(data-placeholder);
    color: var(--ink-faint);
}

.vlan-card-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    color: var(--ink-mute);
    display: flex;
    align-items: center;
    justify-content: center;
}
.vlan-card-icon svg { width: 22px; height: 22px; }

/* ── Sub-zones (VMs / containers) ──────────────────────────────── */

.vlan-subzone {
    margin-top: 2px;
    border: 1px dashed var(--line-strong);
    border-radius: 6px;
    padding: 9px;
    background: var(--surface-3);
}
.vlan-subzone-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-mute);
    margin-bottom: 8px;
}
.vlan-subzone-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
.vlan-mini-card {
    --accent: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 2px solid var(--accent);
    border-radius: 5px;
    padding: 5px 7px;
    min-width: 0;
}
.vlan-mini-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--ink-mute);
    display: flex;
}
.vlan-mini-icon svg { width: 14px; height: 14px; }
.vlan-mini-name {
    font-size: 11px;
    color: var(--ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Inline editing affordance ─────────────────────────────────── */

.vlan-editable { outline: none; cursor: text; border-radius: 3px; }
.vlan-editable:hover { box-shadow: 0 0 0 1px var(--line-strong); }
.vlan-editable:focus {
    background: var(--field);
    box-shadow: 0 0 0 1px var(--accent, #6ec1e4);
    cursor: text;
}

/* ── Core picker ───────────────────────────────────────────────── */

.vlan-core-select {
    margin-top: 4px;
    max-width: 132px;
    font-family: system-ui, sans-serif;
    font-size: 11px;
    color: var(--ink-soft);
    background: var(--field);
    border: 1px solid var(--field-border);
    border-radius: 4px;
    padding: 2px 4px;
    cursor: pointer;
}
.vlan-core-select:focus { outline: none; border-color: var(--accent); }

/* ── Drag & drop ───────────────────────────────────────────────── */

.vlan-card-grip {
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
    margin: -8px 0 -8px -4px;
    padding: 0 4px;
    color: var(--ink-faint);
    font-size: 13px;
    line-height: 1;
    cursor: grab;
    user-select: none;
}
.vlan-card:hover .vlan-card-grip { color: var(--ink-mute); }
.vlan-card-grip:active { cursor: grabbing; }

.vlan-draggable { cursor: default; }
.vlan-mini-card.vlan-draggable { cursor: grab; }
.vlan-dragging { opacity: 0.4; }

/* Highlight a zone / the core while a device is dragged over it. */
.vlan-zone.vlan-drag-over {
    box-shadow: 0 0 0 2px var(--accent), var(--float-shadow);
    background: var(--hover);
}
.vlan-core.vlan-drag-over {
    box-shadow: 0 0 0 2px var(--accent), var(--float-shadow);
    border-color: var(--accent);
}

/* ── New-VLAN tile ─────────────────────────────────────────────── */

.vlan-create-tile {
    flex: 0 0 auto;
    align-self: stretch;
    min-height: 120px;
    width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: 1.5px dashed var(--line-strong);
    border-radius: 10px;
    color: var(--ink-mute);
    cursor: pointer;
    font-family: system-ui, sans-serif;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.vlan-create-tile:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--hover);
}
.vlan-create-plus { font-size: 30px; font-weight: 300; line-height: 1; }
.vlan-create-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ── Topbar VLAN button ────────────────────────────────────────── */

.btn-vlan {
    background: #00838f;
    color: #fff;
    border-color: #00838f;
    font-weight: 600;
}
.btn-vlan:hover { background: #00697a; border-color: #00697a; }

/* ── Tutorial launcher (topbar) ────────────────────────────────── */

.vlan-tour-launch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    color: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 5px 11px;
    cursor: pointer;
    font-size: 12px;
    font-family: system-ui, sans-serif;
    white-space: nowrap;
}
.vlan-tour-launch:hover { background: var(--hover); border-color: var(--line-strong); }
.vlan-tour-launch svg { display: block; }

.vlan-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    color: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 5px 11px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: system-ui, sans-serif;
    white-space: nowrap;
}
.vlan-export-btn:hover { background: var(--hover); border-color: var(--line-strong); }
.vlan-export-btn svg { display: block; }

/* ── Delete-VLAN button (in each zone header) ──────────────────── */

.vlan-zone-delete {
    margin-left: auto;
    align-self: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--ink-mute);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s, background 0.12s, color 0.12s, border-color 0.12s;
}
.vlan-zone:hover .vlan-zone-delete,
#vlan-view.tour-active .vlan-zone-delete { opacity: 1; pointer-events: auto; }
.vlan-zone-delete:hover {
    background: color-mix(in srgb, #ef4444 16%, var(--surface));
    border-color: #ef4444;
    color: #ef4444;
}

/* ── Guided tour overlay ───────────────────────────────────────── */

.vlan-tour {
    position: fixed;
    inset: 0;
    z-index: 1000;
}
/* The spotlight is just a rounded box whose giant box-shadow dims everything
   around it, leaving the target element visible through the "hole". The scrim
   is intentionally dark in every theme (like a modal backdrop) so the
   highlighted element pops. */
.vlan-tour-spot {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-radius: 10px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(12, 15, 18, 0.74), 0 0 0 0 rgba(110, 193, 228, 0.5);
    transition: top 0.34s cubic-bezier(.4, 0, .2, 1), left 0.34s cubic-bezier(.4, 0, .2, 1),
                width 0.34s cubic-bezier(.4, 0, .2, 1), height 0.34s cubic-bezier(.4, 0, .2, 1);
    animation: vlan-tour-pulse 1.9s ease-in-out infinite;
}
@keyframes vlan-tour-pulse {
    0%   { box-shadow: 0 0 0 9999px rgba(12, 15, 18, .74), 0 0 0 0   rgba(110, 193, 228, .5); }
    70%  { box-shadow: 0 0 0 9999px rgba(12, 15, 18, .74), 0 0 0 13px rgba(110, 193, 228, 0); }
    100% { box-shadow: 0 0 0 9999px rgba(12, 15, 18, .74), 0 0 0 0   rgba(110, 193, 228, 0); }
}

.vlan-tour-pop {
    position: fixed;
    z-index: 1001;
    width: 290px;
    max-width: calc(100vw - 32px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 15px 17px 14px;
    box-shadow: var(--float-shadow);
    animation: vlan-tour-pop-in 0.32s cubic-bezier(.2, .8, .2, 1);
}
@keyframes vlan-tour-pop-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
.vlan-tour-step {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 5px;
}
.vlan-tour-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 6px;
}
.vlan-tour-body {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--ink-soft);
}
.vlan-tour-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 15px;
}
.vlan-tour-dots { display: flex; gap: 5px; }
.vlan-tour-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--line-strong);
    transition: background 0.15s, transform 0.15s;
}
.vlan-tour-dot.active { background: var(--accent); transform: scale(1.25); }
.vlan-tour-btns { display: flex; gap: 7px; }
.vlan-tour-btn {
    font-family: system-ui, sans-serif;
    font-size: 12px;
    border-radius: 5px;
    padding: 5px 12px;
    cursor: pointer;
    border: 1px solid transparent;
}
.vlan-tour-btn-ghost { background: transparent; color: var(--ink-mute); border-color: var(--line); }
.vlan-tour-btn-ghost:hover { background: var(--hover); color: var(--ink); }
.vlan-tour-btn-primary { background: var(--primary-bg); color: var(--primary-fg); font-weight: 700; }
.vlan-tour-btn-primary:hover { background: var(--primary-bg-hover); }

@media (prefers-reduced-motion: reduce) {
    .vlan-tour-spot { animation: none; transition: none; }
    .vlan-tour-pop { animation: none; }
}
