/**
 * Monsterama Design System — Componentes Pokémon-like
 * Visual: Acolhedor, Vibrante, Aventureiro e Limpo
 */

/* ==========================================================================
   1. Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(14, 165, 233, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(34, 197, 94, 0.08) 0%, transparent 45%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg-app) 100%);
  background-attachment: fixed;
}

/* Custom Scrollbar Suave */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-surface-2);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-surface-2);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--brand-primary);
}

/* ==========================================================================
   2. Tipografia
   ========================================================================== */
.font-display {
  font-family: var(--font-family-display);
  letter-spacing: 0.02em;
}

.font-mono {
  font-family: var(--font-family-mono);
}

.title-display {
  font-family: var(--font-family-display);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.heading-lg {
  font-family: var(--font-family-display);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.heading-md {
  font-family: var(--font-family-display);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

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

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

.text-gold {
  color: #b45309;
}

/* ==========================================================================
   2.1 Marca / Logo
   ========================================================================== */
.brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: inherit;
}

.brand-logo:hover .brand-mark {
  filter: brightness(1.06);
}

.brand-mark {
  display: block;
  height: auto;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-mark--nav {
  height: 40px;
  max-width: 200px;
}

.brand-mark--hero {
  height: clamp(56px, 12vw, 96px);
  max-width: min(100%, 520px);
  margin-bottom: var(--space-3);
  filter: drop-shadow(0 4px 12px rgba(14, 165, 233, 0.25));
}

.brand-mark--footer {
  height: 32px;
  max-width: 180px;
  margin: 0 auto var(--space-3);
  opacity: 0.92;
}

.brand-mark--thumb {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: #0b1220;
  border-radius: 8px;
  padding: 2px;
}

.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  padding: var(--space-6) 0;
  border-top: 2px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (max-width: 600px) {
  .brand-mark--nav {
    height: 32px;
    max-width: 150px;
  }
}

/* ==========================================================================
   3. Badges Elementais & Raridades (Estilo Cápsula Pokémon)
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-family: var(--font-family-display);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  line-height: 1;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.badge img {
  width: 15px;
  height: 15px;
  object-fit: contain;
}

/* Badges Elementais Vibrantes */
.badge-agua {
  background: var(--elem-agua-light);
  color: var(--elem-agua-dark);
  border-color: var(--elem-agua-mid);
}

.badge-ar {
  background: var(--elem-ar-light);
  color: var(--elem-ar-dark);
  border-color: var(--elem-ar-mid);
}

.badge-fogo {
  background: var(--elem-fogo-light);
  color: var(--elem-fogo-dark);
  border-color: var(--elem-fogo-mid);
}

.badge-terra {
  background: var(--elem-terra-light);
  color: var(--elem-terra-dark);
  border-color: var(--elem-terra-mid);
}

.badge-planta {
  background: var(--elem-planta-light);
  color: var(--elem-planta-dark);
  border-color: var(--elem-planta-mid);
}

/* Badges de Raridades */
.badge-rarity-comum {
  background: var(--rarity-comum-bg);
  color: #475569;
  border-color: #cbd5e1;
}

.badge-rarity-incomum {
  background: var(--rarity-incomum-bg);
  color: #15803d;
  border-color: #86efac;
}

.badge-rarity-raro {
  background: var(--rarity-raro-bg);
  color: #1d4ed8;
  border-color: #93c5fd;
}

.badge-rarity-epico {
  background: var(--rarity-epico-bg);
  color: #7e22ce;
  border-color: #d8b4fe;
}

.badge-rarity-lendario {
  background: var(--rarity-lendario-bg);
  color: #b45309;
  border-color: #fcd34d;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

/* PowerScore Badge */
.badge-powerscore {
  background: #fdf2f8;
  color: #db2777;
  border-color: #fbcfe8;
  font-family: var(--font-family-mono);
  font-weight: var(--font-weight-bold);
}

/* ==========================================================================
   4. Botões Pokémon-like (Chunky, Tátil, Divertido)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.65rem 1.35rem;
  font-family: var(--font-family-display);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.03em;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  text-decoration: none;
  position: relative;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

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

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Variação Primária */
.btn-primary {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 3px 0 #3730a3;
}
.btn-primary:hover {
  background: var(--brand-primary-hover);
}

/* Ações de Combate Pokémon-like (Luta, Bolsa, Pokémon, Fuga) */
.btn-action-attack {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-color: #b91c1c;
  box-shadow: 0 3px 0 #991b1b;
}
.btn-action-attack:hover {
  filter: brightness(1.05);
}

.btn-action-move {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
  border-color: #0369a1;
  box-shadow: 0 3px 0 #075985;
}
.btn-action-move:hover {
  filter: brightness(1.05);
}

.btn-action-wait {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
  box-shadow: 0 3px 0 #94a3b8;
}
.btn-action-wait:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.btn-action-capture {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border-color: #b45309;
  box-shadow: 0 3px 0 #92400e;
}
.btn-action-capture:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-secondary);
  border-color: var(--border-default);
  box-shadow: 0 2px 0 #e2e8f0;
}
.btn-secondary:hover {
  background: #f8fafc;
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.9rem 1.8rem;
  font-size: var(--font-size-base);
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   5. Painéis & Caixas de Interface (Superfícies Claras e Acolhedoras)
   ========================================================================== */
.tactical-panel {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  position: relative;
  box-shadow: var(--shadow-card);
}

.tactical-panel-glass {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--bg-surface-2);
}

/* ==========================================================================
   6. Chips de Recursos (Estilo Inventário/Bolsa Pokémon)
   ========================================================================== */
.resource-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.resource-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.4rem 0.85rem;
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.resource-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--brand-primary);
}

