/* =========================================
   AnimeEXT — Core Design System
   ========================================= */

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

/* ── CSS Variables ── */
:root {
  --bg-0: #080c10;
  --bg-1: #0d1117;
  --bg-2: #161b22;
  --bg-3: #21262d;
  --bg-4: #30363d;

  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #484f58;

  --accent: #00d9c0;
  --accent-dim: rgba(0, 217, 192, 0.12);
  --accent-glow: 0 0 20px rgba(0, 217, 192, 0.35);
  --accent-hover: #00f0d4;

  --blue: #58a6ff;
  --gold: #ffd700;
  --danger: #f85149;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.6);
  --shadow-heavy: 0 8px 40px rgba(0, 0, 0, 0.8);

  --topbar-h: 64px;
  --font-body: 'Outfit', sans-serif;
  --font-jp: 'Noto Serif JP', serif;

  --transition: 0.22s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-0);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-1);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-4);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: rgba(8, 12, 16, 0.85);
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
  z-index: 1050;
}

/* ── Logo ── */
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-svg {
  height: 48px;
  width: auto;
}

.logo-svg .main-text {
  fill: var(--text-primary);
  font-family: var(--font-body);
}

.logo-svg .ext-text {
  fill: var(--accent);
}

.logo-svg .subtext {
  fill: var(--text-muted);
  font-family: var(--font-jp);
}

.logo-svg text {
  transition: fill var(--transition);
}

/* ── Nav ── */
.main-nav {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.nav-item {
  position: relative;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-3);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Search ── */
.search-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

#searchInput {
  background: var(--bg-2);
  color: var(--text-primary);
  border: 1px solid var(--bg-4);
  border-radius: 999px;
  padding: 7px 16px 7px 38px;
  font-size: 0.875rem;
  font-family: var(--font-body);
  width: 220px;
  transition: border-color var(--transition), box-shadow var(--transition), width var(--transition);
  outline: none;
}

#searchInput:focus {
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
  width: 280px;
}

#searchInput::placeholder {
  color: var(--text-muted);
}

.search-icon-wrap {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

.btn-search,
#search-toggle-btn {
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  color: var(--text-secondary);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all var(--transition);
}

.btn-search:hover,
#search-toggle-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-0);
}

/* Mobile active search */
.search-form.mobile-search-active {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  z-index: 1100;
}

.search-form.mobile-search-active input {
  display: block !important;
  flex-grow: 1;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  border-bottom: 2px solid var(--accent);
  outline: none;
  animation: slideInSearch 0.3s forwards;
}

#search-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.search-form.mobile-search-active #search-toggle-btn {
  display: none;
}

.search-form.mobile-search-active #search-close-btn {
  display: inline-flex;
  align-items: center;
}

@keyframes slideInSearch {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Suggestions ── */
.suggestions-list {
  list-style: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(22, 27, 34, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  z-index: 1200;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: slideDownFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top center;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }

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

.suggestions-list li {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  border: 1px solid transparent;
}

.suggestions-list li:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
}

.suggestions-list li .suggestion-thumb-wrapper {
  width: 40px;
  height: 54px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-3);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.suggestions-list li img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.suggestions-list li .suggestion-info {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.suggestions-list li .suggestion-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestions-list li .suggestion-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.suggestions-list li .suggestion-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.suggestions-list li .suggestion-badge.anime {
  background: rgba(0, 133, 255, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(0, 133, 255, 0.25);
}

.suggestions-list li .suggestion-badge.manga {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.suggestions-list li .suggestion-arrow {
  color: var(--text-muted);
  font-size: 0.85rem;
  opacity: 0;
  transition: all var(--transition);
}

.suggestions-list li:hover .suggestion-arrow {
  opacity: 1;
  color: var(--accent);
  transform: translateX(2px);
}

/* ── Hamburger button ── */
#hamburgerBtn {
  display: none;
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}

#hamburgerBtn:hover {
  color: var(--text-primary);
  background: var(--bg-4);
}

@media (max-width: 650px) {
  #hamburgerBtn {
    display: flex;
  }

  nav.main-nav {
    display: none !important;
  }
}

/* ── Mobile dropdown ── */
#mobileDropdownMenu {
  position: absolute;
  top: calc(var(--topbar-h) + 8px);
  right: 16px;
  background: var(--bg-2);
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-heavy);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  min-width: 180px;
  z-index: 1060;
}

#mobileDropdownMenu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

#mobileDropdownMenu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

#mobileDropdownMenu a:hover {
  background: var(--bg-3);
  color: var(--text-primary);
}

