/* =====================================================================
   PopsMalaya Affiliate — shared design system
   Cloned from MyBicara's affiliate.css, retokened to PopsMalaya magenta.
   ===================================================================== */
:root {
  --brand: #A8156F;
  --brand-dark: #8B1059;
  --brand-light: #FBEFF6;
  --magenta: #A8156F;
  --cta: #C2589C;
  --cta-dark: #8B1059;
  --cta-light: #F4D6E8;
  --hero-start: #A8156F;
  --hero-mid:   #8B1059;
  --hero-end:   #4F0731;
  --bg: #F1F3F5;
  --bg-warm: #FBF4F8;
  --surface: #FFFFFF;
  --border: #EFE0EA;
  --text: #1A0F18;
  --text-mid: #4A4A5A;
  --text-light: #8E8E9E;
  --coral: #FF6B6B;
  --sun: #FFD166;
  --mint: #06D6A0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 40px;
  --sh-sm: 0 2px 12px rgba(79,7,49,0.06);
  --sh-md: 0 8px 32px rgba(79,7,49,0.10);
  --sh-lg: 0 20px 60px rgba(79,7,49,0.18);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-mid);
  background: linear-gradient(145deg, #F1F3F5 0%, #FFFFFF 50%, #F1F3F5 100%);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; font-weight: 500; }
a:hover { color: var(--brand-dark); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* --- Nav --- */
.aff-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--sh-sm);
}
.aff-nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; max-width: 1120px; margin: 0 auto; padding: 0 24px;
}
.aff-nav__brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--text); font-size: 18px; }
.aff-nav__brand-logo { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); display: inline-block; }
.aff-nav__links { display: flex; align-items: center; gap: 20px; font-size: 14px; }
.aff-nav__links a { color: var(--text-mid); }
.aff-nav__links a:hover { color: var(--brand); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 28px; border-radius: 14px; font-weight: 600; font-size: 15px;
  cursor: pointer; border: none; font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn--primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white; box-shadow: 0 4px 16px rgba(168, 21, 111, 0.30);
}
.btn--primary:hover { box-shadow: 0 6px 20px rgba(168, 21, 111, 0.40); color: white; }
.btn--secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn--ghost { background: transparent; color: var(--brand); }
.btn--danger { background: var(--danger); color: white; }
.btn--success { background: var(--success); color: white; }
.btn--sm { padding: 8px 16px; font-size: 13px; border-radius: 10px; }
.btn--full { width: 100%; }

/* --- Cards --- */
.card { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--border); padding: 28px; box-shadow: var(--sh-sm); }
.card h2 { color: var(--text); font-size: 22px; font-weight: 700; margin-bottom: 16px; }

/* --- Typography --- */
h1, h2, h3, h4 { color: var(--text); line-height: 1.25; }
h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: clamp(20px, 3.5vw, 28px); font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
p { margin-bottom: 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.1em; font-size: 12px; font-weight: 600; color: var(--brand); }
.muted { color: var(--text-light); }

/* --- Forms --- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.form-group .hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-group input[type="text"], .form-group input[type="tel"], .form-group input[type="email"], .form-group input[type="password"], .form-group input[type="number"], .form-group select, .form-group textarea {
  width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 15px; font-family: inherit; background: var(--surface); color: var(--text);
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(168, 21, 111, 0.10);
}

/* --- Status badges --- */
.badge {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge--tier      { background: linear-gradient(135deg, var(--cta-light), white); color: var(--brand); border: 1px solid var(--cta-light); }
.badge--active, .badge--verified, .badge--paid, .badge--ok       { background: #D1FAE5; color: #065F46; }
.badge--pending, .badge--locked                                    { background: #FEF3C7; color: #92400E; }
.badge--rejected, .badge--suspended, .badge--voided, .badge--frozen { background: #FEE2E2; color: #991B1B; }
.badge--available { background: #DBEAFE; color: #1E40AF; }
.badge--cooling_off { background: #EDE9FE; color: #5B21B6; }

/* --- Tables --- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--border); }
.table th { font-weight: 600; color: var(--text); font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; }
.table td { color: var(--text-mid); }
.table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
.table code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* --- Grids --- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { padding: 20px; background: var(--surface); border-radius: var(--r-md); border: 1px solid var(--border); }
.stat__label { font-size: 12px; text-transform: uppercase; color: var(--text-light); letter-spacing: 0.05em; margin-bottom: 4px; }
.stat__value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat__sub { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* --- Utility --- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none !important; }

/* --- Footer --- */
.aff-footer { margin-top: 80px; padding: 40px 0; background: var(--surface); border-top: 1px solid var(--border); color: var(--text-light); font-size: 14px; }
.aff-footer a { color: var(--text-mid); }

/* --- Toast --- */
.toast {
  position: fixed; top: 24px; right: 24px; z-index: 1000;
  padding: 14px 20px; border-radius: var(--r-sm); background: var(--text);
  color: white; font-size: 14px; font-weight: 500;
  box-shadow: var(--sh-lg); transform: translateY(-20px); opacity: 0;
  transition: all 0.3s; max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast--success { background: var(--success); }
.toast--error { background: var(--danger); }

/* --- Loading --- */
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { text-align: center; padding: 40px; color: var(--text-light); }

/* --- Modal --- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal.show { display: flex; }
.modal__content { background: var(--surface); border-radius: var(--r-lg); padding: 32px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal__title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 16px; }

/* --- Responsive --- */
@media (max-width: 640px) {
  .card { padding: 20px; }
  .aff-nav__links { gap: 12px; font-size: 13px; }
  .stat__value { font-size: 22px; }
}
