@import url('https://fonts.googleapis.com/css2?family=Mona+Sans:ital,wght@0,200..900;1,200..900&display=swap');

/* Design system (dark, smooth, spacious) */
:root {
    /* Linear-ish dark */
    --bs-bg: #05060a;
    --bs-bg-2: #070915;
    --bs-surface: rgba(255, 255, 255, 0.035);
    --bs-surface-2: rgba(255, 255, 255, 0.055);
    --bs-border: rgba(255, 255, 255, 0.10);
    --bs-text: rgba(255, 255, 255, 0.90);
    --bs-muted: rgba(255, 255, 255, 0.56);
    --bs-accent: #ff6a3d; /* warm coral */
    --bs-accent-2: #57a0ff; /* cool blue */
    --bs-shadow: 0 18px 50px rgba(0, 0, 0, 0.50);
}

html {
    background-color: var(--bs-bg);
}

body {
    font-family: "Mona Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
    background-color: transparent;
    color: var(--bs-text);
    position: relative;
    z-index: 0;
}

/* Deterministic background layers (avoid pseudo-element overrides/caching confusion) */
.bg-photo {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        url("/static/mic-photo.png") center 38% / cover no-repeat,
        radial-gradient(1100px 760px at 18% 10%, rgba(255, 106, 61, 0.06), transparent 66%),
        radial-gradient(1100px 760px at 82% 16%, rgba(87, 160, 255, 0.05), transparent 66%),
        linear-gradient(180deg, var(--bs-bg) 0%, var(--bs-bg-2) 100%);
    filter: blur(26px) brightness(0.78) saturate(0.9) contrast(1.12);
    transform: scale(1.08);
    opacity: 0.95;
}

.bg-wash {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(5, 6, 10, 0.60) 0%, rgba(5, 6, 10, 0.76) 45%, rgba(5, 6, 10, 0.86) 100%);
}

/* All visible content above the background layers */
.bs-shell {
    position: relative;
    z-index: 2;
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 3.25rem;
}

.bs-nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

.bs-nav a {
    font-family: "Mona Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
    color: #a5acbb;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: -0.01em;
    padding: 0.4rem 0.1rem;
    border-radius: 0;
    border: none;
    background: transparent;
    transition: color 140ms ease;
    text-decoration: none;
}

.bs-nav a:hover {
    color: #ffffff;
    background: transparent;
    border: none;
}

.bs-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(5, 6, 10, 0.92) 0%, rgba(5, 6, 10, 0.72) 100%);
    border-bottom: 1px solid var(--bs-border);
}

.bs-card {
    background: rgba(10, 12, 18, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 14px;
    box-shadow: var(--bs-shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.bs-doc-card {
    display: block;
    padding: 1.25rem 1.25rem 1.1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    text-decoration: none;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.bs-doc-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.bs-doc-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    margin-bottom: 0.85rem;
}

.bs-doc-title {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    margin: 0 0 0.35rem;
    letter-spacing: -0.005em;
}

.bs-doc-desc {
    font-size: 13.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
}

.agent-table {
    background: transparent !important;
    border-color: rgba(255,255,255,0.10) !important;
}

.agent-table th,
.agent-table td {
    background: transparent !important;
    border-color: rgba(255,255,255,0.10) !important;
}

#agents {
    background: transparent !important;
}

.bs-title {
    font-family: "Mona Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.bs-hero-title {
    font-family: "Mona Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-weight: 600;
    font-size: 3rem;
    letter-spacing: -0.025em;
    line-height: 1.05;
}

.bs-hero-gradient {
    background: linear-gradient(180deg, #fff 0%, rgba(255,255,255,0.62) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.bs-hero-subtitle {
    font-family: "Mona Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.5;
    color: #a5acbb;
    letter-spacing: -0.005em;
}

.bs-muted {
    color: var(--bs-muted);
}

.bs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.11);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.90);
    transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.bs-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.bs-btn-danger {
    background: #5B63D3;
    border-color: #5B63D3;
    color: #ffffff;
    font-weight: 500;
    padding: 0.55rem 1.1rem;
    font-size: 14px;
    border-radius: 10px;
    box-shadow: 0 1px 0 rgba(255,255,255,0.10) inset, 0 6px 16px rgba(91, 99, 211, 0.30);
}

.bs-btn-danger:hover {
    background: #6C75E0;
    border-color: #6C75E0;
    transform: translateY(-1px);
}

.bs-input {
    background: rgba(255, 255, 255, 0.035) !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    border-radius: 14px !important;
    color: rgba(255, 255, 255, 0.92) !important;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    transition: box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.bs-input:focus {
    outline: none !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06) !important;
}

/* Footer */
.bs-footer {
    position: relative;
    z-index: 2;
    border-top: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.bs-footer a {
    color: rgba(255,255,255,0.70);
}

.bs-footer a:hover {
    color: rgba(255,255,255,0.90);
}

/* Version pill in the footer — quiet by default, slightly brighter on hover.
   Rendered as plain text but presented in monospace so the digits don't shift
   width when the build number changes. */
.bs-version-sep {
    margin: 0 0.5em;
    opacity: 0.5;
}
.bs-version {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8em;
    letter-spacing: 0.01em;
    opacity: 0.75;
}
.bs-version:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .bs-shell { padding: 0 1.25rem; }
}

/* ── Scrolling logo ticker (BetterStack-style) ──
   Fade-out on both edges uses a multi-stop mask to ease the transparency
   smoothly instead of a sharp linear cut. The fade zones extend ~22% on
   each side, which matches BetterStack's visual weighting on desktop.
*/
.logo-ticker {
    position: relative;
    z-index: 2;
    overflow: hidden;
    padding: 3rem 0;
    --logo-ticker-mask: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 0, 0, 0.08) 4%,
        rgba(0, 0, 0, 0.30) 9%,
        rgba(0, 0, 0, 0.65) 14%,
        rgba(0, 0, 0, 0.90) 19%,
        #000 24%,
        #000 76%,
        rgba(0, 0, 0, 0.90) 81%,
        rgba(0, 0, 0, 0.65) 86%,
        rgba(0, 0, 0, 0.30) 91%,
        rgba(0, 0, 0, 0.08) 96%,
        transparent 100%
    );
    mask-image: var(--logo-ticker-mask);
    -webkit-mask-image: var(--logo-ticker-mask);
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-size: 100% 100%;
    -webkit-mask-size: 100% 100%;
}

