/* MoonlightWeb — Hosts view */

.hosts-view {
    width: 100%;
}

/* Discreet "new version available" banner at the very top of the Hosts view.
   Muted surface + a single accent edge so it reads as informative, not alarming. */
.update-banner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-sm);
    color: var(--text-2);
    background-color: var(--accent-soft);
    border: 1px solid var(--border-1);
    border-left: 2px solid var(--accent-1);
    border-radius: var(--radius-sm);
}
.update-banner[hidden] {
    display: none;
}
.update-banner-icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--accent-1);
}
.update-banner-icon svg {
    width: 16px;
    height: 16px;
}
.update-banner-text {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text-1);
}
.update-banner-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 0 0 auto;
}
.update-banner-download {
    padding: 4px 12px;
    font-size: var(--fs-xs);
    text-decoration: none;
    white-space: nowrap;
}
/* Update in progress: the actions/dismiss are replaced by a progress track. */
.update-banner-progress {
    position: relative;
    flex: 0 0 auto;
    width: 160px;
    height: 4px;
    overflow: hidden;
    background-color: var(--border-1);
    border-radius: 2px;
}
/* No width transition: the width is eased frame by frame in HostListView, and a
   transition on top of that would only add lag. The sheen carries the "still
   working" signal through the long install, where the easing crawls. */
.update-banner-progress-fill {
    position: relative;
    display: block;
    height: 100%;
    overflow: hidden;
    background-color: var(--accent-1);
    border-radius: 2px;
    will-change: width;
}
.update-banner-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.45) 50%,
        transparent 100%
    );
    animation: update-progress-sheen 1.6s ease-in-out infinite;
}
@keyframes update-progress-sheen {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(100%);
    }
}
@media (prefers-reduced-motion: reduce) {
    .update-banner-progress-fill::after {
        animation: none;
    }
}
.update-banner-notes {
    font-size: var(--fs-xs);
    color: var(--text-2);
    white-space: nowrap;
}
.update-banner-notes:hover {
    color: var(--accent-1);
}
/* Two ✕ that look identical on purpose: -dismiss silences that version for
   good, -close only clears the row (see the click handler). */
.update-banner-dismiss,
.update-banner-close {
    flex: 0 0 auto;
    padding: 4px;
    background: none;
    border: none;
    color: var(--text-2);
    font-size: var(--fs-sm);
    line-height: 1;
    cursor: pointer;
}
.update-banner-dismiss:hover,
.update-banner-close:hover {
    color: var(--accent-1);
}
@media (max-width: 600px) {
    .update-banner {
        flex-wrap: wrap;
    }
    .update-banner-text {
        flex-basis: 100%;
    }
    .update-banner-progress {
        flex: 1 1 auto;
        width: auto;
    }
}

.hosts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}
.hosts-header h2 {
    font-size: var(--fs-xl);
    font-weight: 700;
}
.hosts-actions {
    display: flex;
    gap: var(--space-2);
}

.hosts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
/* Desktop: host boxes shrink to their content and sit side by side, so a
   host with few apps no longer leaves a large empty area. */
@media (min-width: 601px) {
    .hosts-list {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }
    /* The floor is exactly two app tiles plus the card's own padding, so a
       host with one app, none, or only a message is the same width as a host
       with two. Above that floor the width is the app grid's and nothing
       else's — the header and the body messages are kept out of the
       intrinsic size below, or a long host name would set the width. */
    .host-card {
        flex: 0 1 auto;
        min-width: calc(2 * var(--app-card-w) + var(--app-card-gap) + 2 * var(--host-card-pad-x));
        max-width: 100%;
    }
    .hosts-empty,
    .hosts-error {
        width: 100%;
    }
}

.hosts-empty,
.hosts-error {
    text-align: center;
    padding: var(--space-8) var(--space-5);
    color: var(--text-2);
    background-color: var(--surface-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-1);
}
.empty-icon {
    display: block;
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
    opacity: 0.7;
}

/* The "you need host software" invitation, under the empty-list message and
   separated from it: the lines above are about this list, this one is about
   another program on another machine. */
.hosts-empty-cta {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-1);
}
.hosts-empty-cta .hint {
    max-width: 46ch;
    margin: 0 auto var(--space-4);
}

