/* ─────────────────────────────────────────────
   SEED Avatar v3.0 — UI Components
   ───────────────────────────────────────────── */

/* ══════ HEADER ══════ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

/* Cinematic mode: auto-hide header */
body.cinematic .header {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}
body.cinematic .header > * {
  pointer-events: none !important;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
}

.header-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.3s;
}
.header:hover .header-title { opacity: 1; }

.header-title span {
  font-weight: 600;
  background: linear-gradient(135deg, #f0c68a, #ff8fa0, #c4a0ff, #f0c68a);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: brightness(1.15);
  text-shadow: 0 0 40px rgba(240, 198, 138, 0.2);
  animation: gradientShift 6s ease-in-out infinite alternate;
}

@keyframes gradientShift {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

/* ══════ MODEL SELECTOR ══════ */
.model-selector {
  position: relative;
  pointer-events: auto;
}

.model-selector-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 12px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  transition: all var(--duration-normal) var(--ease-out);
  outline: none;
  white-space: nowrap;
}

.model-selector-btn:hover {
  background: var(--surface-glass-hover);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.model-selector-btn.open {
  background: var(--surface-glass-hover);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow-warm);
}

.model-selector-btn .model-icon {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; flex-shrink: 0;
}

.model-selector-btn .chevron {
  font-size: 0.5rem;
  color: var(--text-muted);
  transition: transform var(--duration-normal) var(--ease-out);
  margin-left: 4px;
}

.model-selector-btn.open .chevron {
  transform: rotate(180deg);
}

.model-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  background: rgba(12, 12, 28, 0.96);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 6px;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  pointer-events: none;
  transition: all var(--duration-normal) var(--ease-spring);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255, 255, 255, 0.02);
  z-index: 100;
}

.model-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.model-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  border: 1px solid transparent;
}

.model-option:hover {
  background: rgba(255, 255, 255, 0.04);
}

.model-option.active {
  background: var(--accent-glow);
  border-color: rgba(212, 165, 116, 0.12);
}

.model-option .opt-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
  letter-spacing: -0.02em;
}

.model-option .opt-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.model-option .opt-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.model-option .opt-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.model-option.active .opt-name {
  color: var(--accent-warm);
}

.model-option .opt-check {
  margin-left: auto;
  font-size: 0.85rem;
  opacity: 0;
  color: var(--accent-warm);
  transition: opacity 0.2s;
}

.model-option.active .opt-check {
  opacity: 1;
}

/* Color coding for model icons */
.icon-brunette { background: linear-gradient(135deg, #6b4423, #8b6243); color: #f0d0b0; }
.icon-avaturn  { background: linear-gradient(135deg, #2a4a8a, #4a6abf); color: #c0d8ff; }
.icon-mpfb     { background: linear-gradient(135deg, #5a3a7a, #7a5a9f); color: #dcc0ff; }
.icon-avatarsdk { background: linear-gradient(135deg, #2a6a5a, #3a8f6f); color: #c0ffd8; }

/* ══════ CURRENT RASA DISPLAY ══════ */
.current-rasa {
  position: fixed;
  top: 50%; right: 36px;
  transform: translateY(-50%);
  z-index: 10;
  text-align: right;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}

/* Cinematic mode: hide rasa display */
body.cinematic .current-rasa { opacity: 0 !important; }

.current-rasa.visible { opacity: 1; }

.current-rasa-emoji {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 20px rgba(155, 126, 232, 0.2));
}

.current-rasa-name {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 400;
  font-style: italic;
  color: var(--accent-warm);
  letter-spacing: 0.04em;
  text-shadow: 0 0 40px rgba(212, 165, 116, 0.2);
}

.current-rasa-meaning {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ══════ BOTTOM PANEL ══════ */
.bottom-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  padding: 0 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.bottom-panel > * { pointer-events: auto; }

/* Cinematic mode: auto-hide bottom panel */
body.cinematic .bottom-panel {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none !important;
}
body.cinematic .bottom-panel > * {
  pointer-events: none !important;
}

/* ══════ BOTTOM CONTROLS ROW ══════ */
.bottom-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 720px;
}

/* Toolbar: stays compact */
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  background: rgba(12, 12, 28, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  transition: opacity 0.3s;
}
.toolbar-row:hover { opacity: 1 !important; }
.toolbar-row .mic-btn,
.toolbar-row .seed-btn-toggle {
  width: 32px; height: 32px; font-size: 0.82rem;
}
.toolbar-divider {
  width: 1px; height: 18px;
  background: var(--border-subtle); flex-shrink: 0; margin: 0 2px;
}
.memory-indicator {
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 0 4px;
}

/* Controls right: slider + icon buttons */
.controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Icon buttons (minimal alternatives to labeled pills) */
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(12, 12, 28, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-normal) var(--ease-out);
  outline: none;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--surface-glass-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: scale(1.08);
}
.icon-btn:active { transform: scale(0.95); }
.icon-btn.active {
  background: var(--accent-violet-glow);
  border-color: rgba(155, 126, 232, 0.3);
  color: var(--accent-violet);
}

/* ══════ INTENSITY SLIDER ══════ */
.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(12, 12, 28, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  width: 160px;
  flex-shrink: 0;
}

.slider-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.slider-value {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-warm);
  min-width: 34px;
  text-align: right;
  flex-shrink: 0;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-warm), var(--accent-violet));
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.3s;
}
.slider-row:hover input[type="range"] { opacity: 0.8; }

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent-warm);
  border: 2px solid var(--surface-deep);
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.4);
  cursor: grab;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 18px rgba(212, 165, 116, 0.55);
}

