* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #2a2a2a;
    --accent-color: #00d4ff;
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --error-color: #ff4444;
    --success-color: #00cc66;
    --warning-color: #ffaa00;
}

body {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    overflow: hidden;
}

/* Pages */
.page {
    display: none;
    width: 100%;
    height: 100vh;
}

.page.active {
    display: flex;
}

/* Login Page */
#login-page {
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--secondary-color);
    border: 2px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.monitor-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    color: var(--accent-color);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.monitor-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 1.5;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 5px;
    background: linear-gradient(90deg, var(--accent-color), #00a8cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

#password-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
}

#password-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(0, 212, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

#password-input::placeholder {
    color: var(--text-secondary);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(90deg, var(--accent-color), #00a8cc);
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 212, 255, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.error-message {
    color: var(--error-color);
    font-size: 13px;
    margin-top: 10px;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Dashboard Page */
#dashboard-page {
    flex-direction: column;
}

.header {
    background: var(--secondary-color);
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.header-left h1 {
    font-size: 24px;
    background: linear-gradient(90deg, var(--accent-color), #00a8cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.hidden {
    display: none !important;
}

.btn-monitor-switcher {
    background: linear-gradient(180deg, rgba(24, 35, 50, 0.95), rgba(13, 20, 30, 0.95));
    border: 1px solid rgba(0, 212, 255, 0.45);
    color: #b6efff;
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.btn-monitor-switcher:hover {
    background: linear-gradient(180deg, rgba(31, 46, 66, 0.98), rgba(15, 25, 38, 0.98));
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.btn-monitor-switcher svg {
    width: 16px;
    height: 16px;
}

.switch-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #3dffad;
    box-shadow: 0 0 0 4px rgba(61, 255, 173, 0.18), 0 0 12px rgba(61, 255, 173, 0.7);
}

.btn-logout {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff6b6b;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff6b6b;
}

.dashboard-container {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.remote-viewer {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    border: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    display: none;
    flex-direction: column;
}

#dashboard-page.connected-mode .dashboard-container {
    padding: 0;
}

#dashboard-page.connected-mode .remote-viewer {
    display: flex !important;
}

#dashboard-page.connected-mode .viewer-frame-wrap {
    flex: 1;
    min-height: 100vh;
    height: 100vh;
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    background: rgba(0, 0, 0, 0.6);
    min-height: 48px;
    flex-shrink: 0;
}

.viewer-header h3 {
    font-size: 14px;
    letter-spacing: 0.5px;
}

#viewer-monitor-label {
    font-size: 12px;
    color: var(--accent-color);
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-viewer {
    border: 1px solid rgba(0, 212, 255, 0.45);
    background: rgba(0, 212, 255, 0.1);
    color: #cbf7ff;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 12px;
    cursor: pointer;
}

.btn-viewer:hover {
    background: rgba(0, 212, 255, 0.2);
}

.btn-viewer-danger {
    border-color: rgba(255, 107, 107, 0.55);
    background: rgba(255, 68, 68, 0.12);
    color: #ff9f9f;
}

.btn-viewer-danger:hover {
    background: rgba(255, 68, 68, 0.22);
}

.viewer-frame-wrap {
    position: relative;
    background: #05080d;
    min-height: 320px;
}

#remote-frame {
    width: 100%;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #05080d;
}

.remote-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* Floating fullscreen menu */
.fullscreen-menu-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    border: 2px solid rgba(0, 212, 255, 0.6);
    background: rgba(0, 0, 0, 0.7);
    color: var(--accent-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: all 0.2s ease;
}

.fullscreen-menu-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(0, 212, 255, 0.9);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.fullscreen-menu-btn svg {
    width: 24px;
    height: 24px;
}

.fullscreen-menu-panel {
    position: fixed;
    top: 70px;
    right: 16px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid rgba(0, 212, 255, 0.4);
    border-radius: 8px;
    padding: 16px;
    z-index: 1000;
    min-width: 200px;
    max-width: 250px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.fullscreen-menu-panel.hidden {
    display: none;
}

.menu-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.monitor-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.monitor-item {
    padding: 8px 12px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.08);
    border-radius: 6px;
    color: var(--accent-color);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.monitor-item:hover {
    background: rgba(0, 212, 255, 0.18);
    border-color: rgba(0, 212, 255, 0.6);
}

.monitor-item.active {
    background: rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.8);
}

.menu-button {
    padding: 8px 12px;
    border: 1px solid rgba(255, 107, 107, 0.4);
    background: rgba(255, 68, 68, 0.1);
    color: #ff9f9f;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.menu-button:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: rgba(255, 107, 107, 0.7);
}

.menu-button svg {
    width: 16px;
    height: 16px;
}

/* Computer Card */
.computer-card {
    background: var(--secondary-color);
    border: 2px solid rgba(0, 212, 255, 0.1);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.computer-card:hover {
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 212, 255, 0.1);
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.computer-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    color: var(--accent-color);
    opacity: 0.8;
}

.computer-icon svg {
    width: 100%;
    height: 100%;
}

.card-title h2 {
    font-size: 20px;
    margin-bottom: 5px;
}

.card-title p {
    color: var(--text-secondary);
    font-size: 13px;
}

.card-body {
    padding: 20px;
}

/* Status Section */
.status-section,
.signal-section,
.memory-section {
    margin-bottom: 20px;
}

.status-section:last-child,
.signal-section:last-child,
.memory-section:last-child {
    margin-bottom: 0;
}

.status-section label,
.signal-section label,
.memory-section label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 var(--success-color);
    }
    50% {
        opacity: 0.8;
    }
}

