/* ============ RESET & BASE ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #6d4aff;
  --primary-dark: #4a33cc;
  --primary-darker: #5a3ddb;
  --text: #333333;
  --text-light: #555555;
  --text-muted: #888888;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --border: #eeeeee;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --danger: #e5484d;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ============ HEADER & NAV ============ */
.header-wrapper {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 26px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  text-align: center;
}

.header h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.header h1 a { color: #fff; text-decoration: none; }
.header p.description { font-size: 14px; opacity: 0.85; margin-top: 6px; }

.nav-menu {
  background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.nav-menu ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.nav-menu li a {
  display: block;
  padding: 14px 16px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}

.nav-menu li a:hover,
.nav-menu li a.active {
  background: rgba(109,74,255,0.08);
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
  text-decoration: none;
}

.nav-search {
  display: flex;
  gap: 0;
  flex: 0 1 260px;
}
.nav-search input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 4px 0 0 4px;
  font-size: 13px;
}
.nav-search button {
  flex: 0 0 auto;
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}
.nav-search button:hover { background: var(--primary-darker); }

/* ============ LAYOUT ============ */
.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
}

.section-heading {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin: 25px 0 15px 2px;
  padding-left: 12px;
  border-left: 4px solid var(--primary);
}

/* ============ KOMIK GRID (beranda) ============ */
.comic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
}

.comic-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
}
.comic-card:hover { transform: translateY(-3px); }

.comic-card .cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  position: relative;
}
.comic-card .cover img { width: 100%; height: 100%; object-fit: cover; }

.comic-card .status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.comic-card .info { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.comic-card .title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.comic-card .title:hover { color: var(--primary); text-decoration: none; }
.comic-card .latest-chapter { font-size: 12px; color: var(--text-muted); }
.comic-card .latest-chapter a { color: var(--primary); font-weight: 600; }

/* ============ FEATURED ============ */
.featured-post {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.featured-post .featured-img {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
}
.featured-post .featured-overlay {
  position: relative;
  z-index: 1;
  padding: 25px;
  color: #fff;
  width: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0) 100%);
}
.featured-post .featured-tag {
  display: inline-block;
  background: #fff;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.featured-post .featured-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.featured-post .featured-title a { color: #fff; }
.featured-post .featured-meta { font-size: 13px; opacity: 0.9; display: flex; gap: 15px; flex-wrap: wrap; }

/* ============ HALAMAN DETAIL KOMIK ============ */
.comic-detail {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 25px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 25px;
  margin-bottom: 25px;
}
.comic-detail .cover-wrap {
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 2/3;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.comic-detail .cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
.comic-detail h1 { font-size: 24px; margin-bottom: 10px; }
.comic-detail .meta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
  display: inline-block;
  background: var(--bg);
  color: var(--text-light);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}
.tag.status { background: var(--primary); color: #fff; }
.comic-detail .synopsis { color: var(--text-light); line-height: 1.7; font-size: 14.5px; }

.chapter-list {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chapter-list .chapter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.chapter-list .chapter-row:last-child { border-bottom: none; }
.chapter-list .chapter-row:hover { background: var(--bg); }
.chapter-list .chapter-title { font-weight: 600; font-size: 14.5px; }
.chapter-list .chapter-date { font-size: 12px; color: var(--text-muted); }

/* ============ HALAMAN BACA CHAPTER ============ */
.reader-bar {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}
.reader-bar .comic-name { font-weight: 700; font-size: 15px; }
.reader-bar .chapter-nav { display: flex; gap: 8px; }
.reader-bar .chapter-nav a,
.reader-bar .chapter-nav select {
  padding: 8px 14px;
  background: var(--bg);
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  border: 1px solid var(--border);
}
.reader-bar .chapter-nav a:hover { background: var(--primary); color: #fff; text-decoration: none; }
.reader-bar .chapter-nav a.disabled { opacity: 0.4; pointer-events: none; }

.reader-images { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.reader-images img { max-width: 100%; width: 100%; display: block; }

.no-data { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ============ FOOTER ============ */
.footer-wrapper { background: #2c2c2c; color: #ccc; margin-top: 40px; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 25px 20px; text-align: center; }
.footer-inner p { font-size: 13px; color: #999; }

/* ============ ADMIN ============ */
.admin-body { background: var(--bg); min-height: 100vh; }

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-topbar .brand { font-weight: 700; font-size: 16px; }
.admin-topbar .brand span { color: var(--primary); }
.admin-topbar button {
  background: none;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-light);
}
.admin-topbar button:hover { background: var(--bg); }

.admin-container { max-width: 1100px; margin: 25px auto; padding: 0 20px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  padding: 40px;
  width: 100%;
  max-width: 360px;
}
.login-card h1 { font-size: 20px; margin-bottom: 6px; text-align: center; }
.login-card p.sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 25px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--primary-darker); }
.btn.btn-block { width: 100%; }
.btn.btn-danger { background: var(--danger); }
.btn.btn-danger:hover { background: #c73438; }
.btn.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.btn-secondary:hover { background: var(--bg); }

.alert {
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert.error { background: #fde8e8; color: #a11; }
.alert.success { background: #e6f7ec; color: #1a7a3d; }

.admin-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.admin-card h2 { font-size: 16px; margin-bottom: 16px; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.admin-table th { color: var(--text-muted); font-weight: 600; }
.admin-table .row-actions { display: flex; gap: 6px; }
.admin-table .row-actions a,
.admin-table .row-actions button {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  color: var(--text);
}
.admin-table .row-actions a:hover,
.admin-table .row-actions button:hover { background: var(--bg); text-decoration: none; }
.admin-table .row-actions .danger { color: var(--danger); border-color: #f5c6c6; }

.image-url-list { display: flex; flex-direction: column; gap: 8px; }
.image-url-list .url-row { display: flex; gap: 8px; }
.image-url-list .url-row input { flex: 1; }
.image-url-list .url-row button {
  flex: 0 0 auto;
  background: #fde8e8;
  color: #a11;
  border: none;
  border-radius: 4px;
  padding: 0 12px;
  cursor: pointer;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============ SLOT IKLAN ============ */
.ad-slot {
  margin: 20px 0;
  text-align: center;
  overflow: hidden;
}
.ad-slot:empty { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .comic-detail { grid-template-columns: 1fr; }
  .comic-detail .cover-wrap { max-width: 180px; margin: 0 auto; }
  .nav-inner { flex-direction: column; gap: 10px; padding: 12px 15px; }
  .nav-search { flex: 1 1 auto; width: 100%; }
  .two-col { grid-template-columns: 1fr; }
  .comic-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