.logo-ticker-track {
    display: flex;
    align-items: center;
    gap: 4.5rem;
    width: max-content;
    animation: ticker-scroll 35s linear infinite;
}

.logo-ticker-track img {
    height: 26px;
    width: auto;
    flex-shrink: 0;
    transition: opacity 0.3s ease;
}

.logo-ticker-track img.logo-filter {
    opacity: 0.40;
    filter: brightness(0) invert(1);
}

.logo-ticker-track img.logo-blend {
    opacity: 0.55;
    mix-blend-mode: screen;
}

.logo-ticker-track img:hover {
    opacity: 0.85;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-25%); }
}

.custom-actions-cell {
    justify-content: space-around !important;
}

/* Updated hover effects with !important flags */
img[src$="ssh.png"], img[src$="vnc.png"], img[src$="status.png"] {
    transition: transform 0.2s ease !important, box-shadow 0.2s ease !important;
}

img[src$="ssh.png"]:hover, img[src$="vnc.png"]:hover, img[src$="status.png"]:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Fix for action buttons container */
.actions-container {
    display: flex !important;
    justify-content: space-evenly !important; /* Changed from space-around to space-evenly for better distribution */
    align-items: center !important;
    width: 100% !important; /* Use full width of container */
    min-width: 180px !important; /* Minimum width to ensure buttons aren't too cramped */
    height: 100% !important;
    padding: 0 10px !important; /* Add some horizontal padding */
}

/* Ensure action buttons are consistently sized and displayed */
.action-button {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 8px !important; /* Increased margin for more spacing */
    width: 50px !important; /* Increased width for each button */
}

/* Style for action icons */
.action-icon {
    height: 32px !important;
    width: 32px !important;
    display: block !important;
    margin: 0 auto !important;
    cursor: pointer !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ── On-load reveal (BetterStack-style fade-up) ──
   Direct analogue of BetterStack's AOS "fade-up": elements start 100px below
   their final position with opacity 0, then transition to translateZ(0)/opacity 1
   over 400ms with a simple ease. A body-level `is-loaded` class is flipped on
   the first frame after DOMContentLoaded to trigger the transition.
*/
.bs-reveal {
    opacity: 0;
    transform: translate3d(0, 140px, 0);
    transition-property: transform, opacity;
    transition-duration: 900ms;
    transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--bs-reveal-delay, 0s);
    will-change: transform, opacity;
}

body.is-loaded .bs-reveal {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* Stagger delays — each element starts shortly after the previous so the
   cascade is visible but cohesive. */
.bs-reveal-1 { --bs-reveal-delay: 0ms; }
.bs-reveal-2 { --bs-reveal-delay: 120ms; }
.bs-reveal-3 { --bs-reveal-delay: 240ms; }
.bs-reveal-4 { --bs-reveal-delay: 360ms; }
.bs-reveal-5 { --bs-reveal-delay: 480ms; }
.bs-reveal-6 { --bs-reveal-delay: 600ms; }

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
    .bs-reveal {
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ── Filter tabs (All / Online / Offline) ── */
.bs-tabs {
    display: inline-flex;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bs-border);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.bs-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.58);
    font-family: "Mona Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: -0.005em;
    border-radius: 9px;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease;
    white-space: nowrap;
}