#mobileDropdownMenu a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Download badge ── */
#downloadBadge {
  position: absolute;
  top: 75px;
  left: 20px;
  background: var(--accent);
  color: var(--bg-0) !important;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(0, 217, 192, 0.4);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}

#downloadBadge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 217, 192, 0.55);
  color: var(--bg-0) !important;
}

/* ── Layout container ── */
.layout-container {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: calc(var(--topbar-h) + 24px) 24px 80px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-1);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow-y: auto;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 0 8px;
}

.sidebar-menu {
  list-style: none;
}

.sidebar-menu .anime-link {
  display: block;
  padding: 7px 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-menu .anime-link:hover {
  background: var(--bg-3);
  color: var(--text-primary);
}

/* ── Main content ── */
.main-content {
  flex: 1;
  min-width: 0;
}

/* ── Section title ── */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap !important;
}

.section-header .section-title {
  margin-bottom: 0;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 1.25rem;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.directory-tabs {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

.directory-tabs button {
  min-width: auto;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  white-space: nowrap;
}

.directory-tabs .btn-outline-light {
  border: 1px solid var(--bg-4);
  background: var(--bg-3);
  color: var(--text-secondary);
}

.directory-tabs .btn-outline-light:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.directory-tabs .btn-outline-light.active {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  background: var(--accent-dim) !important;
}

/* ── Anime grid ── */
.anime-card *:not(.btn-hentai-toggle) {
  pointer-events: none;
}

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

/* ── Anime card ── */
.anime-card {
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
    box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
    border-color 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  display: block;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.anime-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--accent);
  border-color: var(--accent);
}

.anime-card img.anime-image {
  pointer-events: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 280px;
  object-fit: cover;
  display: block;
  transition: filter 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
    transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  color: transparent;
}

.anime-card:hover img.anime-image {
  filter: brightness(0.85);
  transform: scale(1.06);
}

.card-type-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  border-radius: var(--radius-sm);
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* Azul */
.badge-anime {
  background: rgba(0, 85, 217, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Naranja */
.badge-manga {
  background: rgba(255, 87, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Rojo */
.badge-hentai {
  background: rgba(220, 38, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Morado */
.badge-drama {
  background: rgba(124, 58, 237, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* ============================================================
 * DIFUMINADO HENTAI RIGIDO (Sin respuesta al hover)
 * ============================================================ */

/* Desactiva cualquier efecto hover nativo que tengan las tarjetas en imágenes hentai */
.is-hentai:hover .anime-image,
.is-hentai:hover .card-img {
  /* Forzamos a que no haga zoom ni cambie filtros al pasar el mouse */
  transform: none !important;
}

/* Estado DIFUMINADO: Se aplica SIEMPRE que tenga .blurred, aunque pase el ratón */
.is-hentai.blurred .anime-image,
.is-hentai.blurred .card-img,
.is-hentai.blurred:hover .anime-image,
.is-hentai.blurred:hover .card-img {
  filter: blur(18px) !important;
  transform: scale(1.08) !important;
  /* Mantiene el tamaño para evitar bordes blancos */
}

/* Estado CLARO: Se aplica cuando NO tiene .blurred (después de presionar el ojo) */
.is-hentai:not(.blurred) .anime-image,
.is-hentai:not(.blurred) .card-img,
.is-hentai:not(.blurred):hover .anime-image,
.is-hentai:not(.blurred):hover .card-img {
  filter: none !important;
}

/* Aseguramos que el botón reciba eventos de forma explícita */
.btn-hentai-toggle {
  pointer-events: all !important;
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  outline: none;
}

.btn-hentai-toggle i {
  font-size: 15px;
  pointer-events: none;
}

.anime-title {
  position: absolute;
  pointer-events: none;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 12px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, transparent 100%);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.anime-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.anime-card.show-options .anime-overlay {
  opacity: 1;
  pointer-events: auto;
}

.anime-card.show-options img.anime-image {
  filter: blur(4px) brightness(0.4);
}

.anime-overlay button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  backdrop-filter: blur(6px);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}

.anime-overlay button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-0);
  transform: scale(1.04);
}

@keyframes removeCard {
  to {
    opacity: 0;
    transform: scale(0.85) translateY(16px);
  }
}

.anime-card.removing {
  animation: removeCard 0.35s ease forwards;
}

/* ── Pagination ── */
#pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 28px 0;
}

.pagination-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--bg-4);
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.pagination-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-0);
}

.pagination-btn.nav {
  border-color: var(--bg-4);
  color: var(--text-muted);
}

.pagination-btn.nav:hover {
  background: var(--bg-3);
  color: var(--text-primary);
}

/* ── Bottom bar ── */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 56px;
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.bottom-bar.visible {
  transform: translateY(0);
}

/* Hide mobile-only nav elements in bottom bar on desktop */
.bottom-bar #mobileNavInicio,
.bottom-bar #mobileNavDirectorio,
.bottom-bar #mobileNavHistorial,
.bottom-bar #mobileNavFavoritos,
.bottom-bar #mobileNavSubs {
  display: none;
}

/* Hide tab labels on desktop */
.bottom-bar .bottom-tab-item span {
  display: none;
}

.bottom-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), transform var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bottom-btn:hover {
  color: var(--accent);
  transform: scale(1.15);
}

