/* =========================================================
   PENGATURAN WARNA & UKURAN UTAMA (CSS VARIABLES)
   Tips untuk pemula: Ubah kode warna di bawah ini jika ingin
   mengganti tema warna seluruh website sekaligus!
   ========================================================= */
:root {
  --primary: #0d9488;         /* Hijau teal utama (tombol, highlight) */
  --primary-dark: #0f766e;    /* Teal gelap saat tombol disentuh (hover) */
  --primary-soft: #ccfbf1;    /* Latar belakang lembut untuk badge */
  --accent: #f59e0b;          /* Warna aksen kuning/oranye hangat */
  --danger: #dc2626;          /* Warna merah untuk peringatan/hapus */
  --success: #16a34a;         /* Warna hijau sukses */

  --bg-body: #f8fafc;         /* Warna latar belakang halaman */
  --bg-card: #ffffff;         /* Warna latar belakang kartu/box */
  --text-main: #0f172a;       /* Warna teks utama */
  --text-muted: #64748b;      /* Warna teks sekunder/abu-abu */
  --border: #e2e8f0;          /* Warna garis pemisah */

  --radius: 12px;             /* Kelengkungan sudut kartu */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.1);
}

/* Reset dasar agar tampilan konsisten di semua browser */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* Container agar konten rapi di tengah layar */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.app-main {
  flex: 1;
  padding-bottom: 48px;
}

.hidden {
  display: none !important;
}

/* =========================================================
   NAVBAR / HEADER
   ========================================================= */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-main);
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #14b8a6);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
}

.nav-search {
  display: flex;
  flex: 1;
  max-width: 340px;
  min-width: 200px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-body);
}

.nav-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-size: 0.9rem;
  outline: none;
}

.nav-search button {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-links > a {
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.nav-links > a:hover,
.nav-links > a.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  text-decoration: none;
}

.nav-admin-link {
  border: 1px dashed var(--primary);
}

.badge-pill {
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 700;
}

.nav-auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-menu-btn {
  display: none;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 1.2rem;
  cursor: pointer;
}

/* =========================================================
   TOMBOL & KOMPONEN UMUM
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
}

.icon-btn:hover {
  background: var(--bg-body);
  color: var(--text-main);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover,
.chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-neutral {
  background: #e2e8f0;
  color: #334155;
}

/* =========================================================
   HERO BANNER & SECTION
   ========================================================= */
.section {
  padding: 28px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.hero {
  background: linear-gradient(125deg, #0f766e 0%, #0d9488 55%, #14b8a6 100%);
  color: #fff;
  border-radius: 18px;
  padding: 36px;
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.hero h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 12px;
}

.hero p {
  opacity: 0.92;
  margin-bottom: 20px;
}

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

.hero-stats-card {
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.hero-stat-item strong {
  display: block;
  font-size: 1.3rem;
}

.hero-stat-item span {
  font-size: 0.82rem;
  opacity: 0.9;
}

/* =========================================================
   GRID & CARDS
   ========================================================= */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-thumb {
  width: 100%;
  height: 175px;
  object-fit: cover;
  background: #e2e8f0;
}

.card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.card-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.progress-wrap {
  margin: 6px 0;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.progress-numbers {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-top: 6px;
}

/* Banner Iklan di Halaman Beranda */
.ad-banner {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* =========================================================
   FORM & INPUT
   ========================================================= */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
}

.form-control:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

textarea.form-control {
  min-height: 96px;
  resize: vertical;
}

.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

/* =========================================================
   TABS & SUB-NAVIGASI
   ========================================================= */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

/* =========================================================
   KALENDER HARI DONASI & TABEL
   ========================================================= */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
}

.calendar-day-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px;
}

.calendar-cell {
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  background: #fff;
}

.calendar-cell.donated {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  border-color: var(--primary);
}

.calendar-cell.reminded {
  background: #fef3c7;
  border-color: var(--accent);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

th {
  background: #f1f5f9;
  font-weight: 700;
}

/* =========================================================
   ADMIN LAYOUT
   ========================================================= */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  margin-top: 20px;
}

.admin-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  height: fit-content;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-nav-btn {
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}

.admin-nav-btn:hover,
.admin-nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

/* =========================================================
   MODAL / POP-UP DIALOG
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-dialog {
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
}

.modal-body {
  padding: 20px;
}

/* =========================================================
   LIVE CHAT WIDGET
   ========================================================= */
.live-chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.live-chat-widget {
  position: fixed;
  right: 20px;
  bottom: 76px;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  z-index: 90;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: var(--primary);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header small {
  display: block;
  opacity: 0.88;
  font-size: 0.78rem;
}

.chat-header .icon-btn {
  color: #fff;
}

.chat-topics {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--bg-body);
}

.chat-topics .chip {
  font-size: 0.75rem;
  padding: 4px 10px;
  white-space: nowrap;
}

.chat-messages {
  height: 240px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.86rem;
}

.chat-bubble.bot {
  background: #f1f5f9;
  align-self: flex-start;
}

.chat-bubble.user {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
}

.chat-input-form {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.chat-input-form input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

/* =========================================================
   TOAST NOTIFIKASI & FOOTER
   ========================================================= */
.toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  box-shadow: var(--shadow-md);
}

.footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 36px 0 20px;
  margin-top: auto;
}

.footer h4 {
  color: #fff;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 24px;
}

.footer-brand .brand-name {
  color: #fff;
}

.footer-desc, .footer-contact {
  font-size: 0.85rem;
  margin-top: 10px;
  color: #94a3b8;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.86rem;
}

.footer-links a {
  color: #cbd5e1;
}

.footer-bottom {
  border-top: 1px solid #1e293b;
  margin-top: 24px;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

/* =========================================================
   RESPONSIF UNTUK TABLET & HP (MOBILE)
   ========================================================= */
@media (max-width: 900px) {
  .grid-3, .grid-4, .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero {
    grid-template-columns: 1fr;
    padding: 24px;
  }
  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .mobile-menu-btn {
    display: inline-flex;
  }
  .nav-search {
    order: 4;
    max-width: 100%;
    flex-basis: 100%;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 12px 0;
    border-top: 1px solid var(--border);
  }
  .nav-links.open {
    display: flex;
  }
  .grid-3, .grid-2, .grid-4, .footer-grid {
    grid-template-columns: 1fr;
  }
}
