/* ========== UI 組件 ========== */

/* ===== 彈窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}

.modal {
  background: linear-gradient(145deg, #1a1040, #0d0b2e);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  width: 90%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 0 40px rgba(108, 43, 217, 0.3);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--gold);
}

.modal-body {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ===== 數字鍵盤 ===== */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 300px;
  margin: 0 auto;
}

.numpad-key {
  aspect-ratio: 1.6;
  border: none;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.numpad-key:active {
  background: rgba(108, 43, 217, 0.3);
  transform: scale(0.95);
}

.numpad-key.key-delete {
  font-size: 18px;
  color: var(--danger);
}

.numpad-key.key-confirm {
  background: linear-gradient(135deg, var(--purple-mid), var(--blue-mid));
  color: #fff;
  font-size: 16px;
  box-shadow: var(--glow-purple);
}

.numpad-display {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.numpad-digit {
  width: 44px;
  height: 54px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--glass-border);
  background: var(--glass-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--cyan-neon);
  transition: border-color 0.2s;
}

.numpad-digit.active {
  border-color: var(--cyan-neon);
  box-shadow: var(--glow-cyan);
}

.numpad-digit.filled {
  border-color: var(--purple-light);
}

/* ===== 滑桿 ===== */
.slider-group {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
}

.slider-label {
  font-size: 14px;
  color: var(--text-secondary);
  min-width: 60px;
}

.slider-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan-neon);
  min-width: 36px;
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple-mid), var(--cyan-neon));
  box-shadow: var(--glow-cyan);
  cursor: pointer;
}

/* ===== Tab 切換 ===== */
.tab-bar {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 4px;
}

.tab-item {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: calc(var(--radius-lg) - 4px);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  text-align: center;
}

.tab-item.active {
  background: linear-gradient(135deg, var(--purple-mid), var(--blue-mid));
  color: #fff;
  box-shadow: var(--glow-purple);
}

/* ===== 底部 Tab 導航 ===== */
.bottom-tabs {
  display: flex;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  padding: 6px 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}

.bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.2s;
}

.bottom-tab .tab-icon {
  font-size: 22px;
  line-height: 1;
}

.bottom-tab.active {
  color: var(--cyan-neon);
}

.bottom-tab.active .tab-icon {
  filter: drop-shadow(0 0 8px var(--cyan-neon));
}

/* ===== 表單 ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.form-input::placeholder {
  color: var(--text-muted);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

/* ===== 切換開關 ===== */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.toggle-row-label {
  font-size: 14px;
  color: var(--text-primary);
}

.toggle {
  width: 48px;
  height: 26px;
  border-radius: 13px;
  background: rgba(255,255,255,0.1);
  border: none;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle.on {
  background: var(--purple-mid);
}

.toggle::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
}

.toggle.on::after {
  transform: translateX(22px);
}

/* ===== 選擇器按鈕組 ===== */
.selector-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.selector-btn {
  padding: 8px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--glass-border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.selector-btn.active {
  border-color: var(--cyan-neon);
  color: var(--cyan-neon);
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
}

/* ===== 通知/徽章 ===== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.badge-gold {
  background: var(--gold);
  color: #1a0a2e;
}

.badge-purple {
  background: var(--purple-mid);
  color: #fff;
}

/* ===== 列表項 ===== */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.15s;
}

.list-item:active {
  background: rgba(255,255,255,0.04);
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.list-item-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== 頂部導航列 ===== */
.top-bar {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  flex-shrink: 0;
}

.top-bar-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-bar-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: var(--radius-lg);
  background: rgba(30, 20, 60, 0.95);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 14px;
  z-index: 2000;
  animation: fadeIn 0.3s;
  pointer-events: none;
}
