/* MobileVNC v2 — styles.css
   Purpose: Dark theme CSS for carousel, toolbar, touch overlay, auth screen.
   DO NOT OVERWRITE without reading the full file first. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

/* Status Bar */
#status-bar {
    position: fixed; top: 0; left: 0; right: 0; height: 32px;
    background: rgba(22, 33, 62, 0.7); display: flex; align-items: center;
    padding: 0 12px; gap: 6px; z-index: 100;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#status-dot {
    width: 10px; height: 10px; border-radius: 50%; background: #e74c3c; flex-shrink: 0;
}
#status-dot.connected { background: #2ecc71; }
#status-dot.connecting, #status-dot.reconnecting { background: #f39c12; }
#status-text { font-size: 13px; color: #a0a0c0; }

/* Auth Screen */
#auth-screen {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.auth-card {
    background: #16213e; border: 1px solid #2a2a4a; border-radius: 12px;
    padding: 32px 24px; width: 100%; max-width: 360px; text-align: center;
}
.auth-card h1 { font-size: 24px; margin-bottom: 8px; color: #fff; }
.auth-card p { font-size: 14px; color: #8888aa; margin-bottom: 24px; }
.auth-inputs {
    display: flex; flex-direction: row; gap: 12px; margin-bottom: 16px;
}
.auth-input-group {
    display: flex; flex-direction: column; align-items: flex-start; flex: 1;
}
.auth-input-group label {
    font-size: 11px; color: #8888aa; text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.auth-input-group input {
    width: 100%; padding: 14px 12px;
    font-family: 'SF Mono', 'Fira Code', monospace; font-size: 18px; letter-spacing: 2px;
    background: #0f0f23; border: 1px solid #3a3a5a; border-radius: 8px;
    color: #e0e0e0; outline: none; text-align: center;
}
.auth-input-group input:focus { border-color: #5a5aff; }
#connect-btn {
    width: 100%; padding: 14px; font-size: 16px; font-weight: 600;
    background: #5a5aff; color: #fff; border: none; border-radius: 8px;
    cursor: pointer; min-height: 44px;
}
#connect-btn:active { background: #4a4ae0; }

/* Approval Overlay */
#approval-overlay {
    position: fixed; inset: 0; z-index: 300;
    display: flex; align-items: center; justify-content: center;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.approval-card {
    background: #16213e; border: 1px solid #2a2a4a; border-radius: 16px;
    padding: 40px 32px; text-align: center; min-width: 240px;
    display: flex; flex-direction: column; align-items: center; gap: 20px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}
.approval-card p {
    font-size: 15px; color: #c0c0d8; margin: 0;
}
.spinner {
    width: 40px; height: 40px; border-radius: 50%;
    border: 3px solid #2a2a4a; border-top-color: #5a5aff;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Active Window */
#active-window {
    position: fixed; top: 32px; left: 0;
    width: 100vw;
    bottom: 68px;
    overflow: hidden;
    background: #111;
    z-index: 1;
}
#active-window img.card-frame {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center top;
}

/* Hidden carousel cards (off-screen, hold state) */
.window-card { display: none; }
.card-header {
    position: absolute; top: 0; left: 0; right: 0; height: 32px;
    background: rgba(0,0,0,0.6); display: flex; align-items: center;
    padding: 0 12px; gap: 8px; z-index: 10;
    font-size: 13px; color: #ccc;
}
.card-header img.card-icon { width: 16px; height: 16px; border-radius: 3px; }

/* Touch Overlay */
.touch-overlay {
    position: absolute; top: 0; left: 0; width: 100vw; height: 100%; z-index: 5;
}
.ax-target {
    position: absolute; border: none; background: transparent;
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.ax-target.highlight {
    background: rgba(90, 90, 255, 0.3);
    transition: background 150ms ease-out;
}

/* Mobile Mode Badge */
.mobile-mode-badge {
    position: absolute; top: 36px; right: 8px;
    background: #5a5aff; color: white; font-size: 10px;
    padding: 2px 6px; border-radius: 4px; z-index: 15;
}

/* Minimized Overlay */
.minimized-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #888; z-index: 20;
}

/* FAB (Floating Action Button) */
#fab-toggle {
    position: fixed; bottom: 76px; right: 16px;
    width: 50px; height: 50px; border-radius: 50%;
    background: rgba(90, 90, 255, 0.9); color: white; border: none;
    font-size: 22px; cursor: pointer; z-index: 60;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#fab-toggle:active { transform: scale(0.9); }

#fab-panel {
    position: fixed; bottom: 134px; right: 16px;
    background: rgba(22, 33, 62, 0.95); border-radius: 16px;
    padding: 12px; z-index: 55; display: none;
    flex-direction: column; gap: 8px; width: 280px;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(90, 90, 255, 0.2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
#fab-panel.open { display: flex; }

#fab-panel .panel-section { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
#fab-panel .panel-label { font-size: 10px; color: #666; text-transform: uppercase; letter-spacing: 1px; padding: 4px 0 2px; }

/* Toolbar buttons (inside FAB panel) */
#toolbar {
    display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
}
#toolbar button {
    min-width: 40px; min-height: 40px; border-radius: 10px;
    border: 1px solid #3a3a6a; background: #2a2a5a; color: #e0e0e0;
    font-size: 12px; font-weight: 600; cursor: pointer;
}
#toolbar button:active { background: #3a3a7a; }
#toolbar .mod-key.active { background: #5a5aff; color: white; border-color: #7a7aff; }
#toolbar #tb-disconnect { background: #5a2a2a; border-color: #8a4a4a; }