/* Mobile responsive styles for fixed bottom bar */
@media (max-width: 650px) {
  .bottom-bar {
    transform: translateY(0) !important;
    /* Always visible on mobile */
    height: 64px;
    background: rgba(8, 12, 16, 0.85);
    /* Ultra-sleek premium dark translucent background */
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4);
    padding: 0 8px;
  }

  /* Show mobile-only nav elements on mobile screen */
  .bottom-bar #mobileNavInicio,
  .bottom-bar #mobileNavDirectorio,
  .bottom-bar #mobileNavHistorial,
  .bottom-bar #mobileNavFavoritos,
  .bottom-bar #mobileNavSubs {
    display: flex;
  }

  /* Style bottom tab items as premium native-like app tabs */
  .bottom-bar .bottom-tab-item {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    gap: 3px;
    transition: color 0.25s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: none;
    border: none;
    padding: 4px 0;
    min-width: 0;
  }

  .bottom-bar .bottom-tab-item i {
    font-size: 1.25rem;
    transition: transform 0.25s ease;
  }

  .bottom-bar .bottom-tab-item span {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0.01em;
  }

  /* Hover & Active states */
  .bottom-bar .bottom-tab-item:hover {
    color: var(--text-primary);
  }

  .bottom-bar .bottom-tab-item.active {
    color: var(--accent);
  }

  .bottom-bar .bottom-tab-item.active i {
    transform: scale(1.12);
  }

  /* Hide the theme icon button on mobile (accessible via Ajustes menuOverlay) */
  .bottom-bar #bottomThemeIcon {
    display: none !important;
  }
}

/* ── Offline overlay ── */
#offlineOverlay {
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  text-align: center;
  padding: 2rem;
  gap: 16px;
}

#offlineOverlay h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

#offlineOverlay p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

#offlineOverlay.hidden {
  display: none;
}

/* ── Overlays / Modals policy ── */
.policy-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(12px);
}

.policy-modal {
  width: 92vw;
  max-width: 820px;
  height: 88vh;
  background: var(--bg-1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-heavy);
}

.policy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.policy-iframe {
  flex: 1;
  border: none;
  width: 100%;
}

.policy-footer {
  padding: 14px 20px;
  background: var(--bg-2);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* ── Policy warning banner ── */
.policy-warning-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(255, 193, 7, 0.1);
  border-bottom: 1px solid rgba(255, 193, 7, 0.2);
  color: #ffc107;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
}

.policy-warning-banner i {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ── Policy buttons ── */
.policy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.25s ease;
}

.policy-btn--accept {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 217, 192, 0.3);
}

.policy-btn--accept:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 24px rgba(0, 217, 192, 0.45);
  transform: translateY(-1px);
}

.policy-btn--decline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--bg-4);
}

.policy-btn--decline:hover {
  background: rgba(248, 81, 73, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Policy shake animation ── */
@keyframes policyShake {

  0%,
  100% {
    transform: translateX(0);
  }

  10%,
  50%,
  90% {
    transform: translateX(-6px);
  }

  30%,
  70% {
    transform: translateX(6px);
  }
}

.policy-shake {
  animation: policyShake 0.5s ease;
}

/* Ads overlay */
#adsOverlay.policy-overlay {
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
}

#adsOverlay .policy-modal {
  max-width: 460px;
  height: auto;
  padding: 2rem;
  text-align: center;
  border-radius: var(--radius-xl);
}

/* ── Menu overlay ── */
#menuOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(12px);
}

#menuOverlay.show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

#menuOverlay .policy-modal {
  max-width: 420px;
  width: 92vw;
  height: auto;
  border-radius: var(--radius-xl);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 16px;
  padding: 20px;
  justify-items: center;
}

.menu-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--accent);
  font-size: 1.4rem;
  border: 1px solid var(--bg-4);
  cursor: pointer;
  transition: all var(--transition);
}

.menu-circle:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  transform: scale(1.06);
}

.menu-text {
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  text-align: center;
}