.bs-tab:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.04);
}

.bs-tab.is-active {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.08) inset,
        0 1px 2px rgba(0, 0, 0, 0.25);
}

.bs-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.70rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.62);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    line-height: 1;
}

.bs-tab.is-active .bs-tab-count {
    color: rgba(255, 255, 255, 0.92);
    background: rgba(91, 99, 211, 0.30);
}

.bs-tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.bs-tab-dot-online {
    background: #2ee9a6;
    box-shadow: 0 0 0 3px rgba(46, 233, 166, 0.12);
}

.bs-tab-dot-offline {
    background: #ff5d5d;
    box-shadow: 0 0 0 3px rgba(255, 93, 93, 0.12);
}

/* ── SSH "tunnel ready" modal ── */
.ssh-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 6, 10, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: bs-modal-fade 180ms ease-out;
}

@keyframes bs-modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ssh-modal {
    background: #0b0d16;
    border: 1px solid var(--bs-border);
    border-radius: 16px;
    box-shadow: var(--bs-shadow);
    width: min(520px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: auto;
    animation: bs-modal-pop 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bs-modal-pop {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ssh-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.35rem 0.9rem;
    border-bottom: 1px solid var(--bs-border);
}

.ssh-modal-header h3 {
    font-family: "Mona Sans", ui-sans-serif, system-ui, sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    letter-spacing: -0.01em;
}

.ssh-modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
    transition: color 140ms ease;
}

.ssh-modal-close:hover {
    color: rgba(255, 255, 255, 0.95);
}

.ssh-modal-body {
    padding: 1.2rem 1.35rem 1.35rem;
    font-family: "Mona Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.82);
}

.ssh-modal-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bs-border);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
}

.ssh-modal-meta > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ssh-modal-meta code {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.92);
    background: transparent;
}

.ssh-modal-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.48);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
}

.ssh-modal-cmd {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--bs-border);
    border-radius: 10px;
    padding: 0.6rem 0.6rem 0.6rem 0.85rem;
    margin-top: 0.45rem;
}

.ssh-modal-cmd code {
    flex: 1;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.95);
    background: transparent;
    word-break: break-all;
}

.ssh-modal-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #5B63D3;
    border: 1px solid #5B63D3;
    color: #ffffff;
    font-family: "Mona Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 140ms ease, transform 140ms ease;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.10) inset;
}

.ssh-modal-copy:hover {
    background: #6C75E0;
    border-color: #6C75E0;
    transform: translateY(-1px);
}

.ssh-modal-copy.copied {
    background: #2e9e66;
    border-color: #2e9e66;
}

.ssh-modal-alt {
    margin-top: 0.9rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
}

.ssh-modal-alt code {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
}

/* ── Player-offline warning modal (amber variant of the SSH modal) ── */
.ssh-modal.is-offline {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow:
        var(--bs-shadow),
        0 0 0 1px rgba(245, 158, 11, 0.18),
        0 0 48px -12px rgba(245, 158, 11, 0.35);
}

.ssh-modal.is-offline .ssh-modal-header {
    border-bottom-color: rgba(245, 158, 11, 0.2);
}

.bs-offline-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.bs-offline-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    color: #f59e0b;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.bs-offline-body {
    font-size: 0.92rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.82);
}

.bs-offline-body p {
    margin: 0 0 0.65rem;
}

.bs-offline-body p:last-child {
    margin-bottom: 0;
}

.bs-offline-mac {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bs-border);
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
}

.bs-offline-hints {
    margin: 0.4rem 0 0;
    padding-left: 1.1rem;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.85rem;
}

.bs-offline-hints li {
    margin-bottom: 0.25rem;
}

.bs-offline-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.1rem;
}

.bs-offline-dismiss {
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    font-family: "Mona Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.5rem 0.95rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 140ms ease, transform 140ms ease, color 140ms ease;
}

.bs-offline-dismiss:hover {
    background: rgba(245, 158, 11, 0.22);
    color: #fde68a;
    transform: translateY(-1px);
}

/* Dim SSH / VNC icons when the player is offline, but keep them clickable
   so the offline modal can explain why the connect action is unavailable. */
.action-icon.is-offline,
.action-button.is-offline .action-icon {
    opacity: 0.35;
    filter: grayscale(0.85);
    cursor: not-allowed;
}

.action-icon.is-offline:hover,
.action-button.is-offline .action-icon:hover {
    transform: none;
    box-shadow: none;
}
