*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: #4a5568;
  background-color: #e6f2fa;
  min-height: 100vh;
  padding-bottom: 2rem;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: #2d3748;
}

p, li, label, input, textarea, select, button {
  font-family: inherit;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

/* ──────────────────────────────────────────────────────── */
/* 2. HEADER — BIRU MUDA + FONT PUTIH (SEMUA HALAMAN) */
/* ──────────────────────────────────────────────────────── */

header {
  background: linear-gradient(120deg, #7ab9d9, #3a7ca5 70%);
  color: white;
  padding: 2rem 0;
  text-align: center;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 4px 16px rgba(58, 124, 165, 0.12);
  position: relative;
  margin-bottom: 2.5rem;
  overflow: hidden;
  z-index: 10;
}

header::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

header h1 {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  color: white;
}

header p {
  opacity: 0.92;
  font-size: 1.15rem;
  max-width: 700px;
  margin: 0 auto;
  color: white;
}

/* Logout Button */
.logout-btn {
  position: absolute;
  right: 20px;
  top: 20px;
  background: #e74c3c;
  color: white;
  padding: 0.65rem 1.2rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background: #c0392b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

/* ──────────────────────────────────────────────────────── */
/* 3. LAYOUT UTAMA */
/* ──────────────────────────────────────────────────────── */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  min-height: calc(100vh - 300px);
}

footer {
  text-align: center;
  padding: 2rem 0 0;
  color: #718096;
  font-size: 0.95rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(176, 212, 235, 0.3);
}

/* ──────────────────────────────────────────────────────── */
/* 4. KOMPONEN DASAR */
/* ──────────────────────────────────────────────────────── */

/* Card */
.card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  margin: 1.5rem auto;
  box-shadow: 0 4px 16px rgba(58, 124, 165, 0.12);
  max-width: 680px;
  border: 1px solid rgba(176, 212, 235, 0.4);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(58, 124, 165, 0.15);
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  background: #7ab9d9;
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.02rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(58, 124, 165, 0.08);
}

.btn:hover {
  background: #2b5f82;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(58, 124, 165, 0.12);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #f1f5f9;
  color: #4a5568;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: #3a7ca5;
}

.btn-danger {
  background: #e74c3c;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

/* Form */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.6rem;
  font-weight: 600;
  color: #2d3748;
  font-size: 1.05rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid #cbd5e0;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #7ab9d9;
  box-shadow: 0 0 0 3px rgba(122, 185, 217, 0.25);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* Alert */
.alert {
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: 12px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-success {
  background: #e6f7f2;
  color: #1a7a5e;
  border: 1px solid #a8e6c9;
}

.alert-error {
  background: #fef2f2;
  color: #a32b2b;
  border: 1px solid #f5c6c6;
}

/* ──────────────────────────────────────────────────────── */
/* 5. HALAMAN: HOMEPAGE */
/* ──────────────────────────────────────────────────────── */

.hero {
  background-color: #e6f2fa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem 1rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  color: #3a7ca5;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  font-weight: 700;
}

.logo-icon {
  font-size: 2.2rem;
}

.hero-subtitle {
  color: #718096;
  font-size: 1.1rem;
  max-width: 650px;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
}

.role-cards {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 900px;
  width: 100%;
}

.role-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 16px rgba(58, 124, 165, 0.12);
  width: 100%;
  max-width: 360px;
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.role-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(58, 124, 165, 0.15);
}

.role-icon {
  width: 64px;
  height: 64px;
  background: #7ab9d9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.signup-link {
  margin-top: 2rem;
  color: #7ab9d9;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.signup-link:hover {
  text-decoration: underline;
}

.signup-link strong {
  color: #3a7ca5;
}

/* ──────────────────────────────────────────────────────── */
/* 6. HALAMAN: LOGIN */
/* ──────────────────────────────────────────────────────── */

.login-container {
  max-width: 420px;
  margin: 2.5rem auto;
}

.login-card {
  text-align: center;
  padding: 2.2rem;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(58, 124, 165, 0.12);
  border: 1px solid rgba(176, 212, 235, 0.4);
}

.login-card.admin {
  border-color: rgba(58, 124, 165, 0.3);
  box-shadow: 0 6px 20px rgba(58, 124, 165, 0.18);
}

.login-title {
  font-size: 1.75rem;
  color: #3a7ca5;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.login-subtitle {
  color: #718096;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.login-subtitle.admin {
  font-style: italic;
  color: #2b5f82;
  opacity: 0.9;
}

.btn-submit {
  width: 100%;
  padding: 0.95rem;
  font-size: 1.1rem;
  margin-top: 1rem;
  border-radius: 12px;
  font-weight: 600;
}

.btn-submit.user {
  background: #7ab9d9;
}

.btn-submit.user:hover {
  background: #2b5f82;
}

.btn-submit.admin {
  background: #3a7ca5;
}

.btn-submit.admin:hover {
  background: #2b5f82;
}

.login-footer {
  margin-top: 1.8rem;
  font-size: 0.95rem;
  color: #718096;
}

.login-footer a {
  color: #7ab9d9;
}

/* ──────────────────────────────────────────────────────── */
/* 7. HALAMAN: DASHBOARD & NOVEL */
/* ──────────────────────────────────────────────────────── */

/* Admin Nav */
.admin-nav {
  text-align: center;
  margin-bottom: 1.75rem;
}

.admin-nav .btn {
  margin: 0 8px 12px;
}

/* Novel Grid */
.novel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.75rem;
  margin-top: 2rem;
}

.novel-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(58, 124, 165, 0.12);
  transition: all 0.3s ease;
  border: 1px solid rgba(176, 212, 235, 0.3);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.novel-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 24px rgba(58, 124, 165, 0.15);
  border-color: #7ab9d9;
}

