/* WargaConnect - Main CSS */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --primary:   #25D366;
  --primary-dark: #128C7E;
  --primary-light: #DCF8C6;
  --secondary: #075E54;
  --accent:    #34B7F1;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --info:      #3b82f6;
  --bg:        #f0f4f8;
  --bg-chat:   #E5DDD5;
  --white:     #ffffff;
  --text:      #111827;
  --text-muted:#6b7280;
  --border:    #e5e7eb;
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --font:      'Nunito', sans-serif;
  --nav-h:     60px;
  --bottom-h:  68px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

/* ── Topbar ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--secondary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow-md);
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
}
.topbar-logo {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: white;
}
.topbar-title { font-size: 18px; font-weight: 700; color: white; }
.topbar-subtitle { font-size: 11px; color: rgba(255,255,255,.7); line-height: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.15);
  border: none; color: white; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; position: relative; transition: background .2s;
}
.topbar-btn:hover { background: rgba(255,255,255,.25); }
.badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--bottom-h);
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer; color: var(--text-muted); transition: color .2s;
  text-decoration: none; font-size: 10px; font-weight: 600;
}
.bottom-nav-item.active { color: var(--primary-dark); }
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item.active svg { stroke: var(--primary-dark); }
.bnav-icon { position: relative; }

/* ── Main Content ── */
.main {
  padding-top: calc(var(--nav-h) + 16px);
  padding-bottom: calc(var(--bottom-h) + 16px);
  padding-left: 16px;
  padding-right: 16px;
  max-width: 600px;
  margin: 0 auto;
}

/* ── Cards ── */
.card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px;
}
.card-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.card-body { padding: 16px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm); font-family: var(--font);
  font-size: 14px; font-weight: 600; cursor: pointer; border: none;
  transition: all .2s; text-decoration: none; line-height: 1;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--green-600); color: white; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: var(--green-800); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary-dark); }
.btn-outline:hover { background: var(--green-50); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font); font-size: 14px;
  color: var(--text); background: white; transition: border-color .2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,211,102,.15); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── Pengumuman Card ── */
