/* ============================================
   Membership SintangWeb — Mobile-first UI
   ============================================ */

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

:root {
  --green: #1D9E75;
  --green-dark: #0F6E56;
  --green-light: #E1F5EE;
  --blue: #185FA5;
  --blue-light: #E6F1FB;
  --red: #E24B4A;
  --red-light: #FCEBEB;
  --amber: #BA7517;
  --amber-light: #FAEEDA;
  --text: #1a1a1a;
  --text-sec: #666;
  --text-hint: #aaa;
  --bg: #fff;
  --bg-sec: #f8f9fa;
  --bg-page: #f0f2f5;
  --border: #f0f0f0;
  --border-med: #e0e0e0;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
}

html { -webkit-text-size-adjust: 100%; }

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

/* ---- LAYOUT ---- */
.container { max-width: 480px; margin: 0 auto; padding: 16px; }
.container-wide { max-width: 960px; margin: 0 auto; padding: 16px; }

/* ---- TOPBAR ---- */
.topbar {
  background: var(--bg);
  padding: 13px 16px 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: -0.3px;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.topbar-user a { text-decoration: none; }
.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
  flex-shrink: 0;
}
.nav-link { font-size: 13px; color: var(--text-sec); text-decoration: none; font-weight: 500; }
.nav-link.active { color: var(--blue); }
.btn-logout { font-size: 12px; color: var(--red); text-decoration: none; font-weight: 600; }
.btn-back { font-size: 13px; color: var(--blue); text-decoration: none; font-weight: 500; }

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, var(--green), var(--blue));
  padding: 20px 16px 24px;
  color: #fff;
}
.hero-greeting { font-size: 13px; opacity: .85; margin-bottom: 2px; }
.hero-name { font-size: 21px; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.3px; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hero-stat {
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 11px 13px;
  backdrop-filter: blur(4px);
}
.hero-stat-label { font-size: 11px; opacity: .8; margin-bottom: 2px; }
.hero-stat-val { font-size: 19px; font-weight: 700; }
.hero-stat-val.warning { color: #FFD166; }
.hero-stat-val.ok { color: #A8F0D0; }

/* ---- CARDS ---- */
.card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.card-row { display: flex; justify-content: space-between; align-items: center; }
.card-green { background: #E8F8F1; border-color: #9FE1CB; }
.card-warning { background: #fff; border-color: #FAC775; }
.card-blue { background: var(--blue-light); border-color: #85B7EB; }
.card-danger { background: var(--red-light); border-color: #F09595; }

/* ---- LAYANAN CARD ---- */
.layanan-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: box-shadow .2s;
}
.layanan-card:active { box-shadow: var(--shadow); }
.layanan-card.unpaid { border-color: #FAC775; }
.layanan-card.paid { border-color: #9FE1CB; }
.layanan-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.layanan-aktif { font-size: 12px; color: var(--text-sec); }
.tagihan-row {
  background: var(--bg-sec);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tagihan-amount { font-size: 17px; font-weight: 700; color: var(--text); }
.tagihan-due { font-size: 11px; color: var(--amber); margin-top: 1px; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-green { background: #EAF3DE; color: #27500A; }
.badge-warning { background: #FAEEDA; color: #633806; }
.badge-danger { background: var(--red-light); color: #501313; }
.badge-blue { background: var(--blue-light); color: #0C447C; }

/* ---- BUTTONS ---- */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  text-align: center;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: .1px;
  transition: opacity .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:active { opacity: .9; transform: scale(0.99); }

.btn-green {
  display: inline-block;
  padding: 9px 18px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
}
.btn-green:active { opacity: .85; }

.btn-pay {
  display: block;
  width: 100%;
  padding: 14px;
  text-align: center;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn-pay:active { opacity: .9; transform: scale(0.99); }

.btn-outline {
  display: block;
  width: 100%;
  padding: 13px;
  text-align: center;
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-med);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn-outline:active { background: var(--bg-sec); }
.btn-full { width: 100%; }

.btn-danger-outline {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--red-light);
  border: 1.5px solid #F09595;
  border-radius: var(--radius-lg);
  padding: 13px 16px;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-title { font-size: 14px; font-weight: 700; color: #501313; }
.btn-sub { font-size: 12px; color: #791F1F; margin-top: 1px; }
.icon-alert {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #F7C1C1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--red);
  flex-shrink: 0;
}

/* ---- PROFIL LINK ---- */
.profil-link {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 16px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.profil-link:active { background: var(--bg-sec); }
.profil-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--blue);
  flex-shrink: 0;
}
.profil-title { font-size: 14px; font-weight: 700; color: var(--text); }
.profil-sub { font-size: 12px; color: var(--text-sec); margin-top: 1px; }

/* ---- SECTION LABELS ---- */
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin: 16px 0 10px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

/* ---- TYPOGRAPHY ---- */
.label-sm { font-size: 12px; color: var(--text-sec); }
.value-lg { font-size: 17px; font-weight: 700; }
.value-xl { font-size: 24px; font-weight: 700; }
.required { color: var(--red); }

/* ---- AUTH ---- */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--green), var(--blue));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-circle {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}
.auth-logo-name { font-size: 19px; font-weight: 700; color: #fff; }
.auth-logo-sub { font-size: 13px; color: rgba(255,255,255,0.75); margin-top: 3px; }
.auth-card {
  background: var(--bg);
  border-radius: 24px;
  padding: 24px 20px;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}
.auth-card h2 { font-size: 19px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.auth-card .auth-sub { font-size: 13px; color: var(--text-sec); margin-bottom: 20px; }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 500;
}
.alert-danger { background: var(--red-light); color: #501313; border: 1px solid #F09595; }
.alert-success { background: #EAF3DE; color: #27500A; border: 1px solid #97C459; }

/* ---- SUCCESS ---- */
.success-circle {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: #EAF3DE;
  color: #27500A;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 28px;
}

/* ---- FORMS ---- */
.field-group { margin-bottom: 14px; }
.field-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sec);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1.5px solid var(--border-med);
  border-radius: var(--radius);
  background: var(--bg-sec);
  color: var(--text);
  font-family: inherit;
  transition: border-color .2s;
  -webkit-appearance: none;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--green);
  background: var(--bg);
}
.field-readonly {
  padding: 12px 14px;
  font-size: 15px;
  border-radius: var(--radius);
  background: var(--bg-sec);
  color: var(--text-sec);
  border: 1.5px solid var(--border);
  margin-bottom: 0;
}
.field-hint { font-size: 11px; color: var(--text-hint); margin-top: 4px; }

/* ---- URGENCY ---- */
.urgency-group { display: flex; gap: 8px; }
.urgency-opt input { display: none; }
.urgency-label {
  display: block;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border-med);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-sec);
  color: var(--text-sec);
  transition: all .15s;
}
.urgency-opt input:checked + .urgency-rendah { background: #EAF3DE; color: #27500A; border-color: var(--green); }
.urgency-opt input:checked + .urgency-sedang { background: var(--amber-light); color: #633806; border-color: var(--amber); }
.urgency-opt input:checked + .urgency-tinggi { background: var(--red-light); color: #501313; border-color: var(--red); }

/* ---- ADMIN STATS ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.stat-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}
.stat-label { font-size: 11px; font-weight: 700; color: var(--text-hint); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.stat-val { font-size: 24px; font-weight: 700; color: var(--text); }
.stat-val-sm { font-size: 16px !important; }

/* ---- TABLES ---- */
.table-wrap {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead { background: var(--bg-sec); }
.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--bg-sec); }
.action-btn {
  font-size: 12px;
  padding: 5px 12px;
  border: 1.5px solid var(--border-med);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  color: var(--text-sec);
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: background .15s;
}
.action-btn:active { background: var(--bg-sec); }

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .container-wide { padding: 12px; }
}
@media (max-width: 420px) {
  .hero-name { font-size: 19px; }
  .value-xl { font-size: 22px; }
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.card, .layanan-card { animation: fadeIn .3s ease both; }
.layanan-card:nth-child(2) { animation-delay: .05s; }
.layanan-card:nth-child(3) { animation-delay: .1s; }
.layanan-card:nth-child(4) { animation-delay: .15s; }

/* ============================================
   DARK MODE
   ============================================ */

[data-theme="dark"] {
  --text: #f0f0f0;
  --text-sec: #aaa;
  --text-hint: #666;
  --bg: #1e1e1e;
  --bg-sec: #2a2a2a;
  --bg-page: #141414;
  --border: #2e2e2e;
  --border-med: #3a3a3a;
  --green-light: #0d3d2a;
  --blue-light: #0d2340;
  --red-light: #3a1515;
  --amber-light: #3a2505;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
}

[data-theme="dark"] .topbar {
  background: #1e1e1e;
  border-bottom-color: #2e2e2e;
}

[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #0F6E56, #0C447C);
}

[data-theme="dark"] .auth-card {
  background: #1e1e1e;
}

[data-theme="dark"] .field-group input,
[data-theme="dark"] .field-group select,
[data-theme="dark"] .field-group textarea {
  background: #2a2a2a;
  color: #f0f0f0;
  border-color: #3a3a3a;
}

[data-theme="dark"] .field-group input:focus,
[data-theme="dark"] .field-group select:focus,
[data-theme="dark"] .field-group textarea:focus {
  background: #1e1e1e;
  border-color: var(--green);
}

[data-theme="dark"] .layanan-card.unpaid { border-color: #7a5a10; }
[data-theme="dark"] .layanan-card.paid   { border-color: #0d5a3a; }

[data-theme="dark"] .badge-green   { background: #0d3d1a; color: #6ee7b7; }
[data-theme="dark"] .badge-warning { background: #3a2505; color: #fcd34d; }
[data-theme="dark"] .badge-danger  { background: #3a1515; color: #fca5a5; }
[data-theme="dark"] .badge-blue    { background: #0d2340; color: #93c5fd; }

[data-theme="dark"] .profil-link:active { background: #2a2a2a; }

[data-theme="dark"] #notif-dropdown {
  background: #1e1e1e;
  border-color: #2e2e2e;
}
