@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --pt-bg: #e4f0f9;
  --pt-bg-deep: #c8dff0;
  --pt-surface: #ffffff;
  --pt-surface-soft: #f4f9fd;
  --pt-header-from: #0088d4;
  --pt-header-to: #006bb8;
  --pt-primary: #0095dd;
  --pt-primary-dark: #0078b8;
  --pt-primary-light: #e3f4fc;
  --pt-text: #2c3e50;
  --pt-text-muted: #6b8299;
  --pt-border: #c5d9ea;
  --pt-border-soft: #dceaf4;
  --pt-shadow: 0 4px 24px rgba(0, 100, 160, 0.1);
  --pt-shadow-lg: 0 8px 32px rgba(0, 100, 160, 0.14);
  --pt-radius: 1rem;
  --pt-radius-sm: 0.65rem;
  --pt-radius-pill: 999px;
  --pt-legal: #2ecc71;
  --pt-illegal: #e74c3c;
  --pt-shiny: #d4a017;
  --pt-shiny-bg: #fff8e1;
  --pt-slot-empty: #eef4f9;
  --pt-font: 'Nunito', system-ui, -apple-system, sans-serif;
}

html {
  font-size: 16px;
  position: relative;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--pt-font);
  background: var(--pt-bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(255, 255, 255, 0.7) 0%, transparent 60%),
    linear-gradient(180deg, var(--pt-bg) 0%, #d8eaf5 100%);
  background-attachment: fixed;
  color: var(--pt-text);
}

body.pt-app {
  padding-bottom: 3rem;
}

/* Header */
.pt-header {
  background: linear-gradient(180deg, var(--pt-header-from) 0%, var(--pt-header-to) 100%);
  box-shadow: 0 2px 12px rgba(0, 80, 140, 0.25);
  margin-bottom: 0;
}

.pt-header .navbar {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.pt-header .navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff !important;
  letter-spacing: -0.02em;
}

.pt-logo {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff 0%, #fff 44%, #e74c3c 44%, #e74c3c 56%, #fff 56%, #fff 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.pt-header .nav-link {
  color: rgba(255, 255, 255, 0.88) !important;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.4rem 0.85rem !important;
  border-radius: var(--pt-radius-pill);
  transition: background 0.15s, color 0.15s;
}

.pt-header .nav-link:hover,
.pt-header .nav-link:focus {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.15);
}

.pt-header .nav-link.active {
  color: var(--pt-primary-dark) !important;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.pt-header .navbar-text {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 600;
  font-size: 0.9rem;
}

.pt-header .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
  font-weight: 700;
  border-radius: var(--pt-radius-pill);
  font-size: 0.85rem;
}

.pt-header .btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
  color: #fff;
}

