/**
 * Character Customization Modal Styles
 * Retro-themed customization interface
 */

/* Modal Container */
.customization-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.customization-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Overlay */
.customization-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

/* Main Container */
.customization-container {
  position: relative;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  background: var(--bg-primary, #f5f0e8);
  border: 4px solid var(--accent-primary, #d4a574);
  border-radius: 12px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.5),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.customization-header {
  background: linear-gradient(180deg, #d4a574 0%, #b8935e 100%);
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #8b6f47;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.customization-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  font-family: 'Comic Sans MS', 'Chalkboard SE', cursive;
}

.close-btn {
  background: #fff;
  border: 2px solid #8b6f47;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: #8b6f47;
}

.close-btn:hover {
  background: #ffe4c4;
  transform: scale(1.1);
}

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

/* Content Area */
.customization-content {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
  background: var(--bg-secondary, #faf7f0);
}

/* Preview Section */
.preview-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-label {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-primary, #4a3f35);
  text-align: center;
  font-family: 'Comic Sans MS', cursive;
}

.preview-frame {
  background: #e8d4b8;
  border: 4px solid #8b6f47;
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.1);
}

#character-preview {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 128px;
  height: 128px;
  border: 2px solid #d4a574;
  background: #fff;
}

.preview-info {
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
  padding: 0.5rem;
  background: rgba(212, 165, 116, 0.1);
  border-radius: 4px;
}

/* Options Section */
.options-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 3px solid #d4a574;
  padding-bottom: 0.5rem;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 1.5rem;
  background: #e8d4b8;
  border: 2px solid #b8935e;
  border-radius: 8px 8px 0 0;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #4a3f35;
  position: relative;
  top: 2px;
}

.tab-btn:hover {
  background: #f0dcc8;
  transform: translateY(-2px);
}

.tab-btn.active {
  background: linear-gradient(180deg, #d4a574 0%, #b8935e 100%);
  color: #fff;
  border-bottom-color: #b8935e;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
  top: 0;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  padding: 1rem 0;
  max-height: 400px;
  overflow-y: auto;
}

.option-btn {
  background: #fff;
  border: 3px solid #d4a574;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.option-btn:hover {
  background: #ffe4c4;
  border-color: #b8935e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.option-btn:focus {
  outline: 3px solid #ff9e5e;
  outline-offset: 2px;
}

.option-btn.selected {
  background: linear-gradient(135deg, #ffe4c4 0%, #ffd4a4 100%);
  border-color: #ff9e5e;
  border-width: 4px;
  box-shadow:
    0 4px 12px rgba(255, 158, 94, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.5);
}

.option-btn.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  background: #4caf50;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.option-preview {
  width: 64px;
  height: 64px;
  background: #f5f0e8;
  border: 2px solid #d4a574;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.option-name {
  font-size: 0.85rem;
  text-align: center;
  color: #4a3f35;
  font-weight: 500;
}

/* Footer */
.customization-footer {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: #e8d4b8;
  border-top: 3px solid #d4a574;
  justify-content: flex-end;
}

.action-btn {
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: bold;
  border: 3px solid #8b6f47;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fff;
  color: #4a3f35;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-btn:active {
  transform: translateY(0);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.action-btn.primary {
  background: linear-gradient(180deg, #d4a574 0%, #b8935e 100%);
  color: #fff;
  border-color: #8b6f47;
}

.action-btn.primary:hover {
  background: linear-gradient(180deg, #e0b585 0%, #c4a06f 100%);
}

.reset-btn {
  background: #f44336;
  color: #fff;
  border-color: #c62828;
}

.reset-btn:hover {
  background: #ff5a4e;
}

/* Keyboard Hint */
.keyboard-hint {
  text-align: center;
  padding: 0.75rem;
  font-size: 0.85rem;
  color: #666;
  background: rgba(212, 165, 116, 0.1);
  font-style: italic;
}

/* Scrollbar Styling */
.options-grid::-webkit-scrollbar,
.customization-content::-webkit-scrollbar {
  width: 12px;
}

.options-grid::-webkit-scrollbar-track,
.customization-content::-webkit-scrollbar-track {
  background: #e8d4b8;
  border-radius: 6px;
}

.options-grid::-webkit-scrollbar-thumb,
.customization-content::-webkit-scrollbar-thumb {
  background: #b8935e;
  border-radius: 6px;
  border: 2px solid #e8d4b8;
}

.options-grid::-webkit-scrollbar-thumb:hover,
.customization-content::-webkit-scrollbar-thumb:hover {
  background: #a07d4d;
}

/* Responsive Design */
@media (max-width: 768px) {
  .customization-container {
    width: 95%;
    max-width: none;
  }

  .customization-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .preview-section {
    order: -1;
  }

  .options-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    max-height: 300px;
  }

  .customization-footer {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
  }
}

/* Dark Theme Support */
[data-theme="dark"] .customization-container {
  background: #2a2420;
  border-color: #5a4a3a;
}

[data-theme="dark"] .customization-content {
  background: #332b25;
}

[data-theme="dark"] .customization-header {
  background: linear-gradient(180deg, #5a4a3a 0%, #4a3a2a 100%);
  border-bottom-color: #3a2a1a;
}

[data-theme="dark"] .tab-btn {
  background: #3a2f25;
  border-color: #5a4a3a;
  color: #e8d4b8;
}

[data-theme="dark"] .tab-btn:hover {
  background: #4a3a2a;
}

[data-theme="dark"] .tab-btn.active {
  background: linear-gradient(180deg, #5a4a3a 0%, #4a3a2a 100%);
  color: #fff;
}

[data-theme="dark"] .option-btn {
  background: #3a2f25;
  border-color: #5a4a3a;
  color: #e8d4b8;
}

[data-theme="dark"] .option-btn:hover {
  background: #4a3a2a;
  border-color: #6a5a4a;
}

[data-theme="dark"] .option-btn.selected {
  background: linear-gradient(135deg, #5a4a3a 0%, #6a5a4a 100%);
  border-color: #ff9e5e;
}

[data-theme="dark"] .preview-frame,
[data-theme="dark"] .option-preview {
  background: #3a2f25;
  border-color: #5a4a3a;
}

[data-theme="dark"] .customization-footer {
  background: #2a2420;
  border-top-color: #5a4a3a;
}

[data-theme="dark"] .action-btn {
  background: #3a2f25;
  color: #e8d4b8;
  border-color: #5a4a3a;
}

[data-theme="dark"] .preview-info,
[data-theme="dark"] .keyboard-hint {
  background: rgba(90, 74, 58, 0.2);
  color: #b8935e;
}
