/* ═══════════════════════════════════════════════════════════════════════════
   ExaGuard Remote Desktop — remotedesktop.css  (Light Theme)
   Place in wwwroot/css/ and add to _Host.cshtml:
     <link rel="stylesheet" href="css/remotedesktop.css" />
═══════════════════════════════════════════════════════════════════════════ */

/* ── Root ────────────────────────────────────────────────────────────────── */

.rd-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    background: #f4f4f6;
    color: #1a1a2e;
    font-family: inherit;
    overflow: hidden;
    user-select: none;
}

/* ═══ TOP BAR ════════════════════════════════════════════════════════════ */

.rd-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    height: 52px;
    flex-shrink: 0;
    background: #ffffff;
    border-bottom: 1px solid #e2e2e8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    z-index: 100;
}

.rd-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.rd-topbar-center {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.rd-topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Avatar */
.rd-agent-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #6d28d9;
    flex-shrink: 0;
    border: 1px solid #c4b5fd;
}

.rd-agent-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1;
}

.rd-agent-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: #111128;
    letter-spacing: 0.01em;
}

.rd-agent-sub {
    font-size: 0.68rem;
    color: #9090a0;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Status pill */
.rd-status-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.rd-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.pill-live {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #86efac;
}

    .pill-live .rd-status-dot {
        background: #22c55e;
        animation: rd-dot-pulse 1.4s ease-in-out infinite;
    }

.pill-on {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #c4b5fd;
}

    .pill-on .rd-status-dot {
        background: #7c3aed;
    }

.pill-off {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

    .pill-off .rd-status-dot {
        background: #ef4444;
    }

@keyframes rd-dot-pulse {
    0%,100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.7);
    }
}

/* Stats chips */
.rd-topbar-stats {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.rd-stat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3px 14px;
}

.rd-stat-val {
    font-size: 0.88rem;
    font-weight: 600;
    color: #111128;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.rd-stat-x {
    font-size: 0.6rem;
    color: #b0b0c0;
    margin: 0 1px;
}

.rd-stat-key {
    font-size: 0.58rem;
    color: #b0b0c0;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.rd-stat-divider {
    width: 1px;
    height: 22px;
    background: #e2e2e8;
}

.rd-idle-hint {
    font-size: 0.75rem;
    color: #b0b0c0;
    font-style: italic;
}

.rd-ctrl-sep {
    width: 1px;
    height: 20px;
    background: #e2e2e8;
    margin: 0 4px;
}

/* ═══ BUTTONS ════════════════════════════════════════════════════════════ */

.rd-ctrl-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #e2e2e8;
    background: #f8f8fb;
    color: #6060780;
    font-size: 0.74rem;
    cursor: pointer;
    transition: all 0.12s;
    font-family: inherit;
    white-space: nowrap;
    color: #555568;
}

    .rd-ctrl-btn:hover {
        background: #ededf2;
        border-color: #c8c8d8;
        color: #111128;
    }

.rd-icon-only {
    padding: 5px 8px;
}

.rd-btn-active {
    background: #f5f3ff !important;
    border-color: #c4b5fd !important;
    color: #6d28d9 !important;
}

.rd-caret {
    font-size: 0.5rem;
    opacity: 0.4;
}

.rd-connect-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 16px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: #6d28d9;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
    font-family: inherit;
}

    .rd-connect-btn:hover {
        background: #7c3aed;
    }

    .rd-connect-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

.rd-connect-btn-lg {
    padding: 10px 28px;
    height: auto;
    font-size: 0.9rem;
    border-radius: 8px;
}

.rd-disconnect-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #fca5a5;
    background: #fef2f2;
    color: #dc2626;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
    font-family: inherit;
}

    .rd-disconnect-btn:hover {
        background: #dc2626;
        color: #fff;
        border-color: #dc2626;
    }

/* ═══ DROPDOWNS ══════════════════════════════════════════════════════════ */

.rd-dd {
    position: relative;
}

.rd-dd-panel {
    display: none !important;
    position: absolute !important;
    top: calc(100% + 6px) !important;
    right: 0 !important;
    min-width: 210px;
    background: #ffffff;
    border: 1px solid #e2e2e8;
    border-radius: 10px;
    padding: 8px;
    z-index: 9999 !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

.rd-dd-panel-wide {
    min-width: 260px;
}

.rd-dd.open > .rd-dd-panel {
    display: block !important;
}

.rd-dd-group {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #b0b0c0;
    padding: 5px 8px 3px;
    margin: 0;
}

.rd-dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #555568;
    font-size: 0.76rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s, color 0.1s;
    font-family: inherit;
    white-space: nowrap;
    box-sizing: border-box;
}

    .rd-dd-item:hover {
        background: #f4f4f8;
        color: #111128;
    }

    .rd-dd-item.on {
        background: #f5f3ff;
        color: #6d28d9;
    }

    .rd-dd-item.rd-danger {
        color: #dc2626;
    }

        .rd-dd-item.rd-danger:hover {
            background: #fef2f2;
            color: #b91c1c;
        }

.rd-dd-sep {
    border: none;
    border-top: 1px solid #f0f0f4;
    margin: 6px 0;
}

/* FPS grid */
.rd-fps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 4px;
    padding: 2px 8px 6px;
}

.rd-fps-btn {
    padding: 5px 2px;
    border-radius: 5px;
    border: 1px solid #e2e2e8;
    background: #f8f8fb;
    color: #555568;
    font-size: 0.7rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
    text-align: center;
}

    .rd-fps-btn:hover {
        background: #ededf2;
        color: #111128;
    }

    .rd-fps-btn.on {
        background: #f5f3ff;
        border-color: #c4b5fd;
        color: #6d28d9;
        font-weight: 600;
    }