.pt-main {
  max-width: 960px;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.pt-footer {
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: 0.8rem;
  color: var(--pt-text-muted);
}

/* Panels */
.pt-panel {
  background: var(--pt-surface);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow);
  border: 1px solid var(--pt-border-soft);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.pt-panel-header {
  margin-bottom: 1rem;
}

.pt-panel-header h1,
.pt-panel-header h2 {
  font-weight: 800;
  color: var(--pt-text);
  margin-bottom: 0.25rem;
}

.pt-panel-sub {
  color: var(--pt-text-muted);
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(180deg, var(--pt-primary) 0%, var(--pt-primary-dark) 100%);
  border: none;
  border-radius: var(--pt-radius-pill);
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(0, 149, 221, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(180deg, #00a5ef 0%, var(--pt-primary) 100%);
  box-shadow: 0 4px 14px rgba(0, 149, 221, 0.45);
  transform: translateY(-1px);
}

.btn-outline-primary {
  color: var(--pt-primary-dark);
  border-color: var(--pt-primary);
  border-radius: var(--pt-radius-pill);
  font-weight: 700;
}

.btn-outline-primary:hover {
  background: var(--pt-primary-light);
  color: var(--pt-primary-dark);
  border-color: var(--pt-primary);
}

.btn-secondary,
.btn-outline-secondary {
  border-radius: var(--pt-radius-pill);
  font-weight: 700;
}

/* Forms */
.form-control {
  background: var(--pt-surface-soft);
  border: 2px solid var(--pt-border);
  border-radius: var(--pt-radius-sm);
  color: var(--pt-text);
  font-weight: 600;
  padding: 0.55rem 0.85rem;
}

.form-control:focus {
  background: var(--pt-surface);
  border-color: var(--pt-primary);
  color: var(--pt-text);
  box-shadow: 0 0 0 0.2rem rgba(0, 149, 221, 0.2);
}

.form-control::placeholder {
  color: #a0b4c8;
  font-weight: 500;
}

.form-text {
  color: var(--pt-text-muted);
  font-size: 0.82rem;
}

.alert {
  border-radius: var(--pt-radius-sm);
  border: none;
  font-weight: 600;
}

.alert-danger {
  background: #fdecea;
  color: #c0392b;
}

/* Hero / landing */
.hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}

.hero-logo {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff 0%, #fff 44%, #e74c3c 44%, #e74c3c 56%, #fff 56%, #fff 100%);
  border: 4px solid #fff;
  box-shadow: var(--pt-shadow-lg);
  margin: 0 auto 1.25rem;
}

.hero h1 {
  font-weight: 800;
  font-size: 2.25rem;
  color: var(--pt-text);
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
}

.hero .lead {
  max-width: 32rem;
  margin: 0 auto;
  color: var(--pt-text-muted);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.75rem;
}

.hero-actions .btn-lg {
  padding: 0.65rem 1.75rem;
  font-size: 1rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.feature-card {
  background: var(--pt-surface);
  border-radius: var(--pt-radius);
  padding: 1.5rem;
  border: 1px solid var(--pt-border-soft);
  box-shadow: var(--pt-shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--pt-shadow-lg);
}

.feature-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  background: var(--pt-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--pt-primary-dark);
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.45rem;
  color: var(--pt-text);
}

.feature-card p {
  color: var(--pt-text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.5;
}

/* Auth */
.auth-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #b8daf0 0%, var(--pt-bg) 40%, #d8eaf5 100%);
  font-family: var(--pt-font);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--pt-primary-dark);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.35rem;
  margin-bottom: 1.5rem;
}

.auth-brand .pt-logo {
  width: 2.25rem;
  height: 2.25rem;
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  background: var(--pt-surface);
  border: 1px solid var(--pt-border-soft);
  border-radius: var(--pt-radius);
  padding: 2rem;
  box-shadow: var(--pt-shadow-lg);
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  color: var(--pt-text);
}

.auth-sub {
  color: var(--pt-text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.auth-footer {
  margin-top: 1.25rem;
  margin-bottom: 0;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--pt-text-muted);
}

.auth-footer a {
  color: var(--pt-primary-dark);
  font-weight: 700;
}

.pt-form {
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.pt-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--pt-text);
}

/* Bank */
.bank-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.bank-header h1 {
  font-size: 1.65rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
  color: var(--pt-text);
}

.bank-stats {
  color: var(--pt-text-muted);
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.bank-search {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: min(100%, 18rem);
  max-width: 26rem;
}

.bank-search .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.box-tabs-wrap {
  background: linear-gradient(180deg, var(--pt-header-from) 0%, var(--pt-header-to) 100%);
  border-radius: var(--pt-radius-sm);
  padding: 0.65rem 0.75rem;
  margin-bottom: 1rem;
}

.box-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
}

.box-tab {
  flex: 0 0 auto;
  padding: 0.38rem 0.8rem;
  border-radius: var(--pt-radius-pill);
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  border: 2px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.box-tab:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.box-tab.active {
  background: #fff;
  color: var(--pt-primary-dark);
  border-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.box-tab.has-mons:not(.active) {
  border-color: rgba(255, 255, 255, 0.35);
}

.bank-box-panel {
  background: var(--pt-surface-soft);
  border-radius: var(--pt-radius);
  border: 2px solid var(--pt-border-soft);
  padding: 1rem;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}

@media (min-width: 768px) {
  .slot-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.55rem;
  }
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 0;
  padding: 0.25rem;
  border-radius: var(--pt-radius-sm);
  background: var(--pt-surface);
  color: inherit;
  text-decoration: none;
  font-size: 0.68rem;
  text-align: center;
  border: 2px solid var(--pt-border-soft);
  box-shadow: 0 1px 4px rgba(0, 80, 140, 0.06);
  transition: transform 0.1s, box-shadow 0.1s, border-color 0.1s;
}

.slot:not(.empty):hover {
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 100, 160, 0.15);
  border-color: var(--pt-primary);
  z-index: 1;
}

.slot-sprite {
  width: 2.75rem;
  height: 2.75rem;
  image-rendering: pixelated;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.08));
}