input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent-warm);
  border: 2px solid var(--surface-deep);
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.4);
  cursor: grab;
}

/* ══════ RASA BUTTONS ══════ */
.rasa-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 5px;
  width: 100%;
  max-width: 720px;
  padding: 2px 2px 6px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  mask-image: linear-gradient(to right, transparent 0px, black 20px, black calc(100% - 20px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0px, black 20px, black calc(100% - 20px), transparent 100%);
}
.rasa-grid::-webkit-scrollbar { display: none; }

.rasa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 7px 4px;
  min-width: 48px;
  flex-shrink: 0;
  background: rgba(12, 12, 28, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  outline: none;
  color: var(--text-secondary);
  opacity: 0.65;
}

.rasa-btn:hover {
  opacity: 1;
  background: var(--surface-glass-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.rasa-btn:active { transform: translateY(0); }

.rasa-btn.active {
  opacity: 1;
  background: var(--accent-glow);
  border-color: rgba(212, 165, 116, 0.3);
  color: var(--accent-warm);
  box-shadow: 0 0 20px rgba(212, 165, 116, 0.1);
}

.rasa-btn .emoji {
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 0.3s var(--ease-spring);
}

.rasa-btn:hover .emoji,
.rasa-btn.active .emoji {
  transform: scale(1.12);
}

.rasa-btn .label {
  font-size: 0.46rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.rasa-btn.neutral { border-style: dashed; opacity: 0.5; }
.rasa-btn.neutral .emoji { opacity: 0.6; }

/* ══════ LOADING ══════ */
.loader-overlay {
  position: fixed; inset: 0;
  z-index: 100;
  background: var(--surface-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  transition: opacity 1s var(--ease-out);
}

.loader-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  animation: loaderTextPulse 2s ease-in-out infinite;
}

@keyframes loaderTextPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.loader-ring {
  width: 52px; height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-top-color: var(--accent-warm);
  border-right-color: var(--accent-violet);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ══════ VOICE SELECTOR ══════ */
.voice-selector {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.7rem;
  padding: 5px 24px 5px 10px;
  cursor: pointer;
  outline: none;
  max-width: 140px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(212,165,116,0.6)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.voice-selector:hover,
.voice-selector:focus {
  border-color: var(--accent-warm);
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.12);
}

.voice-selector option {
  background: #12122a;
  color: #e0e0e0;
  font-size: 0.75rem;
}

/* ══════ WEBCAM ACTIVE STATE ══════ */
.mic-btn.active-webcam {
  background: rgba(90, 224, 128, 0.15);
  border-color: rgba(90, 224, 128, 0.45);
  box-shadow: 0 0 16px rgba(90, 224, 128, 0.2);
  animation: pulse-glow-green 2s ease-in-out infinite;
}

@keyframes pulse-glow-green {
  0%, 100% { box-shadow: 0 0 12px rgba(90, 224, 128, 0.2); }
  50% { box-shadow: 0 0 22px rgba(90, 224, 128, 0.4); }
}

/* ══════ WEBCAM PREVIEW ══════ */
.webcam-preview {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 90px; height: 68px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(155, 126, 232, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
  z-index: 100;
  object-fit: cover;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 20px rgba(155, 126, 232, 0.1);
}

.webcam-preview.active { opacity: 1; }

/* ══════ SCREEN PREVIEW ══════ */
.screen-preview {
  position: fixed;
  bottom: 20px; left: 20px;
  width: 54px; height: 54px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 100;
  object-fit: cover;
}

.screen-preview.active { opacity: 1; }