.announce-card {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 10px; overflow: hidden; cursor: pointer; transition: box-shadow .2s;
}
.announce-card:hover { box-shadow: var(--shadow-md); }
.announce-card.pinned { border-left: 4px solid var(--primary); }
.announce-img { width: 100%; height: 160px; object-fit: cover; }
.announce-body { padding: 12px 14px; }
.announce-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.announce-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.announce-excerpt { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.announce-footer { padding: 8px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.announce-author { font-size: 12px; color: var(--text-muted); }

/* ── Badge / Tag ── */
.tag {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .3px;
}
.tag-green   { background: var(--green-100); color: var(--green-700); }
.tag-blue    { background: #dbeafe; color: #1d4ed8; }
.tag-yellow  { background: #fef3c7; color: #b45309; }
.tag-red     { background: #fee2e2; color: #b91c1c; }
.tag-gray    { background: #f3f4f6; color: #374151; }
.tag-purple  { background: #ede9fe; color: #7c3aed; }

/* ── Status Badges ── */
.status-masuk       { background:#dbeafe; color:#1d4ed8; }
.status-diproses    { background:#fef3c7; color:#b45309; }
.status-selesai     { background:#dcfce7; color:#15803d; }
.status-ditolak     { background:#fee2e2; color:#b91c1c; }
.status-menunggu    { background:#fef3c7; color:#b45309; }
.status-lunas       { background:#dcfce7; color:#15803d; }
.status-belum       { background:#f3f4f6; color:#374151; }

/* ── List Item ── */
.list-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: white;
}
.list-item:last-child { border-bottom: none; }
.list-item-icon {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.list-item-sub { font-size: 12px; color: var(--text-muted); }
.list-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }

/* ── Toast ── */
#toast-container {
  position: fixed; top: 70px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; max-width: 300px;
}
.toast {
  background: white; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 12px 16px; display: flex; align-items: flex-start; gap: 10px;
  animation: slideIn .3s ease; border-left: 4px solid var(--primary);
  font-size: 13px; font-weight: 500;
}
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info    { border-color: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Section Header ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 16px; font-weight: 700; color: var(--text); }

/* ── Avatar ── */
.avatar {
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--green-100); display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--primary-dark);
}

/* ── Stats Card ── */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: white; border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px;
}
.stat-value { font-size: 24px; font-weight: 800; color: var(--primary-dark); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.stat-icon { font-size: 22px; margin-bottom: 4px; }

/* ── Hero Banner ── */
.hero-banner {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  color: white; position: relative; overflow: hidden;
}
.hero-banner::after {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.hero-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.hero-sub { font-size: 13px; opacity: .8; }

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 40px 20px;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--text-muted); }

/* ── Login Page ── */
.auth-wrapper {
  min-height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(160deg, var(--secondary) 0%, var(--primary-dark) 40%, var(--green-600) 100%);
}
.auth-top { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px 20px; }
.auth-logo { width: 72px; height: 72px; border-radius: 50%; background: white; display: flex; align-items: center; justify-content: center; font-size: 36px; font-weight: 900; color: var(--primary-dark); margin-bottom: 12px; box-shadow: var(--shadow-lg); }
.auth-app-name { font-size: 24px; font-weight: 800; color: white; margin-bottom: 4px; }
.auth-tagline { font-size: 13px; color: rgba(255,255,255,.75); text-align: center; }
.auth-card {
  background: white; border-radius: 24px 24px 0 0;
  padding: 28px 24px 40px; box-shadow: 0 -4px 20px rgba(0,0,0,.15);
}
.auth-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

/* ── Admin Sidebar (tablet+) ── */
@media (min-width: 768px) {
  .admin-layout {
    display: grid; grid-template-columns: 240px 1fr;
    min-height: 100vh;
  }
  .sidebar {
    background: var(--secondary); position: fixed;
    top: 0; left: 0; bottom: 0; width: 240px;
    display: flex; flex-direction: column; z-index: 50;
    overflow-y: auto;
  }
  .sidebar-brand {
    padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .sidebar-brand-name { font-size: 18px; font-weight: 800; color: white; }
  .sidebar-brand-sub { font-size: 11px; color: rgba(255,255,255,.6); }
  .sidebar-nav { flex: 1; padding: 12px 0; }
  .sidebar-section { padding: 8px 16px 4px; font-size: 10px; font-weight: 700; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .8px; }
  .sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; color: rgba(255,255,255,.8);
    font-size: 14px; font-weight: 600; transition: all .2s;
    text-decoration: none; border-radius: 0;
  }
  .sidebar-link:hover { background: rgba(255,255,255,.1); color: white; }
  .sidebar-link.active { background: var(--primary); color: white; }
  .sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
  .admin-main { margin-left: 240px; padding: 24px; }
  .bottom-nav { display: none; }
  .topbar { left: 240px; }
  .main { max-width: 100%; }
}

/* ── Tabs ── */
.tabs { display: flex; background: white; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.tab-btn { flex: 1; padding: 11px 8px; border: none; background: none; font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all .2s; border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

/* ── Upload preview ── */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center; cursor: pointer;
  transition: border-color .2s; background: var(--bg);
}
.upload-area:hover { border-color: var(--primary); }
.upload-area.dragover { border-color: var(--primary); background: var(--green-50); }
.upload-preview { width: 100%; border-radius: var(--radius-sm); margin-top: 12px; }

/* ── Spinner ── */
.spinner {
  width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: white; border-radius: 50%;
  animation: spin .6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Table ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--bg); padding: 10px 12px; text-align: left; font-weight: 700; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--green-50); }

/* ── Alert ── */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 8px; }
.alert-success { background: var(--green-100); color: var(--green-800); border: 1px solid var(--green-200); }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Utilities ── */
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.text-muted { color: var(--text-muted); } .text-small { font-size: 12px; } .text-center { text-align: center; }
.fw-bold { font-weight: 700; } .fw-semibold { font-weight: 600; }
.text-green { color: var(--primary-dark); } .text-danger { color: var(--danger); }
.w-100 { width: 100%; }
.rounded { border-radius: var(--radius); }
.hidden { display: none !important; }
