/* ==========================================================================
   JOGOS DO JONATHAN - DESIGN SYSTEM & STYLESHEET
   Estética: Fundo Branco Moderno, Minimalista, Altamente Polido
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Paleta Base - Fundo Branco e Tons Neutros */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --surface-card: #ffffff;
  
  /* Linhas e Bordas */
  --border-subtle: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-accent: rgba(99, 102, 241, 0.3);

  /* Tipografia */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Cores de Destaque */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.15);

  --accent-emerald: #10b981;
  --accent-emerald-light: #ecfdf5;
  --accent-amber: #f59e0b;
  --accent-amber-light: #fffbeb;

  /* Sombras Modernas (Soft Layered) */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 4px -1px rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 20px 32px -8px rgba(15, 23, 42, 0.12), 0 8px 16px -4px rgba(15, 23, 42, 0.06);

  /* Dimensões & Raios */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transições */
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset Global */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fundo sutil com gradiente ambiente limpo */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 500px;
  background: radial-gradient(circle at 50% -10%, rgba(99, 102, 241, 0.05) 0%, rgba(16, 185, 129, 0.03) 45%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Container Principal */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   CABEÇALHO & BRANDING
   ========================================================================== */
.header-hero {
  text-align: center;
  max-width: 820px;
  margin: 0 auto 3rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(79, 70, 229, 0.15);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast);
}

.brand-badge:hover {
  transform: translateY(-1px);
}

.brand-badge-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}

.site-title {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2.5rem, 5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.site-title span {
  background: linear-gradient(135deg, #4f46e5 20%, #2563eb 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.site-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Estatísticas Rápidas */
.stats-banner {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
}

.stat-number {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ==========================================================================
   BARRA DE FILTROS POR CATEGORIA
   ========================================================================== */
.controls-section {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2.5rem;
  background: var(--bg-primary);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  max-width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

/* Filtros por Categoria */
.category-filters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* ==========================================================================
   GRADE DE CARDS DOS JOGOS
   ========================================================================== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
}

/* Card Individual */
.game-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth);
  position: relative;
}

.game-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
}

/* Capa / Banner do Card */
.card-banner {
  height: 180px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

.card-banner-svg {
  width: 90px;
  height: 90px;
  transition: transform var(--transition-bounce);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.15));
}

.game-card:hover .card-banner-svg {
  transform: scale(1.12) rotate(4deg);
}

/* Badges sobre a capa */
.card-badges {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.badge-category {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
}

.badge-status.available {
  background: rgba(16, 185, 129, 0.95);
  color: white;
}

.badge-status.soon {
  background: rgba(245, 158, 11, 0.95);
  color: white;
}

.badge-featured {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #fef3c7;
  color: #b45309;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid #fde68a;
}

/* Corpo do Card */
.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  flex: 1;
}

/* Tags de tecnologia */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.tag-pill {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* Rodapé de Ações do Card */
.card-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
}

.btn-play {
  flex: 1;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem;
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.btn-play:hover {
  background: #1e293b;
  border-color: #1e293b;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.btn-play .btn-external-icon {
  margin-left: auto;
  opacity: 0.6;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.btn-play:hover .btn-external-icon {
  opacity: 1;
  transform: translate(2px, -2px);
}

.btn-play.disabled {
  background: var(--bg-tertiary);
  border-color: var(--border-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-icon-action:hover {
  background: var(--bg-tertiary);
  color: var(--primary);
  border-color: var(--border-hover);
}

/* Card Especial: Adicionar Novo Jogo */
.card-add-new {
  background: var(--bg-secondary);
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  min-height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.card-add-new:hover {
  background: var(--bg-primary);
  border-color: var(--primary);
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
}

.add-new-icon-box {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  transition: transform var(--transition-bounce);
}

.card-add-new:hover .add-new-icon-box {
  transform: scale(1.15);
}

.add-new-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.add-new-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 220px;
}

/* Estado de busca vazia */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.empty-state h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   MODAL: PLAYER EMBUTIDO DE JOGO
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-primary);
  width: 100%;
  max-width: 1000px;
  height: 85vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-smooth);
  border: 1px solid var(--border-subtle);
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-primary);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.modal-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

.modal-body {
  flex: 1;
  position: relative;
  background: #090d16;
}

.game-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.game-placeholder-warning {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  padding: 2rem;
  text-align: center;
  background: #090d16;
}

/* ==========================================================================
   MODAL: ADICIONAR NOVO JOGO
   ========================================================================== */
.form-modal-container {
  max-width: 580px;
  height: auto;
  max-height: 90vh;
  overflow-y: auto;
}

.form-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  outline: none;
  transition: all var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  background: var(--bg-primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.btn-secondary {
  padding: 0.75rem 1.25rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-primary {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-inverse);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

/* ==========================================================================
   RODAPÉ
   ========================================================================== */
.site-footer {
  text-align: center;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.875rem;
}

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

/* Toast de Notificação */
.toast-msg {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-bounce);
}

.toast-msg.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVIDADE
   ========================================================================== */
@media (max-width: 768px) {
  .app-container {
    padding: 1.5rem 1rem 3rem;
  }

  .site-title {
    font-size: 2.25rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .controls-top {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-add-game {
    justify-content: center;
  }

  .modal-container {
    height: 94vh;
    border-radius: var(--radius-md);
  }
}
