/* GEMPAR - Gerakan Pilah Sampah Di Warakas */
/* Cloudflare Pages Ready - Mobile First PWA */

:root {
  --primary-dark: #166534;
  --primary: #22C55E;
  --primary-light: #4ADE80;
  --primary-lighter: #86EFAC;
  --primary-bg: #DCFCE7;
  --page-bg: #F0FDF4;
  --gold: #F59E0B;
  --gold-light: #FCD34D;
  --white: #FFFFFF;
  --gray-bg: #F3F4F6;
  --gray-text: #6B7280;
  --dark-text: #1F2937;
  --danger: #EF4444;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 20px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--page-bg);
  color: var(--dark-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
.font-display { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; }
.font-heading { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 600; }

/* Layout */
.container { max-width: 480px; margin: 0 auto; padding: 0 16px; position: relative; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-dark {
  background: var(--primary-dark);
  color: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-gold {
  background: var(--gold);
  color: var(--white);
}
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

/* Inputs */
.input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #E5E7EB;
  border-radius: var(--radius-sm);
  font-size: 16px;
  background: var(--white);
  transition: border-color 0.2s;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}

/* Status Bar (mobile) */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark-text);
}

/* Splash Screen */
.splash {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, var(--page-bg) 0%, var(--primary-bg) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s;
}
.splash-logo {
  width: 150px;
  height: 150px;
  object-fit: contain;
  margin-bottom: 20px;
  animation: bounce 2s infinite;
}
.splash-brand {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-dark);
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.splash-tagline {
  font-size: 14px;
  color: var(--gray-text);
  margin-top: 4px;
}
.splash-tagline span { color: var(--gold); font-weight: 700; }
.splash-loading {
  display: flex;
  gap: 8px;
  margin-top: 32px;
}
.splash-loading .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 1.4s infinite ease-in-out both;
}
.splash-loading .dot:nth-child(1) { animation-delay: -0.32s; }
.splash-loading .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Gate Screen */
.gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, var(--page-bg) 0%, var(--primary-bg) 100%);
}
.gate-logo { width: 120px; margin-bottom: 32px; }
.gate-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 24px;
}
.gate-form { width: 100%; max-width: 360px; }
.gate-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--gray-text);
}

/* Dashboard */
.dashboard { padding-bottom: 80px; }
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 12px;
}
.dashboard-header h1 {
  font-size: 16px;
  color: var(--gray-text);
}
.dashboard-header h1 strong {
  display: block;
  font-size: 20px;
  color: var(--primary-dark);
  margin-top: 2px;
}

/* Balance Card */
.balance-card {
  background: var(--primary-dark);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.balance-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 150px;
  height: 150px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}
.balance-label { font-size: 12px; color: var(--primary-lighter); letter-spacing: 1px; }
.balance-amount {
  font-size: 48px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin: 8px 0;
}
.balance-unit { font-size: 18px; color: var(--gold-light); }

/* Milestones */
.milestone-bar {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  font-size: 11px;
}
.milestone-item { text-align: center; flex: 1; }
.milestone-item .icon { font-size: 16px; display: block; margin-bottom: 2px; }
.milestone-item .label { color: var(--primary-lighter); }
.milestone-progress {
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}
.milestone-progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  transition: width 0.5s;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.action-btn {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
  border: none;
  font-family: inherit;
}
.action-btn:hover { transform: translateY(-2px); }
.action-btn .icon { font-size: 28px; display: block; margin-bottom: 8px; }
.action-btn .label { font-size: 13px; color: var(--dark-text); font-weight: 500; }

/* History */
.history-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-bg);
}
.history-item:last-child { border-bottom: none; }
.history-date { font-size: 12px; color: var(--gray-text); width: 70px; }
.history-detail { flex: 1; font-size: 14px; }
.history-gem { font-size: 14px; font-weight: 700; color: var(--primary); }

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid #E5E7EB;
  display: flex;
  justify-content: space-around;
  padding: 8px 0 16px;
  z-index: 100;
  max-width: 480px;
  margin: 0 auto;
}
.nav-item {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--gray-text);
  font-size: 11px;
  padding: 4px;
}
.nav-item .icon { font-size: 22px; display: block; margin-bottom: 2px; }
.nav-item.active { color: var(--primary); }
.nav-item.active .icon { color: var(--primary); }

/* QR Screen */
.qr-screen {
  position: fixed;
  inset: 0;
  background: var(--dark-text);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--white);
}
.qr-screen .close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 28px;
  color: var(--white);
  background: none;
  border: none;
  cursor: pointer;
}
.qr-container {
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  margin: 24px 0;
}
.qr-container canvas, .qr-container img { display: block; }
.qr-id { font-size: 14px; color: var(--gray-text); margin-top: 12px; text-align: center; }

/* Admin Panel */
.admin-body { background: var(--gray-bg); }
.admin-header {
  background: var(--primary-dark);
  color: var(--white);
  padding: 20px 24px;
}
.admin-header h1 { font-size: 20px; font-weight: 700; }
.admin-header p { font-size: 13px; color: var(--primary-lighter); margin-top: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 20px 0;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-card .icon { font-size: 28px; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--primary-dark); }
.stat-card .label { font-size: 12px; color: var(--gray-text); margin-top: 4px; }

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-bar select, .filter-bar input {
  padding: 10px 14px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  font-size: 14px;
  background: var(--white);
}
.filter-bar .search-btn {
  padding: 10px 20px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

/* Table */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}
th {
  background: var(--primary-bg);
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
}
td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-bg);
}
tr:hover td { background: var(--page-bg); }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green { background: var(--primary-bg); color: var(--primary-dark); }
.badge-gold { background: #FEF3C7; color: #92400E; }

/* Bank Sampah */
.bank-header {
  background: var(--primary-dark);
  color: var(--white);
  padding: 24px 20px;
  text-align: center;
}
.bank-header h1 { font-size: 20px; font-weight: 700; }
.bank-header p { font-size: 14px; color: var(--primary-lighter); margin-top: 4px; }

.scan-area {
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  background: var(--white);
  margin: 20px 0;
  cursor: pointer;
}
.scan-area .icon { font-size: 48px; margin-bottom: 12px; }
.scan-area h3 { font-size: 16px; color: var(--dark-text); margin-bottom: 4px; }
.scan-area p { font-size: 13px; color: var(--gray-text); }

.member-preview {
  background: var(--primary-bg);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
  border-left: 4px solid var(--primary);
}
.member-preview h3 { font-size: 18px; color: var(--primary-dark); margin-bottom: 8px; }
.member-preview p { font-size: 14px; color: var(--gray-text); margin: 4px 0; }
.member-preview .gem { font-size: 20px; font-weight: 700; color: var(--gold); }

.waste-types {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.waste-type {
  padding: 16px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  border: 2px solid #E5E7EB;
  background: var(--white);
  transition: all 0.2s;
}
.waste-type:hover { border-color: var(--primary); }
.waste-type.active {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.waste-type .icon { font-size: 28px; display: block; margin-bottom: 6px; }
.waste-type .label { font-size: 12px; font-weight: 600; }

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary-dark);
  color: var(--white);
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .container-wide { padding: 0 16px; }
  .filter-bar { flex-direction: column; }
  .filter-bar select, .filter-bar input { width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 22px; }
}

/* Print */
@media print {
  .bottom-nav, .splash, .btn { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
