/**
 * Character Builder CSS - Kid-friendly UI styles
 */

/* Create Me Button on Start Screen */
.create-character-btn {
  position: relative;
  display: inline-block;
  margin-top: 20px;
  padding: 16px 32px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #EC4899 0%, #F472B6 50%, #A855F7 100%);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow:
    0 4px 15px rgba(236, 72, 153, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  animation: pulse-glow 2s infinite;
}

.create-character-btn:hover {
  transform: scale(1.05);
  box-shadow:
    0 6px 20px rgba(236, 72, 153, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.15);
}

.create-character-btn:active {
  transform: scale(0.98);
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow:
      0 4px 15px rgba(236, 72, 153, 0.4),
      0 2px 4px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow:
      0 4px 25px rgba(236, 72, 153, 0.6),
      0 2px 4px rgba(0, 0, 0, 0.1);
  }
}

/* Character Builder Overlay */
.character-builder {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 6000; /* Above start screen (5000) */
  backdrop-filter: blur(8px);
  animation: fade-in 0.3s ease;
}

.character-builder.hidden {
  display: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Builder Content Container */
.builder-content {
  background: linear-gradient(180deg, #1E1B4B 0%, #312E81 100%);
  border-radius: 24px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: slide-up 0.3s ease;
}

@keyframes slide-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Builder Header */
.builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.builder-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  text-align: center;
}

.builder-back-btn,
.builder-save-btn {
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.builder-back-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.builder-back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.builder-save-btn {
  background: linear-gradient(135deg, #10B981 0%, #34D399 100%);
  color: #fff;
}

.builder-save-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Builder Body */
.builder-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Preview Area */
.builder-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#characterPreview {
  background: linear-gradient(180deg, #4F46E5 0%, #7C3AED 100%);
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.preview-label {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

/* Category Tabs */
.builder-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.tab-btn {
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 70px;
  min-height: 44px;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.15);
  border-color: #A855F7;
  color: #fff;
}

/* Options Carousel */
.builder-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  min-height: 100px;
}

/* Option Button */
.option-btn {
  width: 64px;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 3px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 8px;
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.option-btn.selected {
  background: rgba(168, 85, 247, 0.3);
  border-color: #A855F7;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

.option-btn:active {
  transform: scale(0.95);
}

/* Option with color swatch */
.option-btn.color-option {
  position: relative;
}

.option-color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

/* Option with emoji */
.option-emoji {
  font-size: 1.75rem;
  line-height: 1;
}

.option-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Builder Footer */
.builder-footer {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.randomize-btn {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 50%, #F97316 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.randomize-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.randomize-btn:active {
  transform: scale(0.98);
}

.reset-btn {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

/* Responsive Adjustments */
@media (max-width: 480px) {
  .builder-content {
    padding: 16px;
    border-radius: 16px;
  }

  .builder-title {
    font-size: 1.25rem;
  }

  .builder-back-btn,
  .builder-save-btn {
    padding: 8px 12px;
    font-size: 0.875rem;
  }

  .tab-btn {
    padding: 10px 12px;
    font-size: 0.8rem;
    min-width: 60px;
  }

  .option-btn {
    width: 56px;
    height: 56px;
  }

  .option-emoji {
    font-size: 1.5rem;
  }

  .option-label {
    font-size: 0.6rem;
  }

  .create-character-btn {
    bottom: 16px;
    right: 16px;
    padding: 12px 20px;
    font-size: 1rem;
  }
}

/* Touch feedback */
@media (hover: none) {
  .option-btn:active {
    background: rgba(168, 85, 247, 0.3);
    transform: scale(0.95);
  }

  .tab-btn:active {
    background: rgba(255, 255, 255, 0.2);
  }
}

/* Scrollbar styling for options */
.builder-options::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.builder-options::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.builder-options::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.builder-options::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