#status-text {
    font-size: 14px;
    color: var(--text-primary);
}

/* Signal Bars */
.signal-bars {
    display: flex;
    gap: 6px;
    align-items: flex-end;
    height: 40px;
    margin-bottom: 8px;
}

.signal-bar {
    flex: 1;
    background: rgba(0, 212, 255, 0.2);
    border-radius: 4px;
    height: 10%;
    transition: all 0.3s ease;
}

.signal-bar.active {
    background: linear-gradient(180deg, var(--accent-color), #00a8cc);
    height: 100%;
}

#signal-percent {
    display: block;
    text-align: right;
    font-size: 12px;
    color: var(--accent-color);
    font-weight: 600;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #00a8cc);
    border-radius: 3px;
    transition: width 0.3s ease;
}

#memory-text {
    display: block;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
}

.card-footer {
    padding: 20px;
    border-top: 1px solid rgba(0, 212, 255, 0.1);
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn-connect,
.btn-disconnect {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-connect {
    background: linear-gradient(90deg, var(--accent-color), #00a8cc);
    color: #000;
}

.btn-connect:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 212, 255, 0.3);
}

.btn-disconnect {
    background: rgba(255, 68, 68, 0.1);
    color: #ff6b6b;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.btn-disconnect:hover:not(:disabled) {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff6b6b;
}

.btn-disconnect:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Monitor Selector */
.monitor-selector {
    position: absolute;
    top: 60px;
    right: 30px;
    background: var(--secondary-color);
    border: 2px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.monitor-list {
    padding: 10px;
}

.monitor-item {
    padding: 12px 16px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
    white-space: nowrap;
}

.monitor-item:hover {
    background: rgba(0, 212, 255, 0.1);
}

.monitor-item.active {
    background: rgba(0, 212, 255, 0.2);
    color: var(--accent-color);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-right {
        width: 100%;
        justify-content: space-around;
    }

    .dashboard-container {
        padding: 15px;
    }

    #dashboard-page.connected-mode .remote-viewer {
        width: calc(100vw - 10px);
        height: calc(100vh - 138px);
    }

    #dashboard-page.connected-mode .viewer-frame-wrap {
        min-height: calc(100vh - 194px);
        height: calc(100vh - 194px);
    }

    .computer-card {
        max-width: 100%;
    }

    .card-header {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .computer-icon {
        width: 40px;
        height: 40px;
    }

    .login-card {
        max-width: 90%;
    }
}