/* Quality slider */
.rd-q-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 8px 8px;
}

.rd-q-label {
    font-size: 0.65rem;
    color: #b0b0c0;
    white-space: nowrap;
}

.rd-q-slider {
    flex: 1;
    accent-color: #7c3aed;
}

/* Action grid */
.rd-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 2px 4px 4px;
}

.rd-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 6px;
    border-radius: 7px;
    border: 1px solid #e2e2e8;
    background: #f8f8fb;
    color: #555568;
    font-size: 0.65rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
}

    .rd-action-btn i {
        font-size: 1rem;
    }

    .rd-action-btn:hover {
        background: #ededf2;
        border-color: #c8c8d8;
        color: #111128;
    }

/* ═══ THUMBNAIL STRIP ════════════════════════════════════════════════════ */

.rd-thumb-bar {
    flex-shrink: 0;
    background: #f0f0f4;
    border-bottom: 1px solid #e2e2e8;
    padding: 6px 14px;
}

.rd-thumb-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #d0d0dc transparent;
    padding-bottom: 2px;
    align-items: flex-start;
}

.rd-thumb-card {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border: 2px solid #d8d8e4;
    border-radius: 7px;
    overflow: hidden;
    cursor: pointer;
    background: #ffffff;
    transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
    padding: 0;
    font-family: inherit;
}

    .rd-thumb-card:hover {
        border-color: #7c3aed;
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(124,58,237,0.18);
    }

.rd-thumb-active {
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 2px rgba(124,58,237,0.25), 0 4px 12px rgba(124,58,237,0.12) !important;
}

/* FIXED SIZE — never let the canvas resize these */
.rd-thumb-frame {
    position: relative;
    width: 120px !important;
    height: 68px !important;
    min-width: 120px;
    min-height: 68px;
    max-width: 120px;
    max-height: 68px;
    background: #1a1a2e;
    overflow: hidden;
}

.rd-thumb-cv {
    position: absolute;
    top: 0;
    left: 0;
    width: 120px !important;
    height: 68px !important;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.rd-thumb-offline {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8e8f0;
    font-size: 1.4rem;
    color: #c0c0d0;
}

.rd-thumb-live-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    background: #16a34a;
    color: #fff;
    font-size: 0.48rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 1px 4px;
    border-radius: 3px;
}

.rd-thumb-footer {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 7px;
    font-size: 0.62rem;
    color: #8080a0;
    background: #fafafa;
    border-top: 1px solid #eeeef4;
    white-space: nowrap;
}

.rd-thumb-ctrl-icon {
    margin-left: auto;
    color: #7c3aed;
    font-size: 0.6rem;
}

.rd-thumb-active .rd-thumb-footer {
    color: #6d28d9;
    background: #f5f3ff;
}

/* ═══ CANVAS AREA ════════════════════════════════════════════════════════ */

.rd-canvas-area {
    flex: 1;
    position: relative;
    background: #1e1e2e;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
}

.rd-canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    outline: none;
}

/* HUD */
.rd-hud {
    position: absolute;
    top: 14px;
    left: 14px;
    background: rgba(255,255,255,0.92);
    border: 1px solid #e2e2e8;
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 170px;
    pointer-events: none;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.rd-hud-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 3px 0;
    font-size: 0.68rem;
    border-bottom: 1px solid #f0f0f4;
}

    .rd-hud-row:last-child {
        border-bottom: none;
    }

    .rd-hud-row span {
        color: #b0b0c0;
    }

    .rd-hud-row strong {
        color: #333348;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }

/* Idle overlay */
.rd-idle-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(30,30,46,0.88);
    backdrop-filter: blur(4px);
    pointer-events: none;
}

    .rd-idle-overlay > * {
        pointer-events: all;
    }

.rd-idle-screens {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 6px;
}

.rd-idle-screen-icon {
    font-size: 2rem;
    color: #4040608;
    color: #404060;
}

    .rd-idle-screen-icon.primary {
        font-size: 2.8rem;
        color: #7c3aed;
    }

.rd-idle-title {
    font-size: 1rem;
    font-weight: 600;
    color: #d0d0e8;
    margin: 0;
}

.rd-idle-sub {
    font-size: 0.78rem;
    color: #8080a8;
    margin: 0;
}

.rd-spinner {
    width: 36px;
    height: 36px;
    border: 2px solid #404060;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: rd-spin 0.8s linear infinite;
}

@keyframes rd-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══ MODAL ══════════════════════════════════════════════════════════════ */

.rd-modal-bg {
    position: absolute;
    inset: 0;
    background: rgba(30,30,46,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    backdrop-filter: blur(3px);
}

.rd-modal {
    background: #fff;
    border: 1px solid #e2e2e8;
    border-radius: 14px;
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0,0,0,0.16);
}

.rd-modal-icon {
    font-size: 2.2rem;
    color: #d97706;
}

.rd-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111128;
    margin: 0;
}

.rd-modal-msg {
    font-size: 0.82rem;
    color: #555568;
    margin: 0;
    line-height: 1.6;
}

.rd-modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

/* ═══ STATUS BAR ═════════════════════════════════════════════════════════ */

.rd-statusbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    height: 24px;
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid #e8e8f0;
    font-size: 0.65rem;
    color: #b0b0c0;
    font-variant-numeric: tabular-nums;
}

.rd-sb-id {
    color: #d0d0dc;
    font-family: monospace;
    font-size: 0.6rem;
}

.rd-sb-msg {
    color: #8080a0;
}

.rd-sb-spacer {
    flex: 1;
}

.rd-sb-right {
    color: #b0b0c0;
}