.slot.empty {
  background: var(--pt-slot-empty);
  color: #b0c4d8;
  border-style: dashed;
  border-color: var(--pt-border);
  box-shadow: none;
}

.slot.empty::before {
  content: '';
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--pt-border-soft);
  opacity: 0.6;
}

.slot.legal {
  border-color: var(--pt-legal);
}

.slot.illegal {
  border-color: var(--pt-illegal);
}

.slot.shiny {
  background: var(--pt-shiny-bg);
}

.slot.shiny .slot-name,
.shiny {
  color: var(--pt-shiny);
}

.slot-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  white-space: nowrap;
  margin-top: 0.1rem;
}

.slot-meta {
  color: var(--pt-text-muted);
  font-size: 0.62rem;
  font-weight: 600;
}

@media (max-width: 576px) {
  .slot-name,
  .slot-meta {
    display: none;
  }

  .slot-sprite {
    width: 3rem;
    height: 3rem;
  }
}

/* Search results */
.search-results h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
}

.pokemon-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pokemon-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--pt-surface);
  border-radius: var(--pt-radius-sm);
  text-decoration: none;
  color: inherit;
  border: 2px solid var(--pt-border-soft);
  box-shadow: 0 2px 8px rgba(0, 80, 140, 0.06);
  transition: transform 0.1s, box-shadow 0.1s;
}

.pokemon-card:hover {
  transform: translateX(3px);
  box-shadow: var(--pt-shadow);
  border-color: var(--pt-primary);
}

.pokemon-card.legal { border-left: 4px solid var(--pt-legal); }
.pokemon-card.illegal { border-left: 4px solid var(--pt-illegal); }

.pokemon-sprite {
  width: 3.25rem;
  height: 3.25rem;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.pokemon-card-name {
  font-weight: 800;
  display: block;
  font-size: 1rem;
}

.pokemon-card-meta {
  font-size: 0.85rem;
  color: var(--pt-text-muted);
  font-weight: 600;
}

/* Pokémon detail */
.breadcrumb-nav {
  margin-bottom: 1rem;
}

.breadcrumb-nav a {
  color: var(--pt-primary-dark);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
}

.breadcrumb-nav a:hover {
  text-decoration: underline;
}

.pokemon-detail {
  background: var(--pt-surface);
  border-radius: var(--pt-radius);
  padding: 1.5rem;
  border: 1px solid var(--pt-border-soft);
  box-shadow: var(--pt-shadow);
}

.pokemon-detail-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--pt-border-soft);
}