.resource-chip img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* ==========================================================================
   7. Barras de Atributos & HP (Estilo Resumo Pokémon)
   ========================================================================== */
.stat-meter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: var(--space-2);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
}

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

.stat-value {
  font-family: var(--font-family-mono);
  color: var(--text-primary);
}

.stat-track {
  height: 8px;
  background: var(--bg-surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.stat-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-bounce);
}

.stat-fill-forca { background: var(--stat-forca); }
.stat-fill-resistencia { background: var(--stat-resistencia); }
.stat-fill-agilidade { background: var(--stat-agilidade); }
.stat-fill-velocidade { background: var(--stat-velocidade); }
.stat-fill-inteligencia { background: var(--stat-inteligencia); }

/* Barra de HP clássica de combate */
.hp-bar-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.hp-bar-track {
  height: 12px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal), background-color var(--transition-normal);
}

.hp-bar-fill.low-hp {
  background: linear-gradient(90deg, #ef4444, #dc2626);
  animation: pulse-low-hp 1s infinite alternate;
}

@keyframes pulse-low-hp {
  from { filter: brightness(1); }
  to { filter: brightness(1.2); }
}

/* ==========================================================================
   8. Cards de Monstros (Estilo Coleção / Pokédex / TCG)
   ========================================================================== */
.monster-card {
  background: #ffffff;
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.monster-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-card-hover);
}

/* Borda elemental suave no card */
.monster-card.elem-agua { border-color: var(--elem-agua-mid); }
.monster-card.elem-ar { border-color: var(--elem-ar-mid); }
.monster-card.elem-fogo { border-color: var(--elem-fogo-mid); }
.monster-card.elem-terra { border-color: var(--elem-terra-mid); }
.monster-card.elem-planta { border-color: var(--elem-planta-mid); }

.card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.monster-art-frame {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-lg);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Halo elemental de fundo na foto do monstro */
.monster-card.elem-agua .monster-art-frame { background: radial-gradient(circle, #e0f2fe 0%, #bae6fd 100%); }
.monster-card.elem-ar .monster-art-frame { background: radial-gradient(circle, #f1f5f9 0%, #cbd5e1 100%); }
.monster-card.elem-fogo .monster-art-frame { background: radial-gradient(circle, #fff7ed 0%, #ffedd5 100%); }
.monster-card.elem-terra .monster-art-frame { background: radial-gradient(circle, #fef3c7 0%, #fde68a 100%); }
.monster-card.elem-planta .monster-art-frame { background: radial-gradient(circle, #dcfce7 0%, #bbf7d0 100%); }

.monster-art-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-bounce);
}

.monster-card:hover .monster-art-frame img {
  transform: scale(1.08);
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.monster-name {
  font-family: var(--font-family-display);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.monster-level {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
}

/* Mini grid de stats derivados no card */
.combat-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  background: var(--bg-surface-2);
  border-radius: var(--radius-md);
  padding: var(--space-2);
}

.combat-stat-item {
  text-align: center;
}

.combat-stat-label {
  font-size: 0.68rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  color: var(--text-secondary);
  display: block;
}

.combat-stat-val {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
}

/* ==========================================================================
   9. Tabuleiro Tático 2D (Estilo Arena / Campo de Batalha Claro)
   ========================================================================== */
.tactical-board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

.tactical-grid {
  display: grid;
  grid-template-columns: repeat(5, 62px);
  grid-template-rows: repeat(5, 62px);
  gap: 5px;
  background: #e2e8f0;
  padding: 10px;
  border-radius: var(--radius-lg);
  border: 3px solid #cbd5e1;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.06);
}

.grid-cell {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.grid-cell:hover {
  background: #f0fdf4;
  border-color: #86efac;
}

/* Células de Movimento e Ataque */
.grid-cell.cell-move-range {
  background: #e0f2fe;
  border-color: #38bdf8;
}

.grid-cell.cell-attack-line {
  background: #fee2e2;
  border-color: #f87171;
}

.grid-cell.cell-blocked {
  background: #f1f5f9;
  border-color: #94a3b8;
  opacity: 0.7;
}

.grid-cell.cell-selected {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary);
}

/* Tokens de Unidade (Visual circular amigo) */
.unit-token {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  border: 3px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  position: relative;
}

.unit-token.ally {
  background: var(--elem-agua-gradient);
  color: #ffffff;
}

.unit-token.enemy {
  background: var(--elem-fogo-gradient);
  color: #ffffff;
}

/* ==========================================================================
   10. Log de Combate (Estilo Caixa de Diálogo Pokémon)
   ========================================================================== */
.combat-log-panel {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-xs);
  height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.log-entry {
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border-left: 4px solid #cbd5e1;
}

.log-entry.log-damage { border-left-color: var(--stat-forca); background: #fef2f2; }
.log-entry.log-turn { border-left-color: var(--brand-primary); }
.log-entry.log-capture { border-left-color: var(--accent-gold); background: #fffbeb; }
.log-entry.log-element { border-left-color: var(--elem-agua); background: #f0f9ff; }

/* ==========================================================================
   11. Matriz Elemental Tática
   ========================================================================== */
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  text-align: center;
  background: #ffffff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.matrix-table th, .matrix-table td {
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
}

.matrix-table th {
  background: var(--bg-surface-2);
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.advantage-30 {
  background: #dcfce7;
  color: #15803d;
  font-weight: var(--font-weight-bold);
}

.advantage-10 {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: var(--font-weight-semibold);
}

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