@import url('https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100..900;1,100..900&family=Lora:ital,wght@0,400..700;1,400..700&display=swap');

:root {
  --font-base: 'Jost', sans-serif;
  --font-alt: 'jost', serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-base);
}

body {
  background: #f3f3f3;
  color: #333;
}

/* HEADER */

.topbar {
  width: 100%;
  padding: 20px 5%;
  background: #ff5350;
  color: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand .logo {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.brand .logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand h1 {
  font-size: 36px;
  font-weight: 400;
  font-family: var(--font-alt);
}

.subtitle {
  font-size: 26px;
  opacity: 0.8;
  font-weight: 400;
}

.theme-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #222;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  z-index: 2000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: 0.2s;
}

.theme-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* CONTAINER */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 5%;
}

/* BUSCADOR */

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}

.hero-left {
  max-width: 500px;
}

.hero-left h2 {
  font-size: 36px;
  margin-bottom: 10px;
}

.lead {
  font-size: 18px;
  margin-bottom: 20px;
  opacity: 0.85;
}

/* INPUT */
.searchbox {
  display: flex;
  gap: 10px;
}

.searchbox input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-size: 16px;
}

.searchbox button {
  padding: 12px 20px;
  background: #ff5350;
  border: none;
  color: white;
  font-size: 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
}

.searchbox button:hover {
  background: #9e3533;
}

.searchbox button:active {
  background: #000000;
}

/* Hero image */
.hero-right {
  text-align: center;
}

.hero-right img {
  width: 260px;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.55));
}

.hero-caption {
  margin-top: 8px;
  font-size: 14px;
  opacity: 0.7;
}

/* GRID */

.results {
  margin-top: 40px;
}

.results h3 {
  margin-bottom: 20px;
  font-size: 26px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}

.card {
  background: #ffffff;
  border-radius: 18px;
  padding: 18px 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
  text-align: center;
  cursor: pointer;
  transition: transform .20s ease, box-shadow .20s ease;
  border: 2px solid transparent;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
}

.card img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin: 10px auto;
  display: block;
}

.card-name {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  text-transform: capitalize;
  margin-top: 6px;
}

.card-id {
  font-size: 14px;
  color: #888;
  margin-top: 4px;
}

#cards-grid {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 22px;
  padding: 10px;
}

.types {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.type {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: white;
}

/* FOOTER */

.site-footer {
  text-align: center;
  margin-top: 40px;
  color: #555;
  padding-bottom: 30px;
}

.site-footer a {
  color: #000000;
  text-decoration: none;
  font-size: 15px;
}

/* MODAL — Fundo e estrutura */

.modal-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  overflow-y: auto;
  z-index: 9999;
  animation: fadeIn .2s ease;
}

.hidden {
  display: none;
}


/* CONTEÚDO DO MODAL */

.modal {
  background: #fff;
  width: 100%;
  max-width: 550px;
  border-radius: 20px;
  padding: 25px 25px 40px;
  position: relative;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.55);
  animation: scaleIn .25s ease;
}


/* BOTÃO DE FECHAR */

.close-modal {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #e63946;
  border: none;
  width: 32px;
  height: 32px;
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  border-radius: 50%;
  cursor: pointer;
  transition: 0.2s;
}

.close-modal:hover {
  background: #b71c1c;
}


/* CABEÇALHO DO MODAL */

.modal-header {
  text-align: center;
}

.modal-header h2 {
  margin-bottom: 15px;
  font-size: 26px;
  font-weight: 700;
  color: #333;
}

.modal-header img {
  width: 180px;
  height: auto;
  margin-bottom: 10px;
}


/* SEÇÕES E TÍTULOS */

.modal-section {
  margin-top: 25px;
}

.modal-section h3 {
  font-size: 20px;
  font-weight: 600;
  color: #444;
  margin-bottom: 8px;
}

.modal-section p,
.modal-section li {
  font-size: 15px;
  line-height: 1.6;
  color: #555;
}


/* STATS */

.stats-list {
  list-style: none;
  padding: 0;
}

.stats-list li {
  background: #f2f2f2;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 15px;
}

.modal-section ul li {
  margin-bottom: 6px;
}

/* ANIMAÇÕES DO MODAL */

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.85);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/*MODO ESCURO*/
.theme-btn {
  background: #222;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s;
}

.theme-btn:hover {
  opacity: 0.8;
}

body.dark {
  background: #1a1a1a;
  color: #f3f0f0;
}

body.dark .hero {
  background-color: #111;
}

/* Header */
body.dark .topbar {
  background: #111;
}


/* Cards */
body.dark .card {
  background: #222;
  border-color: #444 !important;
  color: #fff;
}

body.dark .card-id {
  color: #fdfafa;
}

/* Modal */
body.dark .modal {
  background: #222;
  color: #fff;
}

body.dark .stats-list li {
  background: #333;
}

body.dark .close-modal {
  background: #e63946;
}

/* Input / botão */
body.dark input {
  background: #222;
  color: #fff;
  border: 1px solid #444;
}

body.dark button {
  background: #333;
  color: #fff;
}

body.dark .card-name {
  color: #ccc;
}

body.dark .modal-header h2 {
  color: #ccc;
}

body.dark .modal-section h3 {
  color: #ccc;
}

body.dark .modal-section p {
  color: #ccc;
}

body.dark li {
  color: #ccc;
}

body.dark footer {
  color: #ccc;
}

body.dark footer a {
  color: #ccc;
}

/* RESPONSIVIDADE */
@media (max-width: 480px) {
  .theme-btn {
    top: 14px;
    right: 14px;
    padding: 8px 14px;
    font-size: 13px;
  }

  .topbar {
    padding: 20px;
    flex-direction: column;
    text-align: center;
  }

  .brand {
    flex-direction: column;
    gap: 10px;
  }

  .brand .logo img {
    width: 60px;
    height: 60px;
  }

  .titles h1 {
    font-size: 28px;
  }

  .titles .subtitle {
    font-size: 14px;
  }

  #search-form {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  #search-form input {
    width: 100%;
    font-size: 16px;
    padding: 12px;
  }

  #search-form button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
  }

  #cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    padding: 10px;
  }

  .card {
    padding: 12px;
  }

  .card img {
    width: 100px;
    height: 100px;
  }

  .card-name {
    font-size: 16px;
  }

  .modal {
    max-width: 90%;
    padding: 18px;
    border-radius: 14px;
  }

  .modal-header img {
    width: 150px;
  }

  .modal-header h2 {
    font-size: 20px;
  }

  .modal-section h3 {
    font-size: 18px;
    margin-bottom: 5px;
  }

  .modal-section p,
  .modal-section li {
    font-size: 14px;
  }

  .close-modal {
    width: 28px;
    height: 28px;
    font-size: 18px;
    top: 8px;
    right: 8px;
  }
}