/* ── Remote Connect Modal (Landing Page) ── */
.rc-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    /* Ensure completely hidden default state */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition: opacity 0.35s var(--ease), visibility 0.35s;
}

.rc-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.rc-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-hover);
    border-radius: 22px;
    padding: 48px 44px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.4s var(--ease);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
}

.rc-overlay.active .rc-modal {
    transform: none;
}

.rc-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent-border), transparent);
}

.rc-modal h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.rc-modal p {
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 28px;
    line-height: 1.6;
}

.rc-input {
    width: 100%;
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-hover);
    background: var(--bg);
    color: var(--white);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 3px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.rc-input:focus {
    border-color: var(--accent);
}

/* Override letter spacing for password field */
.rc-input[type="password"] {
    letter-spacing: normal;
}

.rc-btn {
    width: 100%;
    margin-top: 16px;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: var(--white);
    color: #000;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.3s var(--ease), box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.rc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(255, 255, 255, 0.15);
}

.rc-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.rc-status {
    margin-top: 16px;
    font-size: 0.82rem;
    color: var(--muted);
    min-height: 20px;
}

.rc-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px;
}

.rc-close:hover {
    color: var(--white);
}

/* ── Remote View (Dashboard) ── */
.dashboard-view {
    display: none;
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1000;
    overflow: hidden;
}

.dashboard-view.active {
    display: block;
}

.landing-view.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

* {
    -webkit-tap-highlight-color: transparent;
}

/* ── Fullscreen Video Feed ── */
.cmd-video-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    z-index: 10;
}

.cmd-video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.cmd-video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #555555;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 1px;
}

.cmd-video-overlay i {
    font-size: 3rem;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.cmd-video-overlay.hidden {
    display: none;
}

/* ── Floating Top Header ── */
.remote-header {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    pointer-events: none;
}

.remote-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid #1a1a1a;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
    pointer-events: auto;
}

.remote-brand img {
    height: 18px;
}

.cmd-ping-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #51cf66;
    box-shadow: 0 0 10px rgba(81, 207, 102, 0.5);
    animation: blink 2.4s ease-in-out infinite;
}

.remote-actions {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

/* Monitor Select */
.dash-select {
    /* Use background-color instead of background so we don't overwrite the image */
    background-color: rgba(10, 10, 10, 0.7);

    /* Custom SVG Arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23c9d1d9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;

    /* Hide default browser arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    backdrop-filter: blur(8px);
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    color: #c9d1d9;
    padding: 8px 32px 8px 12px;
    /* Added extra right padding so text doesn't overlap arrow */
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    max-width: 150px;
    text-overflow: ellipsis;
}

.dash-select:hover,
.dash-select:focus {
    background-color: #111111;
    /* Update SVG arrow to white to match the text on hover */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    color: #fff;
    border-color: var(--accent);
}

/* Style the dropdown options so they match the dark theme */
.dash-select option {
    background-color: #111111;
    color: #c9d1d9;
}

.cmd-btn-danger {
    background: rgba(255, 107, 107, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cmd-btn-danger:hover {
    background: rgba(255, 107, 107, 0.25);
    transform: translateY(-1px);
}

.dash-fullscreen-btn {
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    color: #c9d1d9;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.dash-fullscreen-btn:hover {
    background: #111111;
    color: #fff;
}

/* ── Mobile Controls (Toolbar & Keyboard) ── */
.mobile-controls-bar {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #1a1a1a;
    z-index: 50;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.mc-btn {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #c9d1d9;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mc-btn.active {
    background: rgba(88, 166, 255, 0.2);
    color: #58a6ff;
    border-color: #58a6ff;
    box-shadow: inset 0 0 10px rgba(88, 166, 255, 0.2);
}

.mc-btn:active {
    transform: scale(0.95);
}

/* Full Virtual Keyboard */
.mobile-keyboard {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 98%;
    max-width: 800px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid #1a1a1a;
    z-index: 50;
    display: none;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
}

.mobile-keyboard.active {
    display: flex;
}

.mk-row {
    display: flex;
    gap: 4px;
    justify-content: center;
    width: 100%;
}

.mk-key {
    flex: 1;
    height: 40px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e1e1e1;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
    box-sizing: border-box;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.mk-key.active,
.mk-key:active {
    background: rgba(88, 166, 255, 0.4);
    color: #fff;
    border-color: #58a6ff;
    transform: scale(0.95);
}

/* Toggle state for Shift and Caps Lock */
.mk-key.toggled {
    background: rgba(88, 166, 255, 0.4);
    color: #fff;
    border-color: #58a6ff;
    box-shadow: inset 0 0 8px rgba(88, 166, 255, 0.3);
}

/* F-key mode: number keys showing F1-F12 */
.mk-key.fkey-mode {
    background: rgba(88, 166, 255, 0.12);
    color: #58a6ff;
    border-color: rgba(88, 166, 255, 0.4);
    font-size: 0.65rem;
}

.mk-w15 {
    flex: 1.5;
    font-size: 0.65rem;
}

.mk-w20 {
    flex: 2.0;
    font-size: 0.65rem;
}

.mk-w25 {
    flex: 2.5;
    font-size: 0.65rem;
}

.mk-space {
    flex: 6.0;
}

/* Mobile Small Screen / Space Savers */
@media (max-width: 650px) {
    .hide-mobile {
        display: none !important;
    }

    .dash-select {
        max-width: 110px;
    }
}

/* Landscape Tweaks */
@media (orientation: landscape) and (max-height: 600px) {
    .mobile-keyboard {
        bottom: 10px;
        padding: 4px;
        gap: 2px;
    }

    .mk-row {
        gap: 2px;
    }

    .mk-key {
        height: 32px;
        font-size: 0.7rem;
    }

    .remote-header {
        top: 8px;
        left: 8px;
        right: 8px;
    }

    /* Keep the controls centered directly under the header to avoid overlap */
    .mobile-controls-bar {
        top: 54px;
        transform: translateX(-50%);
        left: 50%;
        right: auto;
        padding: 4px 8px;
    }

    .mc-btn {
        width: 34px;
        height: 34px;
    }
}