/* #region Root Variables */
:root {
  --bg-main: #edf2f7;
  --bg-card: #ffffff;
  --text-dark: #0f172a;
  --nintendo-red: #ff0000;
  --nintendo-red2: #ff00006d;
  --glass: rgba(255, 255, 255, 0.8);
  --border: rgba(0, 0, 0, 0.1);
  --font-stack: "Inter", -apple-system, sans-serif;
  --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --tab-text: var(--text-dark);
  --tab-bg: var(--border);
  --tab-bg-active: var(--nintendo-red);
  --tab-bg2-active: var(--nintendo-red2);
  --tab-text-active: #ffffff;
}

.dark-mode {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --text-dark: #f8fafc;
  --glass: rgba(15, 23, 42, 0.9);
  --border: rgba(255, 255, 255, 0.1);
  --shadow-soft: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  --tab-text: var(--text-dark);
  --tab-bg: var(--border);
  --tab-bg-active: var(--nintendo-red);
  --tab-text-active: #ffffff;
}
/* #endregion */

/* #region Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body,
html {
  background-color: var(--bg-main);
  color: var(--text-dark);
  font-family: var(--font-stack);
  transition: background-color 0.3s ease;
  background-image: radial-gradient(var(--border) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  background-attachment: fixed;
  touch-action: manipulation;
  min-height: 100vh;
  display: flow-root;
}

body.noscroll {
  overflow: hidden;
}
/* #endregion */

/* #region Header Layout */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease;
}

.header-content {
  max-width: 1440px;
  margin: 0 auto;
  height: 72px;
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
/* #endregion */

/* #region Header Branding */
.title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 45px;
  letter-spacing: -1px;
  text-transform: lowercase;
}

.title::before {
  content: "";
  position: absolute;
  left: 0;
  width: 32px;
  height: 32px;
  border: 3px solid #0f172a;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--nintendo-red) 46%, #0f172a 46%, #0f172a 54%, #ffffff 54%);
}

.title::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 12px;
  width: 8px;
  height: 8px;
  background: #ffffff;
  border: 2px solid #0f172a;
  border-radius: 50%;
  z-index: 1;
}
/* #endregion */

/* #region Header Actions (Search + Theme Toggle) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-input {
  background: var(--bg-main);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--text-dark);
  font-size: 16px;
  width: 240px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--nintendo-red);
  box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  background: var(--text-dark);
  color: var(--bg-main);
}

.theme-btn::after {
  content: "☾";
}

.dark-mode .theme-btn::after {
  content: "☼";
}
/* #endregion */

/* #region Layout & Grid */
.main-container {
  max-width: 1440px;
  margin: 72px auto 0;
  padding: 48px 40px;
}

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

.error-container {
  display: flex;
  justify-content: center;
  align-items: center;
  grid-column: 1 / -1;
  width: 100%;
  padding: 50px;
  font-size: 40px;
}
/* #endregion */

/* #region Dialog Container */
dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

dialog {
  border-radius: 25px;
  padding: 0;
  max-width: 450px;
  width: 95%;
  background: var(--bg-main);
  color: var(--text-dark);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  margin: auto;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

.dialog-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  position: relative;
  min-height: 400px;
}

#dialogTypes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 20px;
}

.dialog-separator {
  border: 1px solid rgba(255, 255, 255, 0.166);
  width: 100%;
}

.dialog-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: var(--text-dark);
  opacity: 0.7;
  margin-bottom: 10px;
}

.close-btn {
  background: var(--border);
  color: var(--text-dark);
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
}

.close-btn:hover {
  filter: brightness(1.2);
  background-color: var(--nintendo-red);
}

.dialog-image-container {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 200px;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  position: relative;
}

#dialogImg {
  height: 200px;
}

.dialog-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-card);
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  opacity: 0.95;
}

.dialog-arrow.left {
  left: -90px;
}

.dialog-arrow.right {
  right: -90px;
}

.dialog-arrow:hover {
  filter: brightness(1.1);
}

#dialogName {
  font-size: 32px;
  text-transform: capitalize;
  margin: 10px 0;
  color: var(--text-dark);
}

.dialog-stats {
  width: 100%;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* #endregion */

/* #region Evolution Chain */
.evolution-chain {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  margin-top: 20px;
}

.evolution-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s;
}

.evolution-item:hover {
  transform: translateY(-5px);
}

.evolution-image-container {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.evolution-item img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.evolution-name {
  font-weight: bold;
  text-transform: capitalize;
  font-size: 14px;
  color: var(--text-dark);
}

.evolution-arrow {
  color: var(--text-dark);
  font-size: 24px;
  opacity: 0.6;
  font-weight: bold;
}
/* #endregion */
