/* ============================================================
   DUNGEON EVOLUTION — components.css
   Botões, cards, modais, inputs, badges, toasts
   ============================================================ */

/* --- Botões --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: var(--font-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn:hover::before { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, #c9a84c, #8a6520);
  color: #0d0a05;
  border: 1px solid var(--gold);
  box-shadow: 0 0 20px var(--gold-glow);
}
.btn-primary:hover {
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}
.btn-secondary:hover {
  border-color: var(--gold);
  background: var(--gold-glow);
}

.btn-danger {
  background: transparent;
  color: var(--life-bright);
  border: 1px solid var(--life-dim);
}
.btn-danger:hover {
  border-color: var(--life);
  background: var(--life-glow);
}

.btn-arcane {
  background: linear-gradient(135deg, rgba(0,212,255,0.2), rgba(0,212,255,0.05));
  color: var(--arcane);
  border: 1px solid var(--arcane-dim);
}
.btn-arcane:hover {
  border-color: var(--arcane);
  box-shadow: var(--shadow-arcane);
}

/* Poções (verde cura) */
.btn-consumable {
  background: linear-gradient(135deg, rgba(57,230,129,0.15), rgba(57,230,129,0.03));
  color: var(--defense);
  border: 1px solid var(--defense-dim);
}
.btn-consumable:hover {
  border-color: var(--defense);
  box-shadow: 0 0 12px rgba(57,230,129,0.3);
}

/* Grimórios (roxo mana) */
.btn-grimoire {
  background: linear-gradient(135deg, rgba(168,113,243,0.15), rgba(168,113,243,0.03));
  color: var(--mana-bright);
  border: 1px solid var(--mana-dim);
}
.btn-grimoire:hover {
  border-color: var(--mana-bright);
  box-shadow: 0 0 12px rgba(168,113,243,0.3);
}

.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: var(--font-xs); }
.btn-lg { padding: 16px 32px; font-size: var(--font-md); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}
.card:hover { border-color: var(--border); }
.card-glow {
  border-color: var(--border);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* --- Inputs --- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.input-label {
  font-family: var(--font-display);
  font-size: var(--font-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.input-field {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: var(--font-md);
  transition: all var(--transition);
  outline: none;
  width: 100%;
}
.input-field::placeholder { color: var(--text-muted); }
.input-field:focus {
  border-color: var(--gold-dim);
  background: rgba(0,0,0,0.6);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.input-field.error { border-color: var(--life); }

/* --- Divisor decorativo --- */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* --- Badge de raridade --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.1);
}

/* --- Toast / Notificações --- */
.toast-container {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: var(--font-sm);
  box-shadow: var(--shadow-card);
  animation: slideUp 0.3s ease forwards;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.toast.success { border-color: var(--defense); color: var(--defense); }
.toast.error   { border-color: var(--life);    color: var(--life-bright); }
.toast.info    { border-color: var(--arcane);  color: var(--arcane); }
.toast.warning { border-color: var(--gold);    color: var(--gold); }

/* --- Spinner de loading --- */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: rotate 0.8s linear infinite;
  display: inline-block;
}

/* --- Loading overlay --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  z-index: 9998;
}
.loading-overlay .spinner {
  width: 40px;
  height: 40px;
  border-width: 3px;
}
.loading-overlay p {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-transform: uppercase;
}

/* --- Modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.8);
}
.modal-backdrop.open .modal {
  transform: translateY(0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}

.modal-header {
  padding: var(--space-md) var(--space-lg) var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-card);
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: 0.05em;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.2rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--border-card); }

.modal-body {
  padding: var(--space-lg);
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition);
  min-width: 52px;
}
.nav-item.active { color: var(--gold); }
.nav-item:hover  { color: var(--text-secondary); }

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-item span {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* --- Page container --- */
.page {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + var(--space-lg));
}

.page-header {
  padding: var(--space-lg) var(--space-md) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: 0.05em;
}

.page-content {
  padding: 0 var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  animation: fadeIn 0.4s ease;
}

/* --- Stat display --- */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-card);
}
.stat-row:last-child { border-bottom: none; }

.stat-label {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-value {
  font-family: var(--font-display);
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--text-heading);
}

/* --- Utilitários --- */
.text-gold    { color: var(--gold); }
.text-arcane  { color: var(--arcane); }
.text-life    { color: var(--life-bright); }
.text-mana    { color: var(--mana-bright); }
.text-defense { color: var(--defense); }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-secondary); }

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm       { gap: var(--space-sm); }
.gap-md       { gap: var(--space-md); }

.w-full       { width: 100%; }
.hidden       { display: none !important; }
.fade-in      { animation: fadeIn 0.4s ease forwards; }
