/* ==================== PRO AVATAR CREATOR ==================== */

/* Avatar Creator Container */
.avatar-creator {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 0;
  max-width: 1000px;
  margin: 0 auto;
  overflow: hidden;
}

.avatar-creator.pro-avatar {
  max-width: 1100px;
}

.avatar-creator-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  min-height: 700px;
}

/* Left Panel - Avatar Preview */
.avatar-preview-panel {
  background: linear-gradient(180deg, #0a0f1a 0%, #0f1520 50%, #141a25 100%);
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.avatar-preview-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(6, 182, 212, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(132, 204, 22, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

/* Pro Avatar Stage */
.avatar-stage-pro {
  width: 320px;
  height: 500px;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.avatar-spotlight {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 400px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  clip-path: polygon(30% 0%, 70% 0%, 100% 100%, 0% 100%);
  pointer-events: none;
}

.avatar-floor-reflection {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 80px;
  background: radial-gradient(ellipse at center, rgba(6, 182, 212, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

/* Full Body Avatar Container */
.avatar-full-body {
  width: 200px;
  height: 400px;
  position: relative;
}

.avatar-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
}

/* Avatar idle animation */
.avatar-svg {
  animation: avatarBreath 4s ease-in-out infinite;
}

@keyframes avatarBreath {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Pro Name Badge */
.avatar-name-badge-pro {
  position: relative;
  margin-top: 20px;
  padding: 12px 28px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(15px);
  border-radius: 30px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  border: 1px solid rgba(6, 182, 212, 0.3);
  z-index: 2;
}

.avatar-name-text {
  position: relative;
  z-index: 1;
}

.avatar-badge-glow {
  position: absolute;
  inset: -2px;
  background: linear-gradient(90deg, #06b6d4, #84cc16, #06b6d4);
  border-radius: 32px;
  opacity: 0.3;
  filter: blur(8px);
  animation: badgeGlow 3s ease-in-out infinite;
}

@keyframes badgeGlow {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.4; }
}

/* Pose Controls */
.avatar-preview-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  z-index: 2;
}

.avatar-pose-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar-pose-btn:hover {
  background: rgba(6, 182, 212, 0.3);
  border-color: var(--accent);
}

.avatar-pose-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 100px;
  text-align: center;
}

/* Right Panel - Customization Options */
.avatar-options-panel {
  padding: 28px;
  overflow-y: auto;
  max-height: 700px;
  background: var(--bg-card);
}

.avatar-options-header {
  margin-bottom: 20px;
}

.avatar-options-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  margin-bottom: 6px;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.avatar-options-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Option Section */
.avatar-option-section {
  margin-bottom: 20px;
}

.avatar-option-section.compact {
  margin-bottom: 16px;
}

.avatar-option-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-option-label svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* Tabs Navigation */
.avatar-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
}

.avatar-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.avatar-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.avatar-tab.active {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent);
}

.tab-icon {
  font-size: 1.2rem;
}

.tab-name {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Tab Content */
.avatar-tab-content {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 8px;
}

.tab-section {
  margin-bottom: 18px;
}

.tab-section:last-child {
  margin-bottom: 0;
}

/* Color Picker */
.avatar-color-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.avatar-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.avatar-color-swatch.large {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.avatar-color-swatch:hover {
  transform: scale(1.1);
  z-index: 1;
}

.avatar-color-swatch.selected {
  border-color: white;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

.avatar-color-swatch.selected::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border: 2px solid white;
  border-radius: 50%;
}

/* Custom Color Input */
.avatar-custom-color {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px dashed var(--border);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-custom-color::before {
  content: '+';
  font-size: 1rem;
  color: var(--text-muted);
}

.avatar-custom-color input {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Style Grid */
.avatar-style-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.avatar-style-grid.compact {
  grid-template-columns: repeat(3, 1fr);
}

.avatar-style-option {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar-style-option:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.avatar-style-option.selected {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent);
}

.avatar-style-option-icon {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.avatar-style-option-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Accessory Grid */
.avatar-accessory-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.avatar-accessory-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar-accessory-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.avatar-accessory-option.selected {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--accent);
}

.acc-icon {
  font-size: 1.1rem;
}

.acc-name {
  font-size: 0.8rem;
  flex: 1;
}

/* Info Box */
.info-box {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: rgba(132, 204, 22, 0.08);
  border: 1px solid rgba(132, 204, 22, 0.2);
  border-radius: 10px;
}

.info-icon {
  font-size: 1.3rem;
}

.info-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.info-text strong {
  color: var(--text);
}

/* Pro Preset Gallery */
.avatar-preset-gallery-pro {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.avatar-preset-card-pro {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar-preset-card-pro:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.avatar-preset-mini {
  font-size: 1.5rem;
}

.avatar-preset-card-pro span {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* AI Host Toggle */
.ai-host-toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(6, 182, 212, 0.05);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 12px;
  margin-bottom: 20px;
}

.ai-host-toggle-info {
  flex: 1;
}

.ai-host-toggle-info h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-host-toggle-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  border-radius: 28px;
}

.toggle-slider::before {
  position: absolute;
  content: '';
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: all 0.3s ease;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

/* AI Host Name Input */
.avatar-name-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s ease;
}

.avatar-name-input:focus {
  outline: none;
  border-color: var(--accent);
}

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

/* Action Buttons */
.avatar-creator-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.avatar-creator-actions .btn {
  flex: 1;
}

.btn-glow {
  position: relative;
  overflow: hidden;
}

.btn-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(90deg, var(--accent), #84cc16, var(--accent));
  border-radius: inherit;
  opacity: 0;
  filter: blur(8px);
  transition: opacity 0.3s ease;
  z-index: -1;
}

.btn-glow:hover::before {
  opacity: 0.4;
}

/* Spinning animation for save button */
.spinning {
  animation: spin 1s linear infinite;
}

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

/* Scrollbar styling */
.avatar-tab-content::-webkit-scrollbar,
.avatar-options-panel::-webkit-scrollbar,
.avatar-preset-gallery-pro::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.avatar-tab-content::-webkit-scrollbar-track,
.avatar-options-panel::-webkit-scrollbar-track,
.avatar-preset-gallery-pro::-webkit-scrollbar-track {
  background: transparent;
}

.avatar-tab-content::-webkit-scrollbar-thumb,
.avatar-options-panel::-webkit-scrollbar-thumb,
.avatar-preset-gallery-pro::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.avatar-tab-content::-webkit-scrollbar-thumb:hover,
.avatar-options-panel::-webkit-scrollbar-thumb:hover,
.avatar-preset-gallery-pro::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile Responsive */
@media (max-width: 900px) {
  .avatar-creator-layout {
    grid-template-columns: 1fr;
  }

  .avatar-preview-panel {
    padding: 30px 20px;
    min-height: 500px;
  }

  .avatar-stage-pro {
    height: 400px;
  }

  .avatar-full-body {
    height: 320px;
  }

  .avatar-options-panel {
    padding: 24px;
    max-height: none;
  }

  .avatar-style-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .avatar-style-grid.compact {
    grid-template-columns: repeat(2, 1fr);
  }

  .avatar-tab-content {
    max-height: none;
  }
}

@media (max-width: 500px) {
  .avatar-style-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .avatar-accessory-grid {
    grid-template-columns: 1fr;
  }

  .avatar-tabs {
    flex-wrap: wrap;
  }

  .avatar-tab {
    flex: 0 0 calc(33.33% - 4px);
  }
}

/* ==================== LEGACY AVATAR STYLES (for backward compatibility) ==================== */

/* These styles support the old avatar format if needed */
.avatar-stage {
  width: 280px;
  height: 320px;
  position: relative;
  z-index: 1;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.avatar-container {
  width: 240px;
  height: 300px;
  position: relative;
  transform-origin: bottom center;
}

/* Avatar Name Badge (legacy) */
.avatar-name-badge {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  padding: 8px 20px;
  border-radius: 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Avatar idle animation (legacy) */
.avatar-container.idle .avatar-head {
  animation: avatarIdle 3s ease-in-out infinite;
}

@keyframes avatarIdle {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(0deg); }
  25% { transform: translateX(-50%) translateY(-3px) rotate(-1deg); }
  75% { transform: translateX(-50%) translateY(-3px) rotate(1deg); }
}

/* DJ Animation - for when music is playing */
.avatar-container.dj-mode .avatar-body {
  animation: djBounce 0.5s ease-in-out infinite;
}

@keyframes djBounce {
  0%, 100% { transform: translateX(-50%) scaleY(1); }
  50% { transform: translateX(-50%) scaleY(0.97); }
}

.avatar-container.dj-mode .avatar-head {
  animation: djNod 1s ease-in-out infinite;
}

@keyframes djNod {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  25% { transform: translateX(-50%) rotate(-5deg); }
  75% { transform: translateX(-50%) rotate(5deg); }
}

/* ==================== USER SAVED PRESETS ==================== */

.btn-save-preset {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-preset:hover {
  background: rgba(6, 182, 212, 0.25);
  border-color: var(--accent);
}

.user-presets-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 180px;
  overflow-y: auto;
}

.user-presets-container::-webkit-scrollbar {
  width: 4px;
}

.user-presets-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.user-preset-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-preset-card:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.3);
}

.user-preset-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.user-preset-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-preset-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.user-preset-card:hover .user-preset-actions {
  opacity: 1;
}

.preset-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.preset-action-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.preset-action-btn.delete-preset-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.user-presets-empty {
  text-align: center;
  padding: 24px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.user-presets-empty p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.user-presets-empty span {
  color: var(--text-muted);
  font-size: 0.75rem;
  opacity: 0.7;
}
