/**
 * FANTASY THEME - Dark Mode Styling for D&D / RPG Audience
 * ========================================================
 *
 * Color palette:
 * - Backgrounds: Deep navy/indigo (#0f0e1a, #1a1a2e, #16213e)
 * - Text: Light (#eeeeee, #a8a8b3, #6b6b7b)
 * - Primary accent: Purple (#9c84ff)
 * - Secondary accent: Gold (#d4a847) - D&D fantasy feel
 * - Highlight: Rose (#e94560) - for attention-grabbing elements
 *
 * Supports dark (default) and light modes via data-theme attribute.
 */

/* ======================
   CSS CUSTOM PROPERTIES
   ====================== */

:root {
  /* Fantasy theme default (dark) colors - D&D inspired */
  --fantasy-bg: #0f0e1a;
  --fantasy-bg-secondary: #1a1a2e;
  --fantasy-bg-tertiary: #0a0a14;
  --fantasy-text: #eeeeee;
  --fantasy-text-secondary: #b0afc0;
  --fantasy-text-muted: #6e6d80;
  --fantasy-accent: #d4a847;
  --fantasy-accent-hover: #e4be6a;
  --fantasy-accent-glow: rgba(212, 168, 71, 0.25);
  --fantasy-purple: #9c84ff;
  --fantasy-purple-hover: #b8a8ff;
  --fantasy-border: rgba(156, 132, 255, 0.2);
  --fantasy-card-bg: rgba(26, 26, 46, 0.7);
  --fantasy-success: #10b981;
  --fantasy-success-bg: rgba(16, 185, 129, 0.2);
  --fantasy-pink: #ec4899;
  --fantasy-gold: #d4a847;
  --fantasy-gold-glow: rgba(212, 168, 71, 0.3);
}

/* Light mode overrides for users who prefer light */
html[data-theme="light"] {
  --fantasy-bg: #f5f3ff;
  --fantasy-bg-secondary: #ede9fe;
  --fantasy-bg-tertiary: #ffffff;
  --fantasy-text: #1f1f3d;
  --fantasy-text-secondary: #4a4a6a;
  --fantasy-text-muted: #7c7c94;
  --fantasy-accent: #b8860b;
  --fantasy-accent-hover: #a67808;
  --fantasy-accent-glow: rgba(184, 134, 11, 0.2);
  --fantasy-purple: #7c3aed;
  --fantasy-purple-hover: #6d28d9;
  --fantasy-border: rgba(124, 58, 237, 0.2);
  --fantasy-card-bg: rgba(255, 255, 255, 0.8);
  --fantasy-success: #059669;
  --fantasy-success-bg: rgba(5, 150, 105, 0.15);
  --fantasy-gold: #b8860b;
  --fantasy-gold-glow: rgba(184, 134, 11, 0.2);
}

/* ======================
   BODY BACKGROUND
   ====================== */

/* Ensures no white flash behind themed pages */
.fantasy-body-bg {
  background-color: var(--fantasy-bg);
  margin: 0;
}

/* ======================
   FANTASY PAGE STYLES
   ====================== */

/* Main container gradient - applies fantasy theme */
.fantasy-theme {
  background: linear-gradient(
    180deg,
    var(--fantasy-bg) 0%,
    var(--fantasy-bg-secondary) 40%,
    var(--fantasy-bg) 100%
  );
  color: var(--fantasy-text);
  min-height: 100vh;
}

/* Alternative solid background */
.fantasy-bg-solid {
  background-color: var(--fantasy-bg);
  color: var(--fantasy-text);
}

/* ======================
   FANTASY CARDS
   ====================== */

.fantasy-card {
  background: var(--fantasy-card-bg);
  border: 1px solid var(--fantasy-border);
  border-radius: 0.75rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.fantasy-card:hover {
  border-color: var(--fantasy-purple);
  box-shadow: 0 4px 20px var(--fantasy-accent-glow);
}

.fantasy-card-selected {
  border-color: var(--fantasy-accent) !important;
  background: rgba(212, 168, 71, 0.1);
  box-shadow: 0 0 0 2px var(--fantasy-accent), 0 4px 20px var(--fantasy-accent-glow);
}

/* ======================
   FANTASY BUTTONS
   ====================== */

.fantasy-btn-primary {
  background: linear-gradient(135deg, var(--fantasy-purple), var(--fantasy-accent));
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  box-shadow: 0 4px 15px var(--fantasy-accent-glow);
  transition: all 0.3s ease;
}

.fantasy-btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px var(--fantasy-accent-glow);
}

.fantasy-btn-primary:focus-visible {
  outline: 2px solid var(--fantasy-purple);
  outline-offset: 2px;
}