/* ── Insecure (http://) gate ───────────────────────────────────────────── */
.insecure-gate {
    max-width: 520px;
    margin: var(--space-8) auto;
    text-align: center;
    padding: var(--space-8) var(--space-5);
    color: var(--text-2);
    background-color: var(--surface-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-1);
}
.insecure-gate-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
    opacity: 0.85;
}
.insecure-gate h2 {
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: var(--space-3);
}
.insecure-gate p {
    margin-bottom: var(--space-5);
    line-height: 1.5;
}

/* ── Remote-access banner (https://localhost) ──────────────────────────── */
.remote-access-banner {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-5);
    font-size: var(--fs-sm);
    color: var(--text-2);
    background-color: var(--surface-2);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-md);
}
.remote-access-banner a {
    margin-left: var(--space-3);
    color: var(--accent, #35c98f);
    text-decoration: none;
    word-break: break-all;
}
.remote-access-banner a:hover {
    text-decoration: underline;
}
/* The action link is a clause inside the sentence, not an address tacked on
   the end: the gap that sets a URL apart from its label reads as a stray
   space mid-sentence. */
.remote-access-banner a.consent-highlight {
    margin-left: 0;
}

/* ── Host card ─────────────────────────────────────────────────────────── */
.host-card {
    --host-card-pad-x: var(--space-5);
    display: flex;
    flex-direction: column;
    padding: var(--space-4) var(--host-card-pad-x);
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}
.host-card.offline {
    opacity: 0.6;
}
/* Reachable but service down — dimmed less than a fully-offline host. */
.host-card.unavailable {
    opacity: 0.78;
}

/* Header row: status icon · name+meta · status badge · kebab menu.
   width:0 + min-width:100% is the "don't size the box" idiom: percentages are
   ignored while the card's intrinsic width is computed, so the header counts
   for nothing there and then fills whatever width the app grid settled on.
   Without it a host named eb5e4832-…​.home would stretch the card. */
.host-card-head {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    width: 0;
    min-width: 100%;
}

.host-card-icon {
    flex-shrink: 0;
}
.status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.25rem;
    background-color: var(--surface-3);
}
.status-icon.ready {
    color: var(--c-success);
    background-color: var(--c-success-soft);
}
.status-icon.locked {
    color: var(--c-warning);
    background-color: var(--c-warning-soft);
}
.status-icon.offline {
    color: var(--c-danger);
    background-color: var(--c-danger-soft);
}
.status-icon.unavailable {
    color: var(--text-3);
    background-color: var(--surface-3);
}

.host-card-info {
    flex: 1;
    min-width: 0;
}
/* Name and GPU both ellipsise: the header has whatever room the app grid
   leaves it, never the other way round. */
.host-name {
    font-weight: 600;
    font-size: var(--fs-md);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.host-gpu {
    font-size: var(--fs-xs);
    color: var(--text-3);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* State sits hard right, just left of the kebab. */
.host-card-head > .status-badge {
    flex: 0 0 auto;
    margin-left: auto;
    white-space: nowrap;
}

/* Kebab menu */
.host-card-menu {
    position: relative;
    flex-shrink: 0;
}
.host-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 20;
    min-width: 150px;
    padding: var(--space-1);
    background-color: var(--surface-2);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.4));
}
.host-menu-item {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    text-align: left;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-1);
    font-size: var(--fs-sm);
    cursor: pointer;
}
.host-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
}
.host-menu-item.btn-remove {
    color: var(--c-danger);
}

/* Body: app grid, or a centered Pair / Wake-on-LAN / offline message.
   Only the app grid may set the card's width. Everything else takes the same
   width:0 + min-width:100% treatment as the header, so a sentence like "This
   host is on the network but MoonlightWeb isn't running" wraps inside the
   two-tile minimum instead of stretching the card into a ribbon. */
.host-card-body {
    margin-top: var(--space-4);
}
.host-body-center,
.host-apps-loading,
.host-apps-msg {
    width: 0;
    min-width: 100%;
}
.host-body-center {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5) var(--space-3);
    text-align: center;
}
.host-offline-msg {
    color: var(--text-3);
    font-size: var(--fs-sm);
}

.host-apps-loading,
.host-apps-msg {
    text-align: center;
    padding: var(--space-5) var(--space-3);
    color: var(--text-2);
    font-size: var(--fs-sm);
}
.host-apps-error {
    color: var(--c-danger-text);
}

@media (max-width: 600px) {
    .host-card {
        --host-card-pad-x: var(--space-4);
        padding: var(--space-3) var(--host-card-pad-x);
    }
    .host-card-head {
        gap: var(--space-3);
    }
}
