/* =========================================================
   MEMBERSHIP DIGITAL PRO — STYLESHEET
   Tone visual: Formal, profesional, premium (SaaS modern)
   ========================================================= */

:root {
  --color-primary: #1B2A4A;
  --color-primary-light: #28406E;
  --color-accent: #C9A15D;
  --color-bg: #F5F6F8;
  --color-white: #FFFFFF;
  --color-wa: #25D366;
  --color-wa-dark: #1DA851;
  --color-text: #1F2430;
  --color-text-muted: #6B7280;
  --color-border: #E5E7EB;
  --color-danger: #DC2626;

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --shadow-soft: 0 10px 30px rgba(27, 42, 74, 0.10);
  --shadow-card: 0 4px 14px rgba(27, 42, 74, 0.07);

  --font-heading: 'Poppins', -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  padding-bottom: 24px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--font-heading); margin: 0 0 4px; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { text-decoration: none; color: inherit; }

.hidden { display: none !important; }
.no-scroll { overflow: hidden; }

/* =========================
   HEADER
   ========================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-white);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  max-width: 960px;
  margin: 0 auto;
}
.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  padding: 8px;
  border-radius: 10px;
  line-height: 1;
  flex-shrink: 0;
}
.icon-btn:active { background: var(--color-bg); }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  overflow: hidden;
  padding: 0 8px;
}
.brand-logo { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; }
.brand-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================
   SIDE NAV
   ========================= */
.nav-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0; visibility: hidden;
  transition: 0.25s ease;
  z-index: 60;
}
.nav-overlay.open { opacity: 1; visibility: visible; }

.side-nav {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 80%; max-width: 300px;
  background: var(--color-white);
  z-index: 70;
  transform: translateX(-100%);
  transition: 0.3s ease;
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.12);
  display: flex; flex-direction: column;
}
.side-nav.open { transform: translateX(0); }
.side-nav-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px; border-bottom: 1px solid var(--color-border);
}
.side-nav-title { font-family: var(--font-heading); font-weight: 700; color: var(--color-primary); }
.nav-list { list-style: none; margin: 0; padding: 8px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: none; border: none;
  padding: 14px 12px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500; color: var(--color-text);
  margin-bottom: 2px;
}
.nav-link.active { background: var(--color-primary); color: var(--color-white); }
.nav-icon { font-size: 18px; }

/* =========================
   MAIN CONTENT
   ========================= */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 48px;
}
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================
   HERO
   ========================= */
.hero-card {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
}
.hero-eyebrow { font-size: 13px; opacity: 0.8; margin-bottom: 6px; letter-spacing: 0.02em; }
.hero-title { font-size: 22px; margin-bottom: 8px; word-break: break-word; }
.hero-subtitle { font-size: 14px; opacity: 0.9; margin-bottom: 18px; line-height: 1.55; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =========================
   BUTTONS
   ========================= */
.btn {
  border: none; border-radius: var(--radius-sm);
  padding: 13px 18px; font-size: 14px; font-weight: 600;
  transition: transform 0.15s ease, opacity 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--color-accent); color: var(--color-primary); }
