/* ─── reManhwa Shared Styles ─── */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,300&family=Space+Mono:wght@400;700&display=swap');

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

:root {
  --bg: #080b0f;
  --bg2: #0e1318;
  --bg3: #141b22;
  --bg4: #1c2530;
  --accent: #e8412a;
  --accent2: #ff6b4a;
  --gold: #f5c842;
  --text: #e8e4dc;
  --text2: #8a9aad;
  --text3: #4d6075;
  --border: #1e2d3d;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: 'Bebas Neue', cursive;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --nav-h: 60px;
  --bottom-h: 68px;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: var(--bottom-h);
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 99px; }

/* ─── TOP NAV ─── */
#topNav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(8,11,15,0.96);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-top {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  gap: 12px;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 24px; letter-spacing: 2px;
  color: var(--text); cursor: pointer; flex-shrink: 0;
  text-decoration: none; line-height: 1;
}
.nav-logo span { color: var(--accent); }

/* ─── SEARCH BAR ─── */
.search-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
}
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  height: 38px;
  transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--accent); }
.search-icon {
  color: var(--text3);
  font-size: 13px;
  flex-shrink: 0;
  margin-right: 8px;
}
.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  min-width: 0;
}
.search-input::placeholder { color: var(--text3); }

/* ─── AUTOCOMPLETE ─── */
.autocomplete-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 200;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
  display: none;
}
.autocomplete-dropdown.show { display: block; }
.suggest-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; cursor: pointer;
  transition: background var(--transition);
  color: var(--text);
}
.suggest-item:hover, .suggest-item.active { background: var(--bg4); }
.suggest-thumb {
  width: 36px; height: 52px; border-radius: 5px;
  object-fit: cover; background: var(--bg4); flex-shrink: 0;
}
.suggest-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-source { font-size: 10px; color: var(--accent); font-family: var(--font-mono); margin-top: 2px; }

/* ─── BOTTOM NAV ─── */
#bottomNav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--bottom-h);
  background: rgba(8,11,15,0.97);
  backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
}
.nav-bottom {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  padding: 0 4px 8px;
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer; padding: 6px 12px;
  border-radius: 12px; transition: all var(--transition);
  border: none; background: none; color: var(--text3);
  font-family: var(--font-body); font-size: 10px; font-weight: 500;
  text-decoration: none; flex: 1; max-width: 72px;
  white-space: nowrap;
}
.nav-btn i { font-size: 18px; line-height: 1; }
.nav-btn span { line-height: 1; }
.nav-btn.active { color: var(--accent); }
.nav-btn.active i { filter: drop-shadow(0 0 6px var(--accent)); }

/* ─── LAYOUT ─── */
.page-content { padding-top: calc(var(--nav-h) + 20px); padding-bottom: 24px; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ─── SECTION TITLE ─── */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title {
  font-family: var(--font-display);
  font-size: 22px; letter-spacing: 1.5px; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.section-title::before { content: ''; width: 4px; height: 22px; background: var(--accent); border-radius: 2px; display: block; }
.see-all { font-size: 12px; color: var(--accent); cursor: pointer; font-weight: 500; font-family: var(--font-mono); text-decoration: none; }

/* ─── MANGA CARD ─── */
.manga-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 14px; }
.manga-card {
  cursor: pointer; border-radius: 10px; overflow: hidden;
  background: var(--bg2); text-decoration: none; color: var(--text);
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeIn 0.4s ease both; display: block;
}
.manga-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.6); }
.card-cover-wrap { position: relative; aspect-ratio: 2/3; overflow: hidden; }
.card-cover {
  width: 100%; height: 100%; object-fit: cover;
  transition: filter var(--transition), transform var(--transition);
  background: var(--bg3); pointer-events: none; user-select: none; -webkit-user-drag: none;
}
.manga-card:hover .card-cover { transform: scale(1.04); filter: brightness(0.8); }
.card-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700; padding: 3px 7px;
  border-radius: 4px; letter-spacing: 0.8px; text-transform: uppercase;
  font-family: var(--font-mono); pointer-events: none;
}
.card-overlay { position: absolute; bottom: 0; left: 0; right: 0; height: 60%; background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 100%); pointer-events: none; }
.card-info { padding: 10px 10px 12px; }
.card-title { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px; }
.card-sub { font-size: 11px; color: var(--text3); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── SKELETON ─── */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.skeleton-card { border-radius: 10px; overflow: hidden; background: var(--bg2); }
.skeleton-cover { aspect-ratio: 2/3; background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton-info { padding: 10px; }
.skeleton-line { height: 12px; border-radius: 4px; margin-bottom: 6px; background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton-text { height: 14px; border-radius: 4px; margin-bottom: 8px; background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }

/* ─── TOAST ─── */
.toast {
  position: fixed; bottom: calc(var(--bottom-h) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  font-size: 13px; padding: 10px 18px; border-radius: 10px; z-index: 500;
  animation: toastIn 0.3s ease both, toastOut 0.3s ease 2.7s both;
  pointer-events: none; white-space: nowrap; backdrop-filter: blur(10px);
}
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(12px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; } }

/* ─── SCROLL ROW ─── */
.scroll-row { overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.scroll-row::-webkit-scrollbar { display: none; }
.scroll-row-inner { display: flex; gap: 14px; }
.scroll-row-inner .manga-card { flex: 0 0 140px; }

/* ─── EMPTY STATE ─── */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-state i { font-size: 56px; color: var(--text3); margin-bottom: 16px; display: block; opacity: 0.4; }
.empty-state h3 { font-size: 18px; color: var(--text2); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--text3); }

/* ─── BUTTONS ─── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px;
  background: var(--accent); color: #fff;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  border: none; cursor: pointer; transition: all var(--transition);
  text-decoration: none;
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px;
  background: var(--bg3); color: var(--text2);
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); cursor: pointer; transition: all var(--transition);
  text-decoration: none;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-secondary.active { color: var(--gold); border-color: var(--gold); }

/* ─── RESPONSIVE ─── */
@media (min-width: 640px) {
  .manga-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (min-width: 1024px) {
  #bottomNav { display: none; }
  .nav-top { padding: 0 40px; }
  .manga-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ─── SOURCE BADGES ─── */
.badge-mangadex   { background: #e8412a !important; }
.badge-komiku     { background: #2d7a2d !important; }
.badge-kiryuu     { background: #1a6fa3 !important; }
.badge-westmanga  { background: #6a3da8 !important; }
.badge-manhwaland { background: #a8793d !important; }
.badge-sekaitoon  { background: #3d8ca8 !important; }
.badge-manhwatop  { background: #a83d5e !important; }
