/* ============================================================
   GLOBAL
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    user-select: none;
    -webkit-user-select: none;
    position: fixed;
    top: 0;
    left: 0;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.screen.active {
    display: flex;
}

/* ============================================================
   LOGIN SAHIFA
   ============================================================ */
#login-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a3e 50%, #0f0f1a 100%);
}

.login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    width: 380px;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.login-card h1 {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.subtitle {
    color: #888;
    font-size: 14px;
    margin-bottom: 32px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: #5b6eea;
    box-shadow: 0 0 0 3px rgba(91, 110, 234, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #5b6eea, #8b5cf6);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(91, 110, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.error-text {
    color: #ef4444;
    font-size: 13px;
    margin-top: 12px;
    min-height: 20px;
}

/* ============================================================
   TOOLBAR
   ============================================================ */
#toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(15, 15, 26, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    height: 44px;
    flex-shrink: 0;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    display: inline-block;
}

.status-dot.connected {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-dot.disconnected {
    background: #ef4444;
}

#status-text {
    font-size: 13px;
    color: #999;
}

.fps {
    font-size: 11px;
    color: #666;
    font-family: monospace;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.tool-btn.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* ============================================================
   CANVAS (EKRAN)
   ============================================================ */
#desktop-screen {
    flex-direction: column;
}

#canvas-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #000;
    cursor: default;
    touch-action: none;
    min-height: 0;
    min-width: 0;
}

#remote-canvas {
    display: block;
    position: absolute;
}

/* ============================================================
   MOBIL BOSHQARUV
   ============================================================ */
#mobile-controls {
    display: none;
    justify-content: center;
    gap: 10px;
    padding: 8px;
    background: rgba(15, 15, 26, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ccc;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.mobile-btn:active {
    background: rgba(91, 110, 234, 0.3);
}

.mobile-btn.active {
    background: rgba(91, 110, 234, 0.4);
    border-color: #5b6eea;
    color: #fff;
}

/* ============================================================
   MOBIL MOSLASHTIRISH
   ============================================================ */
@media (max-width: 768px) {
    #mobile-controls {
        display: flex;
    }

    .tool-btn {
        padding: 5px 8px;
        font-size: 12px;
    }

    #toolbar {
        padding: 4px 8px;
        height: 40px;
    }

    .toolbar-right {
        gap: 6px;
    }

    #btn-keyboard, #btn-quality-down, #btn-quality-up {
        display: none;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }

    .login-card h1 {
        font-size: 22px;
    }

    #fps-counter {
        display: none;
    }
}

/* ============================================================
   LOADING ANIMATSIYA
   ============================================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.loading {
    animation: pulse 1.5s infinite;
}
