/* ── Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #0d0f1c;
    color: #e0e0e0;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ── Dashboard ───────────────────────────────────────── */
.dashboard {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

.status-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #444;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    gap: 0.75rem;
}

.status-message.error { color: #f87171; }

.status-icon {
    font-size: 2rem;
    opacity: 0.5;
}

/* ── Skeleton loading ────────────────────────────────── */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 72px));
    gap: 6px;
    padding: 6px;
}

.skeleton-cell {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    animation: skeleton-pulse 1.6s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 0.8; }
}

/* ── Map ─────────────────────────────────────────────── */
.hosts-map {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ── Flat grid ───────────────────────────────────────── */
.hosts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 82px);
    gap: 8px;
    padding: 1rem;
}

/* ── Cell base ───────────────────────────────────────── */
.host-cell {
    position: absolute;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px;
    cursor: default;
    user-select: none;
    overflow: hidden;
}

.hosts-grid .host-cell {
    position: relative;
    width: 82px;
    height: 82px;
}

/* ── Placeholder ─────────────────────────────────────── */
.host-cell--placeholder {
    background: rgba(255,255,255,0.018);
    border: 1px solid rgba(255,255,255,0.04);
    pointer-events: none;
}

/* ── Free — bright, inviting ─────────────────────────── */
.host-cell--free {
    background: #1e2d4a;
    border: 1px solid #3a5a90;
    color: #c8dcff;
}

.host-cell--free .host-cell__number { color: #ffffff; }
.host-cell--free .host-cell__state  { color: #7eb8ff; opacity: 0.9; letter-spacing: 0.1em; }

/* ── Occupied — dimmed, recedes ──────────────────────── */
.host-cell--occupied {
    background: #111318;
    border: 1px solid #1c1e24;
    opacity: 0.35;
}

/* ── Locked ──────────────────────────────────────────── */
.host-cell--locked {
    background: #111318;
    border: 1px solid #1c1e24;
    opacity: 0.25;
}

/* ── Out of order ────────────────────────────────────── */
.host-cell--out-of-order {
    background: #0e0f12;
    border: 1px solid #161718;
    opacity: 0.2;
}

/* ── Selected ────────────────────────────────────────── */
.host-cell--selected {
    outline: 2px solid rgba(200, 220, 255, 0.8);
    outline-offset: 2px;
    z-index: 5;
}

/* ── Tooltip ─────────────────────────────────────────── */
.host-tooltip {
    position: absolute;
    z-index: 100;
    width: 210px;
    background: #131726;
    border: 1px solid #2a3a60;
    border-radius: 10px;
    padding: 0.75rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.host-tooltip__header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.host-tooltip__number {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.host-tooltip__name {
    font-size: 0.75rem;
    color: #7090c0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.host-tooltip__group {
    font-size: 0.65rem;
    color: #4a6090;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.host-tooltip__flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.host-tooltip__flag {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: 4px;
}

.flag--on  { color: #4ecb80; background: rgba(42,138,90,0.15); }
.flag--off { color: #f87171; background: rgba(180,40,40,0.15); }
.flag--warn { color: #fbbf24; background: rgba(180,130,0,0.15); }

.host-tooltip__sessions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 0.4rem;
}

.host-tooltip__session {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.host-tooltip__session-user {
    font-size: 0.78rem;
    font-weight: 600;
    color: #c8dcff;
}

.host-tooltip__session-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.62rem;
    color: #5070a0;
    flex-wrap: wrap;
}

.host-tooltip__session-meta .time-remaining {
    color: #7eb8ff;
}

.host-tooltip__empty {
    font-size: 0.65rem;
    color: #3a5080;
    font-style: italic;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 0.4rem;
}

/* ── Offline modifier — layered on top of any state ─── */
.host-cell--offline {
    opacity: 0.45;
    border-color: #4a1a1a !important;
    box-shadow: inset 0 0 0 1px rgba(180, 40, 40, 0.25);
}

/* ── Cell content ────────────────────────────────────── */
.host-cell__number {
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #fff;
}

.host-cell__name {
    font-size: 0.55rem;
    font-weight: 500;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.host-cell__state {
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    opacity: 0.6;
}

.host-cell__time {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #c8dcff;
    font-variant-numeric: tabular-nums;
}

/* ── PWA install button ──────────────────────────────── */
.pwa-install-btn {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 200;
    padding: 0.5rem 1rem;
    background: #1e2d4a;
    color: #7eb8ff;
    border: 1px solid #3a5a90;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.06em;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.2s, background 0.2s;
}

.pwa-install-btn:hover {
    opacity: 1;
    background: #243560;
}

/* ── Blazor framework ────────────────────────────────── */
#blazor-error-ui {
    color-scheme: light only;
    background: #1e1e1e;
    border-top: 1px solid #333;
    bottom: 0;
    color: #f87171;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 0.85rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    opacity: 0.6;
}

