:root {
  --primary: #00ff88;
  --secondary: #4a9eff;
  --danger: #ff4444;
  --warning: #ffaa00;
  --bg-dark: #0a0e27;
  --bg-panel: rgba(10,20,40,0.9);
  --border: rgba(0,255,136,0.3);
  --text: #e0e0e0;
  --text-dim: #999;
}

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

body {
  background: linear-gradient(135deg, #0a0e27 0%, #1a1e35 100%);
  color: var(--text);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  overflow: hidden;
}

/* 登录界面 */
.login-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0a0e27 0%, #1a1e35 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.5s ease;
}

.login-container.hidden {
  display: none !important;
}

.login-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 420px;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 100px rgba(0,255,136,0.1);
  animation: slideUp 0.6s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.login-header {
  text-align: center;
  margin-bottom: 35px;
}

.login-logo {
  font-size: 50px;
  margin-bottom: 15px;
  filter: drop-shadow(0 0 20px rgba(0,255,136,0.5));
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.login-title {
  font-size: 24px;
  font-weight: 300;
  color: var(--primary);
  text-shadow: 0 0 20px rgba(0,255,136,0.5);
  margin-bottom: 5px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-dim);
}

.login-form {
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-input {
  width: 100%;
  padding: 12px 15px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  transition: all 0.3s ease;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  background: rgba(0,0,0,0.5);
  box-shadow: 0 0 20px rgba(0,255,136,0.2);
}

.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px;
  transition: color 0.3s ease;
}

.password-toggle:hover {
  color: var(--primary);
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  border-radius: 8px;
  color: #000;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,255,136,0.3);
}

.btn-login:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-login.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  margin: auto;
  border: 2px solid transparent;
  border-radius: 50%;
  border-top-color: #000;
  animation: spin 1s linear infinite;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-message, .success-message {
  padding: 10px;
  margin-bottom: 15px;
  font-size: 13px;
  border-radius: 6px;
  display: none;
}

.error-message {
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid rgba(255, 68, 68, 0.3);
  color: var(--danger);
}

.success-message {
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.3);
  color: var(--primary);
}

.error-message.show, .success-message.show {
  display: block;
  animation: slideDown 0.3s ease;
}

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

/* 顶部状态栏 */
.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: var(--bg-panel);
  border-bottom: 2px solid var(--primary);
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  backdrop-filter: blur(10px);
  z-index: 9000;
  box-shadow: 0 4px 20px rgba(0,255,136,0.15);
}

.status-bar.active {
  display: flex;
}

.status-info {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
}

.led-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4444;
  box-shadow: 0 0 10px #ff4444;
  animation: pulse-led 2s infinite;
}

.led-dot.connected {
  background: #00ff88;
  box-shadow: 0 0 10px #00ff88;
}

@keyframes pulse-led {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.btn-logout {
  padding: 8px 16px;
  background: rgba(255,68,68,0.2);
  border: 1px solid rgba(255,68,68,0.4);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  background: rgba(255,68,68,0.3);
  transform: translateY(-1px);
}

/* 远程驾驶界面容器 */
#remoteControlApp {
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
}

#remoteControlApp.active {
  display: block;
}

#driverFrame {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg-dark);
}