.pokemon-detail-sprite-wrap {
  background: var(--pt-surface-soft);
  border-radius: var(--pt-radius);
  border: 2px solid var(--pt-border-soft);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pokemon-detail-sprite {
  width: 7rem;
  height: 7rem;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
}

.pokemon-detail h1 {
  font-weight: 800;
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.pokemon-detail-species {
  color: var(--pt-text-muted);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.pokemon-detail-level {
  color: var(--pt-text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.shiny-badge {
  background: var(--pt-shiny-bg);
  color: var(--pt-shiny);
  font-weight: 700;
  border-radius: var(--pt-radius-pill);
}

.detail-grid {
  margin-bottom: 1.5rem;
}

.pt-dl {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.45rem 1rem;
}

.pt-dl dt {
  color: var(--pt-text-muted);
  font-weight: 700;
  font-size: 0.88rem;
}

.pt-dl dd {
  font-weight: 600;
  margin: 0;
}

.pokemon-detail h2 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
}

.hash {
  font-size: 0.75rem;
  word-break: break-all;
  background: var(--pt-surface-soft);
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
}

.legality {
  background: var(--pt-surface-soft);
  color: var(--pt-text);
  padding: 1rem;
  white-space: pre-wrap;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--pt-radius-sm);
  border: 2px solid var(--pt-border-soft);
  overflow-x: auto;
  font-family: ui-monospace, monospace;
}

.ok { color: var(--pt-legal); font-weight: 700; }
.bad { color: var(--pt-illegal); font-weight: 700; }

/* Devices / Saves */
.pairing-code {
  font-size: 2rem;
  letter-spacing: 0.25em;
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: var(--pt-primary-dark);
  background: var(--pt-primary-light);
  border-radius: var(--pt-radius-sm);
  padding: 0.75rem 1rem;
  text-align: center;
  border: 2px dashed var(--pt-primary);
}

.pt-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.pt-table thead th {
  background: var(--pt-primary-light);
  color: var(--pt-primary-dark);
  font-weight: 800;
  padding: 0.65rem 1rem;
  border-bottom: 2px solid var(--pt-border);
}

.pt-table thead th:first-child { border-radius: var(--pt-radius-sm) 0 0 0; }
.pt-table thead th:last-child { border-radius: 0 var(--pt-radius-sm) 0 0; }

.pt-table tbody td {
  padding: 0.65rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--pt-border-soft);
}

.pt-table tbody tr:last-child td {
  border-bottom: none;
}

.pt-table tbody tr:hover td {
  background: var(--pt-surface-soft);
}

.save-box-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0;
}

.save-box-tab {
  padding: 0.3rem 0.7rem;
  border-radius: var(--pt-radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--pt-border);
  color: var(--pt-text-muted);
  background: var(--pt-surface);
  transition: all 0.12s;
}

.save-box-tab:hover {
  border-color: var(--pt-primary);
  color: var(--pt-primary-dark);
}

.save-box-tab.active {
  background: var(--pt-primary);
  border-color: var(--pt-primary);
  color: #fff;
}

.upload-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem;
  background: var(--pt-surface-soft);
  border-radius: var(--pt-radius-sm);
  border: 2px dashed var(--pt-border);
}

.upload-zone input[type="file"] {
  font-weight: 600;
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .pt-dl {
    grid-template-columns: 1fr;
  }

  .pt-dl dt {
    margin-top: 0.5rem;
  }
}

a {
  color: var(--pt-primary-dark);
}

.alert-success {
  background: #eafaf1;
  color: #1e8449;
}

.alert-success .hash {
  background: #fff;
}

.admin-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--pt-radius-pill);
  background: var(--pt-primary-light);
  color: var(--pt-primary-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.75rem;
}

.admin-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem;
  background: var(--pt-surface-soft);
  border: 2px solid var(--pt-border-soft);
  border-radius: var(--pt-radius-sm);
  text-decoration: none;
  color: inherit;
}

a.admin-stat:hover {
  border-color: var(--pt-primary);
}

.admin-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--pt-primary-dark);
  line-height: 1.1;
}

.admin-stat-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--pt-text-muted);
}

.admin-row-actions {
  display: flex;
  gap: 0.75rem;
  white-space: nowrap;
}

.admin-pager {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  font-weight: 700;
}

.admin-inline-form {
  max-width: 24rem;
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.admin-rename-box {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  min-width: 14rem;
}

.danger-zone {
  border-color: #f5c6cb;
}

.danger-zone h2 {
  color: #c0392b;
}

.btn-outline-danger {
  border-radius: var(--pt-radius-pill);
  font-weight: 700;
}

.btn-danger {
  border-radius: var(--pt-radius-pill);
  font-weight: 700;
}