/* ── Continue watching modal ── */
#continueWatchingModal {
  backdrop-filter: blur(8px);
}

.modal-title-S {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

ol,
ul {
  padding-left: 5.5px !important;
}

/* ── Fix búsqueda móvil ── */
.search-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-form.mobile-search-active {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-1);
  border-bottom: 1px solid var(--bg-4);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1200;
  transform: none;
}

.search-form.mobile-search-active input {
  display: block !important;
  flex: 1;
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-body);
  outline: none;
  animation: none;
}

.search-form.mobile-search-active input:focus {
  border-color: var(--accent);
}

.search-form.mobile-search-active input::placeholder {
  color: var(--text-muted);
}

.search-form.mobile-search-active #search-toggle-btn {
  display: none;
}

.search-form.mobile-search-active #search-close-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: 1px solid var(--bg-4);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 0.9rem;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition);
}

.search-form.mobile-search-active #search-close-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-0);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .layout-container {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 576px) {
  .layout-container {
    gap: 0;
  }

  .anime-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .anime-card img.anime-image {
    height: 230px;
  }

  .topbar {
    padding: 0 12px;
    gap: 12px;
  }

  #downloadBadge {
    font-size: 0.75rem;
    padding: 7px 12px;
  }
}

@media (max-width: 400px) {
  .anime-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

#directory-section {
  touch-action: pan-y;
  /* permite scroll vertical pero no bloquea swipe horizontal */
}

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 92vw;
}

.toast-item {
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-body);
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: none;
  max-width: 420px;
  height: 42px;
}

.toast-item.toast-show {
  animation: toastIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.toast-item.toast-hide {
  animation: toastOut 0.25s ease forwards;
}

/* Type accent borders */
.toast-info {
  border-left: 3px solid var(--blue);
}

.toast-success {
  border-left: 3px solid var(--accent);
}

.toast-warning {
  border-left: 3px solid #ffc107;
}

.toast-error {
  border-left: 3px solid var(--danger);
}

/* Icons per type */
.toast-info .toast-icon {
  color: var(--blue);
}

.toast-success .toast-icon {
  color: var(--accent);
}

.toast-warning .toast-icon {
  color: #ffc107;
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 4px;
  cursor: pointer;
  transition: color var(--transition);
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--text-primary);
}

/* Estilos base de la barra de progreso */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2.3px;
  background-color: rgba(255, 255, 255, 0.4);
  /* Un color semi-transparente que se adapta bien */
  transform-origin: left;
  animation: toastProgressLinear var(--duration) linear forwards;
}

/* Animación que reduce la barra de 100% a 0% */
@keyframes toastProgressLinear {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

/* Opcional: Si quieres colores específicos para la barra según el tipo de Toast */
.toast-error .toast-progress {
  background-color: rgba(255, 255, 255, 0.6);
}

.toast-success .toast-progress {
  background-color: rgba(255, 255, 255, 0.6);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }

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

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }
}

@media (max-width: 650px) {
  .toast-container {
    bottom: 72px;
    left: 8px;
    right: 8px;
    transform: none;
    width: auto;
    max-width: none;
  }

  .toast-item {
    height: 42px;
  }
}

/* ── Skeleton Loaders ── */
.skeleton-card {
  height: 280px;
  background: var(--bg-3);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}

.skeleton-card::after,
.skeleton-card-init::after,
.skeleton-banner::after,
.img-loading-skeleton::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.08),
      transparent);
  animation: skeletonSweep 1.5s infinite;
  z-index: 10;
  pointer-events: none;
}

.img-loading-skeleton {
  position: relative !important;
  overflow: hidden !important;
  background-color: var(--bg-3, #161b22) !important;
}

.skeleton-banner .banner-background,
.skeleton-banner .banner-blur {
  background: var(--bg-3) !important;
}

.skeleton-banner .banner-title {
  color: transparent !important;
  background: var(--bg-4);
  border-radius: 8px;
  height: 48px;
  width: 50%;
}

.skeleton-banner .banner-description {
  color: transparent !important;
  background: var(--bg-4);
  border-radius: 6px;
  height: 80px;
  width: 70%;
}

.skeleton-banner .banner-meta,
.skeleton-banner .banner-tags,
.skeleton-banner .banner-actions {
  opacity: 0;
}

@keyframes skeletonSweep {
  100% {
    left: 200%;
  }
}

.skeleton-card-init .skeleton-text-title {
  width: 70%;
  height: 14px;
  background: var(--bg-4);
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-card-init .skeleton-text-sub {
  width: 40%;
  height: 12px;
  background: var(--bg-4);
  border-radius: 4px;
}