/* ═══════════════════════════════════════════════
   PIKSELMANGA - Pixel Art Modern Dark Mode Theme
   ═══════════════════════════════════════════════ */

:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #12121f;
  --bg-card: #1a1a2e;
  --bg-hover: #222240;
  --border: #2a2a45;
  --accent: #00ff9f;
  --accent-dim: #00cc7f;
  --accent-glow: rgba(0, 255, 159, 0.3);
  --secondary: #ff2e63;
  --secondary-dim: #cc2550;
  --warning: #ffb700;
  --text-primary: #e8e8f0;
  --text-secondary: #9090a8;
  --text-muted: #5a5a78;
  --shadow: rgba(0, 0, 0, 0.5);
  --radius: 4px;
  --font-pixel: 'Press Start 2P', monospace;
  --font-mono: 'VT323', monospace;
  --font-body: 'Inter', sans-serif;
  --spacing: 8px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(0, 255, 159, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(255, 46, 99, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
}

/* ── Pixel texture overlay ── */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(0,255,159,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,159,0.015) 1px, transparent 1px);
  background-size: 4px 4px;
  pointer-events: none;
  z-index: 0;
}

/* ═══ Header ═══ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 20px var(--shadow);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.logo-icon {
  font-family: var(--font-pixel);
  font-size: 14px;
  background: var(--accent);
  color: var(--bg-primary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  box-shadow: 0 0 12px var(--accent-glow);
}

.logo-text {
  font-family: var(--font-pixel);
  font-size: 13px;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.logo-accent { color: var(--accent); }

.main-nav {
  display: flex;
  gap: 20px;
  margin-left: 16px;
}

.main-nav a {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: all 0.2s;
  text-transform: uppercase;
}

.main-nav a:hover, .main-nav a.active {
  color: var(--accent);
  background: var(--bg-card);
  box-shadow: inset 0 0 0 2px var(--accent-dim);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.search-bar input {
  background: var(--bg-secondary);
  border: none;
  outline: none;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  width: 200px;
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar button {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 8px 14px;
  font-family: var(--font-pixel);
  font-size: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.search-bar button:hover { background: var(--accent-dim); }

.menu-toggle {
  display: none;
  background: none;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 4px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--accent);
}

/* ═══ Main Content ═══ */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* ═══ Hero ═══ */
.hero-section {
  text-align: center;
  padding: 60px 20px;
  margin-bottom: 32px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(0,255,159,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,159,0.03) 1px, transparent 1px);
  background-size: 8px 8px;
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; }

.hero-title {
  font-family: var(--font-pixel);
  font-size: 28px;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow), 3px 3px 0 var(--bg-primary);
  margin-bottom: 16px;
  line-height: 1.4;
}

.hero-sub {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 24px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ═══ Buttons ═══ */
.btn {
  display: inline-block;
  padding: 10px 24px;
  font-family: var(--font-pixel);
  font-size: 10px;
  text-decoration: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  text-transform: uppercase;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-dim);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--bg-primary), 0 0 16px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent-dim);
}

.btn-outline:hover {
  background: var(--bg-card);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ═══ Sections ═══ */
.section { margin-bottom: 40px; }

.section-title {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 1px;
}

.section-bar {
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ═══ Manga Grid & Cards ═══ */
.manga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.manga-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  display: block;
}

.manga-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px var(--shadow), 0 0 12px var(--accent-glow);
}

.card-img-wrap {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--bg-secondary);
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s, filter 0.3s;
}

.manga-card:hover .card-img-wrap img {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--secondary);
  color: var(--text-primary);
  font-family: var(--font-pixel);
  font-size: 7px;
  padding: 4px 6px;
  border-radius: var(--radius);
  text-transform: uppercase;
}

.card-info {
  padding: 10px 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.card-chapter {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--accent);
}

