/**
 * GameMaster Theme System Styles
 * 
 * Defines CSS custom properties and theme selector UI styles.
 * Theme colors are applied dynamically via JavaScript.
 */

/* ===================================
   CSS CUSTOM PROPERTIES (THEME VARIABLES)
   =================================== */

:root {
  /* Base colors - set dynamically by theme manager */
  --bg-primary: #0f1419;
  --bg-secondary: #1a1f2e;
  --text-primary: #e2e8f0;
  --text-secondary: #cbd5e1;

  /* Game Mechanics */
  --critical-success: #4ade80;
  --critical-failure: #ef4444;
  --dice: #60a5fa;
  --damage: #f87171;
  --healing: #10b981;
  --save-throw: #f59e0b;
  --ability-check: #60a5fa;
  --dc-target: #93c5fd;

  /* Game Mechanics - Background Colors (for badges/highlights) */
  --save-throw-bg: rgba(245, 158, 11, 0.1);
  --ability-check-bg: rgba(96, 165, 250, 0.1);
  --condition-bg: rgba(168, 85, 247, 0.1);
  --dc-target-bg: rgba(239, 68, 68, 0.15);
  --dc-target-border: rgba(239, 68, 68, 0.3);

  /* Damage Types */
  --dmg-physical: #dc2626;
  --dmg-fire: #f59e0b;
  --dmg-cold: #3b82f6;
  --dmg-lightning: #eab308;
  --dmg-thunder: #6366f1;
  --dmg-acid: #84cc16;
  --dmg-poison: #22c55e;
  --dmg-necrotic: #8b5cf6;
  --dmg-radiant: #fbbf24;
  --dmg-psychic: #ec4899;
  --dmg-force: #06b6d4;

  /* Character State */
  --condition: #fbbf24;
  --spell-cast: #c084fc;
  --spell-name: #e9d5ff;
  --experience: #fbbf24;
  --treasure: #fbbf24;

  /* Narrative */
  --dialogue: #bfdbfe;
  --question: #93c5fd;
  --heading: #e0e7ff;
  --system: #22d3ee;

  /* Interactive */
  --choice-bg: rgba(234, 179, 8, 0.2);
  --choice-border: rgba(234, 179, 8, 0.4);
  --choice-text: #fef3c7;
  --bonus: #10b981;
  --penalty: #ef4444;
}

/* ===================================
   THEME SELECTOR UI
   =================================== */

.theme-selector {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.theme-selector-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.theme-selector-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Theme Card */
.theme-card {
  background: var(--bg-secondary);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.theme-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
}

.theme-card.active {
  border-color: var(--critical-success);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
}

/* Theme Preview */
.theme-card-preview {
  position: relative;
  height: 120px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid;
}

.theme-preview-colors {
  display: flex;
  gap: 12px;
  align-items: center;
}

.preview-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: transform 0.2s ease;
}

.theme-card:hover .preview-dot {
  transform: scale(1.1);
}

.theme-active-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--critical-success);
  color: #000;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  animation: badge-appear 0.3s ease;
}

@keyframes badge-appear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Theme Card Info */
.theme-card-info {
  padding: 16px;
}

.theme-card-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.theme-card-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.theme-card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.theme-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-icon {
  font-size: 1rem;
}

/* Theme Button */
.theme-card-button {
  width: 100%;
  padding: 12px;
  background: rgba(96, 165, 250, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-card-button:hover {
  background: rgba(96, 165, 250, 0.3);
  border-color: rgba(96, 165, 250, 0.6);
}

.theme-card.active .theme-card-button {
  background: rgba(74, 222, 128, 0.2);
  border-color: rgba(74, 222, 128, 0.4);
  cursor: default;
}

/* Theme Feedback */
.theme-feedback {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  z-index: 10000;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}

.theme-feedback.show {
  opacity: 1;
  transform: translateY(0);
}

.theme-feedback-success {
  background: var(--critical-success);
  color: #000;
}

.theme-feedback-error {
  background: var(--critical-failure);
  color: #fff;
}

/* ===================================
   SIMPLE THEME SWITCHER STYLES
   =================================== */

/* Dropdown Style */
.theme-switcher-dropdown {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  width: 100%;
}

.theme-switcher-dropdown label {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
}

.theme-select {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
}

.theme-select:hover {
  border-color: var(--dice);
  background: rgba(255, 255, 255, 0.08);
}

.theme-select:focus {
  outline: none;
  border-color: var(--critical-success);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
  background: rgba(255, 255, 255, 0.1);
}

/* Style select options */
.theme-select option {
  background: #1a1a1a;
  color: #ffffff;
  padding: 8px;
}

/* Button Group Style */
.theme-switcher-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
}

.theme-switch-btn {
  padding: 10px 20px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-switch-btn:hover {
  background: rgba(96, 165, 250, 0.2);
  border-color: var(--dice);
  transform: translateY(-2px);
}

.theme-switch-btn.active {
  background: rgba(74, 222, 128, 0.2);
  border-color: var(--critical-success);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.3);
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 768px) {
  .theme-grid {
    grid-template-columns: 1fr;
  }

  .theme-switcher-buttons {
    flex-direction: column;
  }

  .theme-switch-btn {
    width: 100%;
  }

  .theme-feedback {
    right: 10px;
    left: 10px;
    top: 10px;
  }
}

/* ===================================
   ACCESSIBILITY
   =================================== */

/* Focus states */
.theme-card:focus-visible,
.theme-card-button:focus-visible,
.theme-switch-btn:focus-visible,
.theme-select:focus-visible {
  outline: 3px solid var(--critical-success);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .theme-card,
  .theme-card-button,
  .theme-switch-btn,
  .preview-dot,
  .theme-feedback {
    transition: none;
    animation: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .theme-card {
    border-width: 3px;
  }

  .theme-card-button {
    border-width: 2px;
  }
}

/* ===================================
   THEME-SPECIFIC ENHANCEMENTS
   =================================== */

/* Universal bold formatting is now in styles.css base classes */
/* Theme-specific overrides can be added here if needed for individual themes */
