:root {
  --pink: #f51d55;
  --dark: #0d0d0f;
  --panel: #18181c;
  --panel-light: #24242b;
  --text: #ffffff;
  --muted: #b6b6c0;
  --success: #49d17d;
  --danger: #ff6262;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--dark);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  min-height: 100vh;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
}

.navbar {
  min-height: 64px;
  padding: 0 4%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #090909;
  border-bottom: 1px solid #292929;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  color: white;
  font-size: 1.45rem;
  font-weight: bold;
  cursor: pointer;
}

.logo span {
  color: var(--pink);
}

.account-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.account-switcher select {
  padding: 4px 8px;
  background: #222;
  border: 1px solid #444;
  font-size: 0.85rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links button {
  color: white;
  background: transparent;
  font-weight: bold;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.nav-links button:hover {
  color: var(--pink);
  background: rgba(255, 255, 255, 0.05);
}

.menu-button {
  display: none;
  color: white;
  background: transparent;
  font-size: 1.5rem;
}

.hero {
  min-height: 320px;
  padding: 50px 7%;
  display: flex;
  align-items: center;
  background:
    radial-gradient(circle at 15% 30%, #ff718d 0 2px, transparent 3px),
    radial-gradient(circle at 80% 20%, #ff718d 0 2px, transparent 3px),
    linear-gradient(120deg, #f51d55, #8c153e 60%, #24101d);
  background-size: 26px 26px, 32px 32px, auto;
}

.hero-content {
  max-width: 650px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.1;
  margin-bottom: 14px;
}

.hero h1 span {
  color: #ffd1dc;
}

.hero p {
  color: #ffe7ed;
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

.search-box {
  display: flex;
  max-width: 680px;
  background: #292930;
  border: 1px solid #44444d;
  border-radius: 8px;
  overflow: hidden;
}

.search-box:focus-within {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(245, 29, 85, 0.35);
}

/* Category dropdown (left of the input) */
.search-box .search-category {
  flex: 0 0 auto;
  width: auto;
  min-width: 128px;
  padding: 12px 14px;
  color: white;
  background: var(--panel-light);
  border: none;
  border-right: 1px solid #44444d;
  border-radius: 0;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
}

.search-box .search-category option {
  background: var(--panel);
  color: white;
}

.search-box input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border: none;
  border-radius: 0;
  outline: none;
  font-size: 1rem;
}

.search-box button {
  flex: 0 0 auto;
  width: 55px;
  color: white;
  background: var(--dark);
  font-size: 1.2rem;
}

.search-box button:hover {
  background: var(--pink);
}

/* Heading row: result count + clear button */
.search-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-clear {
  white-space: nowrap;
}

.search-clear[hidden] {
  display: none;
}

/* "Why did this match?" line on search-result cards */
.match-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.match-note span {
  padding: 3px 8px;
  color: #cfe3ff;
  background: #1f3150;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.3;
}

@media (max-width: 600px) {
  .search-box {
    flex-wrap: wrap;
  }
  .section-heading {
    flex-wrap: wrap;
    gap: 10px;
  }
  .search-box .search-category {
    flex: 1 0 100%;
    border-right: none;
    border-bottom: 1px solid #44444d;
  }
}

.container {
  width: min(1200px, 92%);
  margin: 0 auto;
  padding: 35px 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.section-heading h2 {
  font-size: 1.7rem;
}

.muted {
  color: var(--muted);
}

.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px;
}

.anime-card {
  overflow: hidden;
  background: var(--panel);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.anime-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 28px rgba(245, 29, 85, 0.25);
}

.poster {
  height: 280px;
  padding: 18px;
  display: flex;
  align-items: flex-end;
  background: #222;
  position: relative;
  overflow: hidden;
}

.poster-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* .poster-title {
  position: relative;
  z-index: 2;
  max-width: 90%;
  font-size: 1.3rem;
  font-weight: bold;
  text-shadow: 0 2px 5px #000;
} */

.card-body {
  padding: 15px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-body h3 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.tag {
  padding: 3px 8px;
  color: #ffd5df;
  background: #542031;
  border-radius: 12px;
  font-size: 0.75rem;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}

.primary, .secondary, .danger {
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.85rem;
}

.primary { color: white; background: var(--pink); }
.secondary { color: white; background: var(--panel-light); }
.danger { color: white; background: #8e202b; }

.primary:hover, .secondary:hover, .danger:hover {
  filter: brightness(1.2);
}

.page-title {
  margin-bottom: 25px;
  font-size: 2rem;
}

.panel {
  padding: 24px;
  margin-bottom: 24px;
  background: var(--panel);
  border-radius: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group.full {
  grid-column: 1 / -1;
}

label {
  color: #eeeeee;
  font-weight: bold;
  font-size: 0.9rem;
}

input, select, textarea {
  padding: 10px 12px;
  color: white;
  background: #292930;
  border: 1px solid #44444d;
  border-radius: 6px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--pink);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid #33333b;
}

th {
  color: #ff9bb0;
}

.detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
}

.detail-poster {
  min-height: 380px;
  border-radius: 10px;
  background: #222;
  position: relative;
  overflow: hidden;
}

.detail-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.review {
  padding: 15px 0;
  border-bottom: 1px solid #393942;
}

.review strong {
  color: #ffb8c7;
}

.profile {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}

.avatar {
  width: 75px;
  height: 75px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--pink);
  border-radius: 50%;
  font-size: 2rem;
  font-weight: bold;
}

.empty {
  padding: 50px 15px;
  color: var(--muted);
  text-align: center;
  background: var(--panel);
  border-radius: 10px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 500;
  padding: 14px 18px;
  color: white;
  background: #2e9e5b;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(20px);
  transition: 0.25s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

footer {
  padding: 30px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid #28282d;
  margin-top: 40px;
}

.deleted-row {
  opacity: 0.55;
}

.deleted-badge {
  display: inline-block;
  padding: 3px 8px;
  color: #ffd5d5;
  background: #72252d;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
}

.active-badge {
  display: inline-block;
  padding: 3px 8px;
  color: #caffdb;
  background: #21683d;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
}

.genre-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  max-height: 180px;
  overflow-y: auto;
  background: #121216;
  padding: 12px;
  border: 1px solid #2d2d38;
  border-radius: 6px;
}

.genre-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #e0e0e0;
  user-select: none;
}

.genre-checkbox-item input[type="checkbox"] {
  accent-color: #ff2a5f;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ---------- Characters & Voice Actors ---------- */
.cast-grid {
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 12px;
}

.cast-card {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 14px;
  padding: 10px;
  background: var(--panel-light);
  border-radius: 10px;
}

.cast-character,
.cast-actor {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cast-actors {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.cast-actor {
  justify-content: flex-end;
  text-align: right;
}

.cast-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cast-text strong {
  overflow-wrap: anywhere;
}

.cast-character .muted,
.cast-actor .muted {
  font-size: 0.85rem;
}

/* Character / voice actor picture (initials show when there is no picture) */
.cast-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b3b48, #2a2a33);
}

.cast-initials {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: bold;
  letter-spacing: 1px;
}

.cast-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* Add Anime form: character rows */
.cast-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.cast-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.4fr 1fr 1fr auto;
  gap: 8px;
}

/* second line of a cast row: the two picture URLs */
.cast-row-images {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cast-row-images input {
  min-width: 0;
}

.cast-row input,
.cast-row select {
  min-width: 0;
}

.cast-add {
  align-self: flex-start;
  margin-bottom: 8px;
}

/* Clickable posters */
.poster {
  cursor: pointer;
}

.poster .poster-image {
  transition: transform 0.3s;
}

.poster:hover .poster-image {
  transform: scale(1.05);
}

.poster:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: -3px;
}

/* Detail page: action buttons + admin edit panel */
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.edit-panel {
  border: 1px solid rgba(245, 29, 85, 0.45);
}

.edit-subtitle {
  margin: 26px 0 12px;
  font-size: 1.05rem;
}

.cast-edit-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  background: var(--panel-light);
  border-radius: 10px;
}

.cast-edit-person {
  display: grid;
  grid-template-columns: 52px minmax(120px, 220px) 1fr;
  align-items: center;
  gap: 12px;
}

.cast-edit-person input {
  min-width: 0;
}

.edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 800px) {
  .cast-row { grid-template-columns: 1fr 1fr; }
  .cast-row-images { grid-template-columns: 1fr; }
  .cast-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .cast-edit-person { grid-template-columns: 52px 1fr; }
  .cast-edit-person input { grid-column: 1 / -1; }
}


/* ============================================================
   NAVIGATION (role based buttons) + mobile menu
   ============================================================ */
.nav-links {
  gap: 4px;
}

.nav-links button {
  padding: 8px 10px;
  font-size: 0.92rem;
}

.nav-links button[hidden] {
  display: none;
}

.nav-links button.active {
  color: var(--pink);
}

.nav-links .nav-cta {
  color: var(--pink);
  border: 1px solid var(--pink);
}

.nav-links .nav-cta:hover {
  color: white;
  background: var(--pink);
}

@media (max-width: 1000px) {
  .menu-button {
    display: block;
    order: 2;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 4% 14px;
    background: #090909;
    border-bottom: 1px solid #292929;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links button {
    padding: 12px 10px;
    text-align: left;
  }
}

@media (max-width: 700px) {
  .navbar {
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .account-switcher {
    order: 3;
    width: 100%;
    padding-bottom: 6px;
  }

  .account-switcher select {
    flex: 1;
    min-width: 0;
  }
}

/* banned account notice */
.ban-banner {
  padding: 12px 4%;
  color: #ffd9d9;
  background: #5a1a22;
  border-bottom: 1px solid #8e202b;
  font-size: 0.92rem;
}

/* ============================================================
   RATINGS, WATCH STATUS, REVIEWS
   ============================================================ */
.rating-chip {
  margin-left: 8px;
  padding: 2px 8px;
  color: #ffe08a;
  background: #4a3b12;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
  white-space: nowrap;
}

.rating-summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
}

.rating-big {
  color: #ffd54a;
  font-size: 1.4rem;
  font-weight: bold;
}

.watch-row {
  margin-top: 8px;
}

.watch-select {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.85rem;
}

.watch-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.watch-inline .watch-select {
  width: auto;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.chip {
  padding: 8px 14px;
  color: white;
  background: var(--panel-light);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: bold;
}

.chip span {
  margin-left: 6px;
  padding: 1px 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font-size: 0.75rem;
}

.chip:hover {
  filter: brightness(1.2);
}

.chip.active {
  background: var(--pink);
}

.link-button {
  padding: 0;
  color: #ff9bb0;
  background: none;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover {
  color: var(--pink);
}

.review-mine {
  padding-left: 12px;
  background: rgba(245, 29, 85, 0.07);
  border-left: 3px solid var(--pink);
}

.review-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ============================================================
   STAFF + STUDIOS
   ============================================================ */
.staff-grid {
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.staff-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--panel-light);
  border-radius: 10px;
}

.studio-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.studio-tools input[type="search"] {
  flex: 1 1 260px;
  max-width: 420px;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.studio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.studio-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  color: white;
  text-align: left;
  background: var(--panel);
  border: 1px solid #2a2a33;
  border-radius: 10px;
  transition: transform 0.2s, border-color 0.2s;
}

.studio-card:hover {
  transform: translateY(-3px);
  border-color: var(--pink);
}

.studio-card h3 {
  font-size: 1.1rem;
}

.studio-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ============================================================
   SIGN UP, ACCOUNTS, SYSTEM
   ============================================================ */
.container.narrow {
  width: min(640px, 92%);
}

.form-group[hidden] {
  display: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 16px;
  color: var(--muted);
  text-align: center;
  background: var(--panel);
  border-radius: 10px;
}

.stat-card strong {
  display: block;
  color: var(--pink);
  font-size: 1.8rem;
}

.bar {
  min-width: 120px;
  height: 8px;
  overflow: hidden;
  background: var(--panel-light);
  border-radius: 4px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--pink);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* small polish */
.panel h2 + .review {
  margin-top: 12px;
}

.panel .anime-card {
  background: var(--panel-light);
}

.banned-row td {
  color: var(--muted);
}


/* ============================================================
   LOGIN SYSTEM: header badge, login page, profile security
   ============================================================ */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  font-size: 0.85rem;
  background: var(--panel-light);
  border-radius: 22px;
}

.user-chip[hidden] {
  display: none;
}

.chip-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--pink);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: bold;
}

.chip-name {
  max-width: 150px;
  overflow: hidden;
  font-weight: bold;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-links .nav-logout {
  color: #ff9bb0;
}

.nav-links .nav-logout:hover {
  color: white;
  background: var(--pink);
}

.auth-notice {
  margin-bottom: 18px;
  padding: 10px 14px;
  color: #ffe9b0;
  background: #4a3b12;
  border-radius: 8px;
  font-size: 0.9rem;
}

.auth-error {
  margin-top: 16px;
  padding: 10px 14px;
  color: #ffd9d9;
  background: #5a1a22;
  border: 1px solid #8e202b;
  border-radius: 8px;
  font-size: 0.9rem;
}

.auth-error[hidden] {
  display: none;
}

.auth-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 6px;
}

.demo-hint {
  margin-top: 22px;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--panel-light);
  border-radius: 8px;
  font-size: 0.88rem;
}

.demo-hint summary {
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.demo-hint code {
  padding: 2px 6px;
  color: #ffd54a;
  background: #111;
  border-radius: 4px;
}

.demo-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.demo-accounts button {
  padding: 6px 10px;
  color: white;
  background: #2c2c36;
  border-radius: 6px;
  font-size: 0.82rem;
}

.demo-accounts button:hover {
  background: var(--pink);
}

.danger-zone {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid #2a2a33;
}

/* narrow screens: keep logo, user badge and menu button on one row */
@media (max-width: 700px) {
  .user-chip {
    padding-right: 10px;
  }

  .user-chip .tag {
    display: none;
  }

  .chip-name {
    max-width: 84px;
  }
}