/* Window Switcher Bar — fixed at bottom */
#window-switcher {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 68px;
    display: flex; justify-content: center; align-items: center;
    gap: 10px; padding: 8px 16px;
    background: rgba(16, 16, 32, 0.95);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid #2a2a4a;
    overflow-x: auto; flex-wrap: nowrap;
    z-index: 40;
}
#window-switcher::-webkit-scrollbar { display: none; }
.switcher-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: rgba(42, 42, 90, 0.9); border: 2px solid transparent;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; overflow: hidden;
}
.switcher-icon.active { border-color: #5a5aff; background: rgba(90, 90, 255, 0.3); }
.switcher-icon img { width: 24px; height: 24px; border-radius: 5px; }
.switcher-icon .fallback { font-size: 10px; color: #aaa; }

/* === Sidebar === */
#sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 64px;
    background: rgba(16, 16, 32, 0.95); border-right: 1px solid #2a2a4a;
    display: none; flex-direction: column; align-items: center;
    padding: 8px 0; gap: 8px; z-index: 50;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#sidebar-windows {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; gap: 8px; padding: 8px 0;
    overflow-y: auto;
}
#sidebar-windows::-webkit-scrollbar { display: none; }
.sidebar-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: #2a2a5a; border: 2px solid transparent;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; overflow: hidden;
}
.sidebar-icon.active { border-color: #5a5aff; background: rgba(90, 90, 255, 0.3); }
.sidebar-icon img { width: 24px; height: 24px; border-radius: 5px; }
.sidebar-icon .fallback { font-size: 10px; color: #aaa; }
#sidebar-gear {
    width: 40px; height: 40px; border-radius: 10px;
    background: #2a2a5a; border: none; color: #888;
    font-size: 18px; cursor: pointer; margin-bottom: 8px;
    display: flex; align-items: center; justify-content: center;
}
#sidebar-gear:hover { background: #3a3a7a; color: #ccc; }

/* === Top Bar (desktop/tablet) === */
#top-bar {
    position: fixed; top: 0; left: 64px; right: 0; height: 40px;
    background: rgba(22, 33, 62, 0.85); display: none; align-items: center;
    padding: 0 16px; gap: 12px; z-index: 50;
    border-bottom: 1px solid #2a2a4a;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#top-bar-title { color: #5a5aff; font-size: 13px; font-weight: 600; }
.kb-hint { color: #666; font-size: 11px; }
#top-bar-status { color: #2ecc71; font-size: 11px; margin-left: auto; }
.capture-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #666; display: inline-block;
}
.capture-dot.active { background: #2ecc71; }
#top-bar-tools { display: flex; gap: 6px; }
#top-bar-tile-toggle {
    padding: 4px 10px; font-size: 12px; border-radius: 6px;
    background: #2a2a5a; color: #aaa; border: 1px solid #3a3a6a;
    cursor: pointer;
}
#top-bar-tile-toggle.active {
    background: rgba(90, 90, 255, 0.2); color: #5a5aff;
    border-color: #5a5aff;
}