.btn-outline { background: rgba(255, 255, 255, 0.12); color: #fff; border: 1px solid rgba(255, 255, 255, 0.5); }
.btn-outline-dark { background: var(--color-white); color: var(--color-primary); border: 1px solid var(--color-border); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-text { background: none; color: var(--color-primary); text-decoration: underline; padding: 8px; min-height: auto; }
.btn-wa { background: var(--color-wa); color: #fff; width: 100%; margin-top: 14px; padding: 15px; }
.btn-wa-sm { background: var(--color-wa); color: #fff; padding: 9px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; min-height: 40px; }
.btn-sm { padding: 9px 14px; font-size: 13px; min-height: 40px; }
.icon-btn-sm {
  background: var(--color-bg); border: none; border-radius: 9px;
  padding: 9px; font-size: 14px; min-width: 38px; min-height: 38px;
}

/* =========================
   STAT GRID
   ========================= */
.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: var(--color-white); border-radius: var(--radius-md);
  padding: 18px; box-shadow: var(--shadow-card);
}
.stat-icon { font-size: 20px; }
.stat-value { font-family: var(--font-heading); font-size: 24px; font-weight: 700; color: var(--color-primary); margin: 8px 0 2px; }
.stat-label { font-size: 12.5px; color: var(--color-text-muted); }

/* =========================
   SECTION BLOCK
   ========================= */
.section-block { margin-bottom: 24px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.section-header h2 { font-size: 17px; color: var(--color-primary); }
.link-btn { background: none; border: none; color: var(--color-primary); font-weight: 600; font-size: 13px; padding: 4px; }

/* =========================
   PAGE HEADER
   ========================= */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-header h1 { font-size: 20px; color: var(--color-primary); }
.page-subtitle { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }

/* =========================
   SEARCH
   ========================= */
.search-bar { margin-bottom: 16px; }
.search-bar input {
  width: 100%; padding: 13px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); background: var(--color-white); font-size: 14px;
}
.search-bar input:focus {
  outline: none; border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 161, 93, 0.25);
}

/* =========================
   CARD GRID (Katalog / Promo)
   ========================= */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

.product-card {
  background: var(--color-white); border-radius: var(--radius-md);
  overflow: hidden; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
}
.product-image {
  height: 140px; background-color: #EEF1F6;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.product-info { padding: 14px; }
.product-info h3 { font-size: 15px; margin-bottom: 4px; word-break: break-word; }
.product-price { color: var(--color-primary); font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.product-desc {
  font-size: 13px; color: var(--color-text-muted); margin-bottom: 12px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* =========================
   LIST STACK (Order / Pelanggan / Log / Dashboard)
   ========================= */
.list-stack { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  background: var(--color-white); border-radius: var(--radius-md);
  padding: 14px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; box-shadow: var(--shadow-card); flex-wrap: wrap;
}
.list-item-title { font-weight: 600; font-size: 14px; word-break: break-word; }
.list-item-sub { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }
.list-item-date { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.list-item-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.badge {
  border: none; border-radius: 999px; padding: 7px 12px;
  font-size: 12px; font-weight: 600; min-height: auto;
}
.badge-new { background: #FEF3C7; color: #92400E; }
.badge-process { background: #DBEAFE; color: #1E40AF; }
.badge-done { background: #DCFCE7; color: #166534; }

/* =========================
   PROMO CARD
   ========================= */
.promo-card {
  background: var(--color-white); border-radius: var(--radius-md);
  padding: 18px; box-shadow: var(--shadow-card); position: relative;
  border: 1.5px dashed var(--color-accent);
}
.promo-code {
  font-family: var(--font-heading); font-weight: 700; font-size: 16px;
  color: var(--color-primary); letter-spacing: 0.03em; word-break: break-word; padding-right: 30px;
}
.promo-value { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }
.promo-delete { position: absolute; top: 12px; right: 12px; }

/* =========================
   ACTIVITY LOG
   ========================= */
.activity-item { align-items: flex-start; }
.activity-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--color-bg); display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.activity-row { display: flex; gap: 12px; align-items: flex-start; flex: 1; }
.activity-text { font-size: 13.5px; color: var(--color-text); line-height: 1.4; }
.activity-time { font-size: 12px; color: var(--color-text-muted); margin-top: 3px; }

/* =========================
   EMPTY STATE
   ========================= */
.empty-state {
  background: var(--color-white); border-radius: var(--radius-md);
  padding: 34px 20px; text-align: center; box-shadow: var(--shadow-card);
}
.empty-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--color-primary); }
.empty-desc { font-size: 13px; color: var(--color-text-muted); margin-bottom: 16px; line-height: 1.5; }
.empty-inline { font-size: 13px; color: var(--color-text-muted); text-align: center; padding: 18px; }

/* =========================
   FORMS
   ========================= */
.form-card {
  background: var(--color-white); border-radius: var(--radius-md);
  padding: 20px; box-shadow: var(--shadow-card);
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--color-text); }
.req { color: var(--color-danger); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); font-size: 14.5px; background: var(--color-bg);
}
.form-group textarea { resize: vertical; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 161, 93, 0.25); background: #fff;
}
.field-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 6px; line-height: 1.5; }
.field-error { font-size: 12px; color: var(--color-danger); margin-top: 6px; }

/* =========================
   MODAL
   ========================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  opacity: 0; visibility: hidden; transition: 0.25s ease; z-index: 80;
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto;
  width: 100%; max-width: 480px;
  background: var(--color-white);
  border-radius: 24px 24px 0 0;
  z-index: 90;
  max-height: 88vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.modal.open { transform: translateY(0); }

@media (min-width: 640px) {
  .modal {
    top: 0; bottom: 0; left: 0; right: 0; margin: auto;
    height: fit-content; max-height: 85vh;
    border-radius: 24px;
    transform: translateY(16px) scale(0.98);
    opacity: 0; visibility: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s ease;
  }
  .modal.open { transform: translateY(0) scale(1); opacity: 1; visibility: visible; }
}

.modal-content { padding: 20px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h2 { font-size: 17px; color: var(--color-primary); }

.detail-image {
  height: 180px; border-radius: var(--radius-md);
  background-color: #EEF1F6; background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; font-size: 44px; margin-bottom: 14px;
}
.product-price-lg { color: var(--color-primary); font-weight: 700; font-size: 18px; margin-bottom: 10px; }

/* =========================
   FOOTER
   ========================= */
.app-footer { text-align: center; padding: 24px 16px 8px; font-size: 12px; color: var(--color-text-muted); }

/* =========================
   TOAST
   ========================= */
.toast {
  position: fixed; top: 16px; left: 50%;
  transform: translate(-50%, -130%);
  background: var(--color-primary); color: #fff;
  padding: 13px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; z-index: 100;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease;
  max-width: 90%; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--color-danger); }

/* =========================
   RESPONSIVE FINE-TUNE
   ========================= */
@media (max-width: 360px) {
  .stat-value { font-size: 21px; }
  .hero-title { font-size: 20px; }
}