.novel-cover {
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: linear-gradient(135deg, #e6f2fa, #d4ebf9);
  border-bottom: 1px solid rgba(176, 212, 235, 0.4);
}

.novel-info {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.novel-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  flex-grow: 1;
}

.novel-info .meta {
  font-size: 0.9rem;
  color: #718096;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.novel-info .meta::before {
  content: "📅";
}

/* Tombol Aksi */
.novel-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.novel-actions .btn {
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  flex: 1;
  min-width: 80px;
}

/* Placeholder Cover */
.novel-cover[src*="default-cover.jpg" i] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #3a7ca5;
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  padding: 1.2rem;
}

.novel-cover[src*="default-cover.jpg" i]::before {
  content: "📖";
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.novel-cover[src*="default-cover.jpg" i]::after {
  content: "Cover belum tersedia";
  font-size: 0.85rem;
  color: #718096;
  margin-top: 0.5rem;
}

/* Detail Novel */
.detail-content {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-top: 1.5rem;
}

.detail-cover {
  width: 200px;
  height: 280px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(58, 124, 165, 0.08);
}

/* ──────────────────────────────────────────────────────── */
/* 8. RESPONSIF (MOBILE-FIRST) */
/* ──────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  header {
    padding: 1.5rem 0;
    margin-bottom: 1.75rem;
  }

  header h1 {
    font-size: 1.8rem;
  }

  .container {
    padding: 0 1rem;
  }

  .card,
  .login-card {
    padding: 1.5rem;
    margin: 1.25rem auto;
  }

  .novel-grid,
  .role-cards {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .novel-cover {
    height: 220px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .role-card {
    padding: 1.6rem;
    max-width: 320px;
  }

  .role-icon {
    width: 56px;
    height: 56px;
    font-size: 1.8rem;
  }

  .btn-group {
    flex-direction: column;
  }

  .detail-content {
    flex-direction: column;
  }

  .detail-cover {
    width: 100%;
    height: 300px;
  }
}

/* ──────────────────────────────────────────────────────── */
/* 9. AKSESIBILITAS */
/* ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid #7ab9d9;
  outline-offset: 2px;
}

@media (hover: hover) {
  a:not(.btn):hover {
    color: #3a7ca5;
    text-decoration: underline;
  }
}