/* ==========================================================================
   CYBER-3D // 角色與武器編輯器 - 全域科技風樣式表
   ========================================================================== */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: rgba(13, 20, 36, 0.85);
  --bg-panel: rgba(16, 26, 48, 0.75);
  --bg-input: rgba(8, 14, 27, 0.9);
  
  --accent-cyan: #00f0ff;
  --accent-cyan-dim: rgba(0, 240, 255, 0.25);
  --accent-magenta: #ff0055;
  --accent-gold: #ffb700;
  --accent-emerald: #00ff9d;
  
  --text-main: #e2e8f0;
  --text-muted: #8b9bb4;
  --text-bright: #ffffff;
  
  --border-neon: 1px solid rgba(0, 240, 255, 0.35);
  --border-subtle: 1px solid rgba(255, 255, 255, 0.08);
  
  --glow-cyan: 0 0 20px rgba(0, 240, 255, 0.35);
  --glow-magenta: 0 0 20px rgba(255, 0, 85, 0.4);
  --font-display: 'Orbitron', 'Rajdhani', sans-serif;
  --font-content: 'Rajdhani', 'Noto Sans TC', sans-serif;
}

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

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-primary);
  font-family: var(--font-content);
  color: var(--text-main);
  user-select: none;
}

/* 科技背景效果 */
.cyber-grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 1;
}

.vignette-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, transparent 35%, rgba(5, 7, 12, 0.88) 100%);
  pointer-events: none;
  z-index: 2;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* ==========================================================================
   首要載入層：科技感登入介面
   ========================================================================== */
.login-view-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(10px);
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-secondary);
  border: var(--border-neon);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), var(--glow-cyan);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  padding: 40px 36px;
  position: relative;
  overflow: hidden;
  animation: cardFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  animation: scanLine 3s linear infinite;
}

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

.system-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 2px;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(0, 240, 255, 0.25);
  margin-bottom: 12px;
}

.login-header h1 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--text-bright);
  letter-spacing: 1.5px;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

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

.form-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.input-box {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 8px;
  padding: 13px 16px;
  font-size: 1rem;
  color: #fff;
  font-family: var(--font-content);
  outline: none;
  transition: all 0.25s ease;
}

.input-box:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.35);
  background: rgba(10, 18, 36, 0.95);
}

.input-box:disabled {
  background: rgba(30, 30, 40, 0.6);
  border-color: rgba(255, 0, 85, 0.3);
  color: #666;
  cursor: not-allowed;
}

.btn-cyber-primary {
  width: 100%;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(0, 240, 255, 0.05));
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: 14px 20px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  margin-top: 8px;
}

.btn-cyber-primary:hover:not(:disabled) {
  background: var(--accent-cyan);
  color: #060b14;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.65);
  transform: translateY(-1px);
}

.btn-cyber-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-cyber-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #555;
  color: #777;
}

.login-status-box {
  min-height: 48px;
  margin-top: 18px;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.3s ease;
}

.login-status-box.error {
  background: rgba(255, 0, 85, 0.15);
  border: 1px solid var(--accent-magenta);
  color: #ff6b8b;
  box-shadow: var(--glow-magenta);
}

.login-status-box.lock {
  background: rgba(255, 0, 85, 0.25);
  border: 1px solid var(--accent-magenta);
  color: #fff;
  font-weight: 600;
  animation: pulseLock 1.5s infinite;
}

.login-status-box.success {
  background: rgba(0, 255, 157, 0.15);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald);
}

.credential-hints {
  margin-top: 24px;
  padding-top: 16px;
  border-top: var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.credential-hints summary {
  cursor: pointer;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 8px;
  outline: none;
}

.credential-hints ul {
  list-style: none;
  padding-left: 4px;
  line-height: 1.6;
}

.credential-hints code {
  color: #ffb700;
  background: rgba(255, 183, 0, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   3D 編輯器整體佈局
   ========================================================================== */
.editor-layout {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.editor-navbar {
  height: 60px;
  background: rgba(10, 15, 27, 0.92);
  border-bottom: var(--border-neon);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

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

.brand-icon {
  width: 32px;
  height: 32px;
  border: 2px solid var(--accent-cyan);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.9rem;
  color: var(--accent-cyan);
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 1.5px;
  color: #fff;
}

.brand-title span {
  color: var(--accent-cyan);
}

.navbar-user-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--accent-emerald);
  background: rgba(0, 255, 157, 0.1);
  border: 1px solid rgba(0, 255, 157, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
}

.btn-cyber-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cyber-outline:hover {
  border-color: var(--accent-magenta);
  color: var(--accent-magenta);
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.3);
}

/* 編輯器主工作區 (3D Canvas + 側邊面板) */
.editor-workspace {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

#viewport-container {
  flex: 1;
  position: relative;
  background: #0d1117;
  overflow: hidden;
}

#viewport-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* 視圖浮動控制提示 */
.viewport-hud {
  position: absolute;
  top: 16px;
  left: 20px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-chip {
  background: rgba(10, 15, 25, 0.7);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 4px;
  padding: 6px 12px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--text-muted);
  backdrop-filter: blur(6px);
}

.hud-chip span {
  color: var(--accent-cyan);
  font-weight: 700;
}

/* 側邊控制面板 */
.editor-sidebar {
  width: 380px;
  background: var(--bg-panel);
  border-left: var(--border-neon);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 50;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.6);
}

.editor-sidebar::-webkit-scrollbar {
  width: 6px;
}
.editor-sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.2);
  border-radius: 3px;
}

.panel-section {
  padding: 20px 24px;
  border-bottom: var(--border-subtle);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 1.5px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan);
}

.control-row {
  margin-bottom: 14px;
}

.control-label {
  display: block;
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.cyber-select, .cyber-input-field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: #fff;
  border-radius: 6px;
  padding: 10px 14px;
  font-family: var(--font-content);
  font-size: 0.92rem;
  outline: none;
  transition: all 0.2s ease;
}

.cyber-select:focus, .cyber-input-field:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
}

.cyber-select option {
  background: #0f172a;
  color: #fff;
}

/* 顏色選擇器自訂群組 */
.color-picker-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-item {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-item label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input-wrapper input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
}

.color-hex-val {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--accent-cyan);
}

/* 姿勢與微調控制 */
.slider-group {
  margin-top: 10px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.slider-row span {
  font-size: 0.82rem;
  color: var(--text-muted);
  width: 70px;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent-cyan);
}

/* GitHub 儲存專區 */
.github-panel {
  background: rgba(0, 240, 255, 0.03);
  border-radius: 8px;
  border: 1px dashed rgba(0, 240, 255, 0.3);
  padding: 14px;
  margin-top: 10px;
}

.btn-github-save {
  width: 100%;
  background: linear-gradient(135deg, #238636, #2ea043);
  border: 1px solid #3fb950;
  color: #fff;
  padding: 13px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s ease;
  margin-top: 12px;
}

.btn-github-save:hover:not(:disabled) {
  box-shadow: 0 0 20px rgba(46, 160, 67, 0.6);
  transform: translateY(-1px);
}

.btn-github-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.github-log {
  margin-top: 10px;
  font-family: monospace;
  font-size: 0.78rem;
  padding: 8px 10px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-height: 90px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  display: none;
}

.github-log.active {
  display: block;
}

/* 動畫與效果 */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes scanLine {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes pulseLock {
  0%, 100% {
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.3);
  }
  50% {
    box-shadow: 0 0 25px rgba(255, 0, 85, 0.7);
  }
}