/* === Tile Container === */
#tile-container {
    position: fixed; top: 40px; left: 64px; right: 0; bottom: 0;
    display: none; gap: 4px; padding: 4px;
    background: #0f0f1a;
}
#tile-container.active {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-auto-rows: 1fr;
}
.tile {
    background: #1a1a2e; border-radius: 4px; border: 1px solid #2a2a4a;
    display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
}
.tile.focused { border-color: #5a5aff; border-width: 2px; }
.tile-header {
    padding: 4px 8px; font-size: 11px; color: #888;
    border-bottom: 1px solid #2a2a4a; flex-shrink: 0;
}
.tile-header.focused { color: #5a5aff; }
.tile img {
    flex: 1; width: 100%; object-fit: contain; object-position: center top;
    min-height: 0;
}

/* === Settings Panel === */
#settings-panel {
    position: fixed; top: 0; right: -400px; bottom: 0; width: 380px;
    background: rgba(16, 16, 32, 0.98); z-index: 200;
    border-left: 1px solid #2a2a4a; transition: right 0.3s ease;
    overflow-y: auto;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#settings-panel.open { right: 0; }
.settings-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #2a2a4a;
}
.settings-header h2 { font-size: 18px; color: #e0e0e0; }
#settings-close {
    background: none; border: none; color: #888; font-size: 24px;
    cursor: pointer; padding: 4px;
}
#settings-content { padding: 16px 20px; }
.settings-section { margin-bottom: 24px; }
.settings-section h3 {
    font-size: 13px; color: #5a5aff; text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 12px;
}
.settings-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid #1a1a3a;
}
.settings-row label { color: #aaa; font-size: 13px; }
.settings-row select, .settings-row input {
    background: #2a2a5a; border: 1px solid #3a3a6a; color: #e0e0e0;
    border-radius: 6px; padding: 4px 8px; font-size: 13px;
}

/* === Fn Badge === */
.fn-badge {
    font-size: 9px; background: #5a5aff; color: white;
    padding: 1px 4px; border-radius: 3px; margin-left: 4px;
}

/* === Tablet Inline Toolbar Buttons === */
.tablet-tool-btn {
    padding: 4px 10px; font-size: 12px; border-radius: 6px;
    background: #2a2a5a; color: #aaa; border: 1px solid #3a3a6a;
    cursor: pointer;
}
.tablet-tool-btn:hover { background: #3a3a7a; color: #ccc; }
.tablet-tool-btn.disconnect { background: #5a2a2a; border-color: #8a4a4a; }

/* === Desktop breakpoint (>1024px) === */
@media (min-width: 1025px) {
    #sidebar { display: flex; }
    #top-bar { display: flex; }
    #status-bar { display: none; }
    #window-switcher { display: none !important; }
    #fab-toggle { display: none !important; }
    #fab-panel { display: none !important; }
    #active-window {
        top: 40px; left: 64px; bottom: 0;
    }
}

/* === Tablet breakpoint (768-1024px) === */
@media (min-width: 768px) and (max-width: 1024px) {
    #sidebar { display: flex; }
    #top-bar { display: flex; }
    #status-bar { display: none; }
    #window-switcher { display: none !important; }
    #fab-toggle { display: none !important; }
    #fab-panel { display: none !important; }
    #active-window {
        top: 40px; left: 64px; bottom: 0;
    }
    .kb-hint { display: none !important; }
    #top-bar-tile-toggle { display: none; }
}
