:root {
  --bg-dark: #0a0e14;
  --bg-card: rgba(21, 26, 35, 0.85);
  --bg-panel: rgba(15, 19, 26, 0.95);
  --accent: #00d2ff;
  --accent-glow: rgba(0, 210, 255, 0.35);
  --accent-hover: #3a7bd5;
  --text-main: #f0f4fc;
  --text-muted: #8c9ba5;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 210, 255, 0.5);
  --success: #00e676;
  --danger: #ff5252;
  --warning: #ffab00;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.view-container {
  width: 100%;
  height: 100%;
  position: relative;
}

/* ==================== LOGIN VIEW ==================== */
#login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #151e2e 0%, #0a0e14 70%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 210, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-header {
  text-align: center;
}

.logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.15), rgba(58, 123, 213, 0.25));
  border: 1px solid var(--border-focus);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.card-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.status-indicator-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-family: var(--font-mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-dot.offline {
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

.status-dot.warning {
  background-color: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.error-msg {
  background: rgba(255, 82, 82, 0.15);
  border: 1px solid var(--danger);
  color: #ff8a80;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

.btn {
  border: none;
  cursor: pointer;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn {
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #fff;
  width: 100%;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.primary-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==================== DESKTOP VIEW ==================== */
#desktop-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
}

#top-bar {
  height: 42px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  user-select: none;
}

.bar-left, .bar-center, .bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-family: var(--font-mono);
}

#scale-mode {
  padding: 4px 8px;
  font-size: 12px;
  height: 28px;
  border-radius: 6px;
}

.key-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s;
}

.key-btn:hover {
  background: rgba(0, 210, 255, 0.15);
  border-color: var(--accent);
}

.key-btn:active {
  transform: translateY(1px);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.logout-btn:hover {
  color: var(--danger);
  background: rgba(255, 82, 82, 0.15);
}

#screen {
  flex: 1;
  width: 100%;
  height: calc(100vh - 42px);
  background: #000;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#screen canvas {
  outline: none;
}

/* ==================== OFFLINE SCREEN ==================== */
#offline-screen {
  position: absolute;
  top: 42px;
  left: 0;
  width: 100%;
  height: calc(100vh - 42px);
  background: rgba(10, 14, 20, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.offline-card {
  max-width: 440px;
  text-align: center;
  padding: 40px 30px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.offline-card h3 {
  font-size: 20px;
}

.offline-card p {
  color: var(--text-muted);
  font-size: 14px;
}

.offline-hint {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  color: #adb5bd;
}

.radar-pulse {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 82, 82, 0.2);
  border: 2px solid var(--danger);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 1; box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.6); }
  70% { transform: scale(1.1); opacity: 0.8; box-shadow: 0 0 0 16px rgba(255, 82, 82, 0); }
  100% { transform: scale(0.9); opacity: 1; }
}

/* ==================== MODAL ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}