.fantasy-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.fantasy-btn-secondary {
  background: var(--fantasy-bg-secondary);
  color: var(--fantasy-text);
  border: 1px solid var(--fantasy-border);
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.fantasy-btn-secondary:hover {
  background: var(--fantasy-bg);
  border-color: var(--fantasy-purple);
}

.fantasy-btn-secondary:focus-visible {
  outline: 2px solid var(--fantasy-purple);
  outline-offset: 2px;
}

.fantasy-btn-tertiary {
  background: transparent;
  color: var(--fantasy-text-secondary);
  border: 1px solid var(--fantasy-border);
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.fantasy-btn-tertiary:hover {
  color: var(--fantasy-text);
  border-color: var(--fantasy-purple);
  background: rgba(156, 132, 255, 0.1);
}

.fantasy-btn-tertiary:focus-visible {
  outline: 2px solid var(--fantasy-purple);
  outline-offset: 2px;
}

/* ======================
   FANTASY FORM ELEMENTS
   ====================== */

.fantasy-input,
.fantasy-select {
  background: var(--fantasy-bg-secondary);
  border: 1px solid var(--fantasy-border);
  color: var(--fantasy-text);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 16px; /* Prevents iOS zoom */
  transition: all 0.2s ease;
}

.fantasy-input:focus,
.fantasy-select:focus {
  outline: none;
  border-color: var(--fantasy-purple);
  box-shadow: 0 0 0 2px rgba(156, 132, 255, 0.2);
}

.fantasy-label {
  color: var(--fantasy-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: block;
}

/* ======================
   FANTASY TEXT STYLES
   ====================== */

.fantasy-heading {
  color: var(--fantasy-text);
  font-weight: 700;
}

.fantasy-heading-gradient {
  background: linear-gradient(to right, var(--fantasy-purple), var(--fantasy-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.fantasy-text-accent {
  color: var(--fantasy-accent);
}

.fantasy-text-purple {
  color: var(--fantasy-purple);
}

.fantasy-text-muted {
  color: var(--fantasy-text-muted);
}

.fantasy-text-secondary {
  color: var(--fantasy-text-secondary);
}

/* ======================
   FANTASY LINKS
   ====================== */

.fantasy-link {
  color: var(--fantasy-purple);
  text-decoration: none;
  transition: color 0.2s ease;
}

.fantasy-link:hover {
  color: var(--fantasy-purple-hover);
}

/* ======================
   FANTASY TAGS/BADGES
   ====================== */

.fantasy-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 9999px;
  background: rgba(156, 132, 255, 0.15);
  color: var(--fantasy-purple);
  border: 1px solid var(--fantasy-border);
}

.fantasy-tag-accent {
  background: rgba(212, 168, 71, 0.15);
  color: var(--fantasy-accent);
  border-color: rgba(212, 168, 71, 0.3);
}

.fantasy-tag-success {
  background: var(--fantasy-success-bg);
  color: var(--fantasy-success);
  border-color: rgba(16, 185, 129, 0.3);
}

/* ======================
   FANTASY BORDERS
   ====================== */

.fantasy-border {
  border-color: var(--fantasy-border);
}

.fantasy-border-accent {
  border-color: var(--fantasy-accent);
}

.fantasy-border-glow {
  box-shadow: 0 0 15px var(--fantasy-accent-glow);
}

/* ======================
   TOURNAMENT BRACKET STYLES
   ====================== */

.fantasy-match-card {
  background: var(--fantasy-card-bg);
  border: 2px solid var(--fantasy-border);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.3s ease;
}

.fantasy-match-active {
  border-color: var(--fantasy-accent);
  box-shadow: 0 0 20px var(--fantasy-accent-glow);
}

.fantasy-match-header {
  background: var(--fantasy-bg-tertiary);
  color: var(--fantasy-text-muted);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  text-align: center;
}

.fantasy-match-divider {
  background: var(--fantasy-bg-tertiary);
  color: var(--fantasy-text-muted);
  padding: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.fantasy-participant {
  padding: 0.75rem 1rem;
  color: var(--fantasy-text);
  transition: all 0.2s ease;
}

.fantasy-participant-clickable:hover {
  background: rgba(156, 132, 255, 0.15);
  cursor: pointer;
}

.fantasy-participant-winner {
  background: var(--fantasy-success-bg);
  color: var(--fantasy-success);
}

.fantasy-participant-loser {
  background: var(--fantasy-bg-tertiary);
  color: var(--fantasy-text-muted);
  text-decoration: line-through;
}

/* ======================
   THEME TOGGLE BUTTON
   ====================== */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  background: var(--fantasy-card-bg);
  border: 1px solid var(--fantasy-border);
  color: var(--fantasy-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background: var(--fantasy-bg-secondary);
  color: var(--fantasy-text);
  border-color: var(--fantasy-purple);
}

/* ======================
   WINNER CELEBRATION
   ====================== */

.fantasy-winner-badge {
  background: linear-gradient(135deg, var(--fantasy-accent), #f59e0b);
  border-radius: 9999px;
  padding: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--fantasy-gold-glow);
}

.fantasy-winner-card {
  background: linear-gradient(135deg, rgba(212, 168, 71, 0.12), rgba(245, 158, 11, 0.12));
  border: 1px solid rgba(212, 168, 71, 0.3);
  border-radius: 1rem;
  padding: 2rem;
}

/* ======================
   ANIMATIONS
   ====================== */

@keyframes fantasy-pulse {
  0%, 100% {
    box-shadow: 0 0 15px var(--fantasy-accent-glow);
  }
  50% {
    box-shadow: 0 0 30px var(--fantasy-accent-glow);
  }
}

.fantasy-pulse {
  animation: fantasy-pulse 2s ease-in-out infinite;
}

@keyframes fantasy-glow {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

.fantasy-glow {
  animation: fantasy-glow 2s ease-in-out infinite;
}

/* ======================
   VOTING BUTTONS
   ====================== */

.fantasy-button-primary {
  background: linear-gradient(135deg, var(--fantasy-purple), var(--fantasy-accent));
  color: white;
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 15px var(--fantasy-accent-glow);
  transition: all 0.3s ease;
}

.fantasy-button-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px var(--fantasy-accent-glow);
}

.fantasy-button-secondary {
  background: var(--fantasy-bg-secondary);
  color: var(--fantasy-text);
  border: 1px solid var(--fantasy-border);
  font-weight: 600;
  transition: all 0.3s ease;
}

.fantasy-button-secondary:hover {
  background: var(--fantasy-bg);
  border-color: var(--fantasy-purple);
}

.fantasy-button-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-weight: 600;
  transition: all 0.3s ease;
}

.fantasy-button-danger:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
}

/* ======================
   FLASH MESSAGES (DARK MODE AWARE)
   ====================== */

.flash-notice {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--fantasy-success);
}

.flash-notice-icon {
  color: var(--fantasy-success);
}

.flash-notice-text {
  color: var(--fantasy-success);
}

.flash-notice-dismiss {
  color: var(--fantasy-success);
  opacity: 0.7;
}

.flash-notice-dismiss:hover {
  opacity: 1;
}

.flash-alert {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

.flash-alert-icon {
  color: #ef4444;
}

.flash-alert-text {
  color: #f87171;
}

.flash-alert-dismiss {
  color: #ef4444;
  opacity: 0.7;
}

.flash-alert-dismiss:hover {
  opacity: 1;
}

/* Light mode flash overrides */
html[data-theme="light"] .flash-notice {
  background: rgba(16, 185, 129, 0.1);
}

html[data-theme="light"] .flash-notice-text {
  color: #065f46;
}

html[data-theme="light"] .flash-alert {
  background: rgba(239, 68, 68, 0.1);
}

html[data-theme="light"] .flash-alert-text {
  color: #991b1b;
}

/* ======================
   PREMIUM LOCKED CONTENT
   ====================== */

.premium-locked-section {
  background: var(--fantasy-bg-secondary);
  border: 2px dashed var(--fantasy-border);
  border-radius: 0.75rem;
  padding: 1rem;
  position: relative;
}

.premium-locked-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--fantasy-border);
}

.premium-lock-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--fantasy-purple);
  flex-shrink: 0;
}

