/* ═══════════════════════════════════════════════
   HT 在线安装部署 — 红色主题 UI
   Modern glassmorphism + particle background
   ═══════════════════════════════════════════════ */

:root {
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-200: #fecaca;
  --red-400: #f87171;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --red-800: #991b1b;
  --red-900: #7f1d1d;
  --bg-primary: #0a0a0f;
  --bg-card: rgba(18, 18, 28, 0.85);
  --bg-input: rgba(10, 10, 18, 0.3);
  --border: rgba(220, 38, 38, 0.15);
  --border-focus: rgba(239, 68, 68, 0.5);
  --text-primary: #f5f5f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --glass: rgba(255, 255, 255, 0.03);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --glow: 0 0 40px rgba(239, 68, 68, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ═══ Particle Canvas ═══ */
#particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ═══ Navbar ═══ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  background: rgba(10, 10, 15, 0.4);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
}

.brand-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.brand-highlight {
  background: linear-gradient(135deg, var(--red-500), var(--red-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-left: 4px;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--red-400);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-btn {
  padding: 5px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  color: var(--red-400);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--red-500);
  color: #fff;
}

.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red-500);
  animation: pulse 1.5s infinite;
}

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

/* ═══ Main Layout ═══ */
.main-layout {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0;
  padding: 64px 0 0;
  height: 100vh;
  max-width: 100%;
  margin: 0;
}

/* ═══ Card Base ═══ */
.card {
  background: rgba(10, 10, 18, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: none;
  box-shadow: var(--shadow);
}

/* ═══ Form Card ═══ */
.form-card {
  width: 440px;
  min-width: 400px;
  padding: 28px 32px;
  overflow-y: auto;
  height: calc(100vh - 64px);
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-left: none;
  background: rgba(5, 5, 12, 0.2);
  backdrop-filter: none;
}

.card-header { margin-bottom: 24px; }
.card-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.card-desc { font-size: 13px; color: var(--text-muted); }

.form-section { margin-top: 20px; }
.section-label {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #ffffff;
  margin-bottom: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
}

.req { color: var(--red-500); }
.optional { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.form-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }
.flex-3 { flex: 3; }

/* Input Styles */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  width: 16px; height: 16px;
  fill: var(--text-muted);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 11px 12px 11px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s;
}

.input-plain {
  width: 100%;
  padding: 11px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s;
}

.input-wrapper input:focus,
.input-plain:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.key-textarea {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  resize: vertical;
  transition: border-color 0.2s;
}
.key-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn svg {
  width: 16px; height: 16px;
  fill: currentColor;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--red-700), var(--red-600));
  border-color: var(--red-500);
  color: #fff;
}

/* Deploy Button */
.btn-deploy {
  width: 100%;
  margin-top: 24px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--red-600), var(--red-500));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-deploy:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.4);
}

.btn-deploy:active:not(:disabled) {
  transform: translateY(0);
}

.btn-deploy:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-content svg {
  width: 18px; height: 18px;
  fill: currentColor;
}

.btn-content.loading { gap: 10px; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

form.disabled { opacity: 0.6; pointer-events: none; }

/* ═══ Terminal Section ═══ */
.terminal-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: calc(100vh - 64px);
  padding: 20px 24px;
  overflow-y: auto;
}

/* Progress Bar */
.progress-bar-container {
  background: rgba(10, 10, 15, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.1);
  border-radius: var(--radius);
  padding: 16px 20px;
  backdrop-filter: none;
  margin-bottom: 16px;
}

/* Info Panel */
.info-panel {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.info-block {
  flex: 1;
  background: rgba(10, 10, 18, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.1);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.info-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--red-400);
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-key {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.info-val {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.security-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.security-list li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.security-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red-500);
  box-shadow: 0 0 6px var(--red-500);
}

.progress-stages {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stage-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.3s;
}

.stage.done .stage-dot { background: var(--red-500); box-shadow: 0 0 8px var(--red-500); }
.stage.active .stage-dot { background: var(--red-400); animation: pulse 1s infinite; }

.stage-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.stage.done .stage-label,
.stage.active .stage-label { color: var(--text-secondary); }

.progress-track {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red-700), var(--red-500), var(--red-400));
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Terminal Card */
.terminal-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(5, 5, 10, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.08);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 300px;
  backdrop-filter: none;
}

.terminal-chrome {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(239, 68, 68, 0.08);
}

.chrome-dots {
  display: flex;
  gap: 6px;
  margin-right: 12px;
}

.chrome-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.chrome-dots span:nth-child(1) { background: #ff5f57; }
.chrome-dots span:nth-child(2) { background: #febc2e; }
.chrome-dots span:nth-child(3) { background: #28c840; }

.chrome-title {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.chrome-badge {
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.chrome-badge.success { background: rgba(34,197,94,0.15); color: #4ade80; }
.chrome-badge.failed { background: rgba(239,68,68,0.15); color: var(--red-400); }
.chrome-badge:not(.success):not(.failed) { background: rgba(239,68,68,0.1); color: var(--red-400); }

#terminal {
  flex: 1;
  padding: 8px;
}

#terminal .xterm,
#terminal .xterm-viewport,
#terminal .xterm-screen {
  background: transparent !important;
}

/* Result Card */
.result-card {
  background: rgba(5, 40, 20, 0.5);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius);
  padding: 20px;
  animation: slideUp 0.4s ease;
  margin-top: 16px;
  backdrop-filter: blur(8px);
}

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

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.result-header svg {
  width: 24px; height: 24px;
  fill: #4ade80;
}

.result-header h3 {
  font-size: 16px;
  color: #4ade80;
}

.result-body { display: flex; flex-direction: column; gap: 10px; }

.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 70px;
}

.result-value {
  font-size: 13px;
  color: var(--text-primary);
}

.result-value.link {
  color: var(--red-400);
  text-decoration: none;
  word-break: break-all;
}
.result-value.link:hover { text-decoration: underline; }

code.result-value {
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', monospace;
}

.result-warning {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #fbbf24;
}

/* Error Card */
.error-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(60, 10, 10, 0.4);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  animation: slideUp 0.4s ease;
  margin-top: 16px;
  backdrop-filter: blur(8px);
}

.error-card svg {
  width: 20px; height: 20px;
  fill: var(--red-400);
  flex-shrink: 0;
  margin-top: 2px;
}

.error-card h4 {
  font-size: 14px;
  color: var(--red-400);
  margin-bottom: 4px;
}

.error-card p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(239, 68, 68, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(239, 68, 68, 0.4); }

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
  .main-layout { flex-direction: column; padding: 64px 0 0; height: auto; }
  .form-card { width: 100%; min-width: unset; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .terminal-section { height: 60vh; padding: 16px; }
}