/* ═══ Pagination ═══ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.page-current {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--text-secondary);
}

/* ═══ Genre Tags ═══ */
.genre-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.genre-tag {
  font-family: var(--font-pixel);
  font-size: 10px;
  padding: 10px 18px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  text-transform: uppercase;
}

.genre-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-hover);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--bg-primary);
}

.genre-tag-sm {
  font-size: 12px;
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
}

.genre-tag-sm:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ═══ Detail Page ═══ */
.detail-section {
  padding: 20px 0;
}

.detail-header {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.detail-cover {
  flex-shrink: 0;
  width: 220px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 20px var(--shadow);
}

.detail-cover img {
  width: 100%;
  height: auto;
  display: block;
}

.detail-info {
  flex: 1;
  min-width: 250px;
}

.detail-title {
  font-family: var(--font-pixel);
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 8px;
  line-height: 1.4;
  text-shadow: 2px 2px 0 var(--bg-primary);
}

.detail-alt {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.detail-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.meta-badge {
  font-family: var(--font-pixel);
  font-size: 8px;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
}

.detail-genres {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.detail-synopsis h3 {
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.detail-synopsis p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ═══ Chapter List ═══ */
.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 8px;
}

.chapter-list::-webkit-scrollbar { width: 6px; }
.chapter-list::-webkit-scrollbar-track { background: var(--bg-secondary); }
.chapter-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.chapter-list::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

.chapter-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.15s;
}

.chapter-item:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateX(4px);
}

.ch-title {
  font-size: 14px;
  font-weight: 600;
}

.ch-date {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-muted);
}

/* ═══ Empty State ═══ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-family: var(--font-pixel);
  font-size: 24px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state p {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-hint {
  color: var(--text-muted) !important;
  font-size: 16px !important;
  margin-bottom: 20px !important;
}

/* ═══ Error Page ═══ */
.error-page {
  text-align: center;
  padding: 80px 20px;
}

.error-code {
  font-family: var(--font-pixel);
  font-size: 32px;
  color: var(--secondary);
  margin-bottom: 16px;
  text-shadow: 3px 3px 0 var(--bg-primary);
}

.error-msg {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ═══ Footer ═══ */
.site-footer {
  background: var(--bg-secondary);
  border-top: 2px solid var(--border);
  margin-top: 60px;
  padding: 32px 20px;
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
  gap: 24px;
  align-items: start;
}

.footer-brand p {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--accent); }

.footer-copy {
  text-align: right;
}

.footer-copy p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .footer-links { align-items: center; }
  .footer-copy { text-align: center; }
}

@media (max-width: 768px) {
  .hero-title { font-size: 18px; }
  .hero-sub { font-size: 18px; }
  .section-title { font-size: 11px; }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    padding: 16px;
    gap: 8px;
    z-index: 200;
  }

  .main-nav.open { display: flex; }
  .menu-toggle { display: flex; }

  .search-bar { margin-left: 0; width: 100%; order: 3; }
  .search-bar input { width: 100%; flex: 1; }

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

  .detail-header { flex-direction: column; }
  .detail-cover { width: 160px; margin: 0 auto; }
  .detail-title { font-size: 16px; text-align: center; }
  .detail-alt { text-align: center; }
  .detail-meta { justify-content: center; }
  .detail-genres { justify-content: center; }
}

@media (max-width: 480px) {
  .manga-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .card-title { font-size: 12px; }
  .header-inner { padding: 10px 12px; }
  .logo-text { font-size: 10px; }
  .hero-title { font-size: 14px; }
  .hero-sub { font-size: 16px; }
}

/* ═══ API Doc ═══ */
.api-doc { max-width: 800px; }

.api-endpoint {
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.api-endpoint:hover { border-left-color: var(--secondary); }

.api-endpoint h3 {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 6px;
}

.api-endpoint p {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.api-endpoint code {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  padding: 4px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ═══ Animations ═══ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.manga-card {
  animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--accent);
  animation: pulse 1s infinite;
}