.premium-locked-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fantasy-text-muted);
}

.premium-placeholder-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.premium-placeholder-item {
  font-size: 0.75rem;
}

.premium-placeholder-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.375rem;
}

.premium-placeholder-label {
  color: var(--fantasy-text-muted);
}

.premium-placeholder-value {
  width: 2rem;
  height: 0.875rem;
  background: var(--fantasy-border);
  border-radius: 0.25rem;
  display: inline-block;
}

.premium-placeholder-bar-bg {
  width: 100%;
  height: 0.375rem;
  background: var(--fantasy-bg-tertiary);
  border-radius: 9999px;
  overflow: hidden;
}

.premium-placeholder-bar {
  height: 100%;
  background: var(--fantasy-border);
  border-radius: 9999px;
}

.premium-unlock-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--fantasy-purple), var(--fantasy-accent));
  border-radius: 0.5rem;
  text-decoration: none;
  box-shadow: 0 2px 10px var(--fantasy-accent-glow);
  transition: all 0.2s ease;
}

.premium-unlock-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--fantasy-accent-glow);
}

.premium-unlock-btn svg {
  width: 1rem;
  height: 1rem;
}

/* Premium feature badge for section headers */
.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: white;
  background: var(--fantasy-purple);
  border-radius: 9999px;
}
