/* 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-banner-notes {
    font-size: var(--fs-xs);
    color: var(--text-2);
    white-space: nowrap;
}
.update-banner-notes:hover {
    color: var(--accent-1);
}
.update-banner-dismiss {
    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 {
    color: var(--accent-1);
}
@media (max-width: 600px) {
    .update-banner {
        flex-wrap: wrap;
    }
    .update-banner-text {
        flex-basis: 100%;
    }
}

.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;
    }
    .host-card {
        flex: 0 1 auto;
        min-width: 340px;
        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;
}

/* ── 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;
}

/* ── Host card ─────────────────────────────────────────────────────────── */
.host-card {
    display: flex;
    flex-direction: column;
    padding: var(--space-4) var(--space-5);
    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+badge+meta · kebab menu */
.host-card-head {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.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;
}
.host-name-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    margin-bottom: 2px;
}
.host-name {
    font-weight: 600;
    font-size: var(--fs-md);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.host-name-row .status-badge {
    flex-shrink: 0;
}
.host-gpu,
.host-resolution {
    font-size: var(--fs-xs);
    color: var(--text-3);
    margin-top: 1px;
}

/* 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 */
.host-card-body {
    margin-top: var(--space-4);
}
.host-body-center {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5) var(--space-3);
}
.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 {
        padding: var(--space-3) var(--space-4);
    }
    .host-card-head {
        gap: var(--space-3);
    }
}
