/* ============================================
   CEMILAN CIAMIS — Design System
   Platform Digital UMKM Makanan Ringan Ciamis
   ============================================ */

/* Google Fonts — Inter & JetBrains Mono (Modern) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================
   CSS Custom Properties (Design Tokens)
   Theme: Purple Aesthetics (UI Designer Persona)
   ============================================ */
:root {
  /* ── Primary — Purple ── */
  --primary-50:  #faf5ff;
  --primary-100: #f3e8ff;
  --primary-200: #e9d5ff;
  --primary-300: #d8b4fe;
  --primary-400: #c084fc;
  --primary-500: #a855f7;
  --primary-600: #9333ea;
  --primary-700: #7e22ce;
  --primary-800: #6b21a8;
  --primary-900: #581c87;
  --primary-950: #3b0764;

  /* ── Accent — Soft Violet & Pink ── */
  --accent-300: #fbcfe8;
  --accent-400: #f472b6;
  --accent-500: #ec4899;
  --accent-600: #db2777;

  /* ── Semantic ── */
  --success-50:  #ecfdf5;
  --success-500: #10b981;
  --success-600: #059669;
  --danger-50:   #fef2f2;
  --danger-500:  #ef4444;
  --danger-600:  #dc2626;
  --warning-50:  #fffbeb;
  --warning-500: #f59e0b;
  --whatsapp:    #25D366;
  --whatsapp-dark: #128C7E;
  --info:        #3b82f6;

  /* ── Neutrals — Grayscale ── */
  --neutral-50:  #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;

  /* ── Backgrounds ── */
  --bg-body:      #f8fafc;
  --bg-surface:   #ffffff;
  --bg-card:      #ffffff;
  --bg-glass:     rgba(255, 255, 255, 0.75);
  --bg-dark:      #0f172a;
  --bg-dark-card: rgba(15, 23, 42, 0.8);

  /* ── Text ── */
  --text-heading:   #0f172a;
  --text-body:      #334155;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  /* ── Typography ── */
  --font-heading: 'Inter', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;

  --text-xs:  0.75rem;    /* 12px */
  --text-sm:  0.875rem;   /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:  1.125rem;   /* 18px */
  --text-xl:  1.25rem;    /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */
  --text-5xl: 3rem;       /* 48px */
  --text-6xl: 3.75rem;    /* 60px */

  /* ── Spacing ── */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* ── Borders ── */
  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-2xl:  1.5rem;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-sm:   0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md:   0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg:   0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl:   0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl:  0 25px 50px -12px rgb(0 0 0 / 0.25);
  --shadow-purple: 0 4px 14px 0 rgba(168, 85, 247, 0.39);
  --shadow-purple-lg: 0 6px 20px rgba(168, 85, 247, 0.45);
  --shadow-gold: 0 10px 25px -5px rgba(236, 72, 153, 0.25);
  --shadow-wa:   0 10px 25px -5px rgba(37, 211, 102, 0.28);

  /* ── Gradients ── */
  --gradient-primary:  linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  --gradient-hero:     linear-gradient(145deg, #0f172a 0%, #1e1b4b 50%, #3b0764 100%);
  --gradient-accent:   linear-gradient(135deg, #f472b6 0%, #db2777 100%);
  --gradient-card:     linear-gradient(145deg, rgba(255,255,255,1), rgba(255,255,255,0.9));
  --gradient-glass:    linear-gradient(145deg, rgba(255,255,255,0.85), rgba(255,255,255,0.45));
  --gradient-dark:     linear-gradient(135deg, #0f172a, #1e293b);
  --gradient-shimmer:  linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);

  /* ── Transitions ── */
  --ease-out:    cubic-bezier(0.25, 1, 0.5, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-base: 300ms var(--ease-out);
  --transition-slow: 500ms var(--ease-out);

  /* ── Z-index ── */
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-drawer:   400;
  --z-modal:    500;
  --z-toast:    600;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-body);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { text-decoration: none; color: inherit; transition: color var(--transition-fast); }
a:hover { color: var(--primary-600); }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--primary-200); color: var(--primary-900); }

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}
h1 { font-size: var(--text-5xl); font-weight: 800; }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); font-weight: 600; }

p { margin-bottom: var(--space-4); color: var(--text-body); }
p:last-child { margin-bottom: 0; }

small { font-size: var(--text-sm); color: var(--text-secondary); }

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-gold {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   Layout
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}
@media (min-width: 768px) {
  .container { padding: 0 var(--space-6); }
}
@media (min-width: 1024px) {
  .container { padding: 0 var(--space-8); }
}

.section {
  padding: var(--space-16) 0;
  position: relative;
}
@media (min-width: 768px) {
  .section { padding: var(--space-20) 0; }
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-10);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}
.section-header h2 { margin-bottom: var(--space-3); }
.section-header p { color: var(--text-secondary); font-size: var(--text-lg); }

.section-header .section-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  background: var(--primary-100);
  color: var(--primary-700);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
}

/* Grid */
.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .grid-2 { grid-template-columns: 1fr; } }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-6);
}
@media (max-width: 520px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
}

/* Flex */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col     { display: flex; flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  line-height: 1.4;
  border: none;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}
.btn:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.btn:hover:not(:disabled)::after { opacity: 1; }

.btn-primary {
  background: var(--gradient-primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-purple);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-purple-lg);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--primary-700);
  border: 2px solid var(--primary-200);
}
.btn-secondary:hover {
  background: var(--primary-50);
  border-color: var(--primary-400);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary-700);
  border: 2px solid var(--primary-300);
}
.btn-outline:hover {
  background: var(--primary-700);
  color: var(--text-inverse);
  border-color: var(--primary-700);
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: white;
  box-shadow: var(--shadow-wa);
}
.btn-whatsapp:hover {
  background: #20bd5a;
  transform: translateY(-2px);
  box-shadow: 0 14px 35px -5px rgba(37,211,102,0.4);
}

.btn-accent {
  background: var(--gradient-accent);
  color: var(--neutral-900);
  box-shadow: var(--shadow-gold);
}
.btn-accent:hover { transform: translateY(-2px); }

.btn-ghost {
  background: transparent;
  color: var(--text-body);
}
.btn-ghost:hover { background: var(--neutral-100); }

.btn-danger {
  background: var(--danger-500);
  color: white;
}
.btn-danger:hover { background: var(--danger-600); transform: translateY(-1px); }

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-2xl);
}
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  border-radius: var(--radius-lg);
}
.btn-icon {
  width: 44px; height: 44px; padding: 0;
  border-radius: var(--radius-full);
}
.btn-block { width: 100%; }

/* ============================================
   Form Elements
   ============================================ */
.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-heading);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--text-heading);
  transition: all var(--transition-fast);
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.form-input::placeholder { color: var(--text-muted); }

.form-textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%23737373' viewBox='0 0 16 16'%3E%3Cpath d='M8 11.5l-5-5h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 44px;
}

.form-error {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--danger-500);
}

.form-hint {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* File upload */
.form-file-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  border: 2px dashed var(--neutral-300);
  border-radius: var(--radius-xl);
  background: var(--neutral-50);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}
.form-file-upload:hover { border-color: var(--primary-400); background: var(--primary-50); }
.form-file-upload input[type="file"] { display: none; }
.form-file-upload .upload-icon { font-size: 2rem; margin-bottom: var(--space-2); }
.form-file-upload .upload-text { color: var(--text-secondary); font-size: var(--text-sm); }

/* ============================================
   Animations & Keyframes
   ============================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@keyframes slideOutRight {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}
@keyframes slideInUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.05); opacity: 0.9; }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%      { transform: translateY(-15px) rotate(2deg); }
  66%      { transform: translateY(-8px) rotate(-1deg); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-5deg); }
  75%      { transform: rotate(5deg); }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Animation classes */
.animate-fade-in-up { animation: fadeInUp 0.6s var(--ease-out) both; }
.animate-fade-in    { animation: fadeIn 0.4s var(--ease-out) both; }
.animate-scale-in   { animation: scaleIn 0.4s var(--ease-spring) both; }
.animate-bounce     { animation: bounce 2s ease-in-out infinite; }
.animate-float      { animation: float 6s ease-in-out infinite; }
.animate-pulse      { animation: pulse 2s ease-in-out infinite; }
.animate-wiggle     { animation: wiggle 1s ease-in-out; }

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}
.reveal.delay-1 { transition-delay: 0.1s; }
.reveal.delay-2 { transition-delay: 0.2s; }
.reveal.delay-3 { transition-delay: 0.3s; }

/* ============================================
   Utilities
   ============================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

.font-heading { font-family: var(--font-heading); }
.font-bold    { font-weight: 700; }
.font-semi    { font-weight: 600; }
.font-medium  { font-weight: 500; }

.color-primary   { color: var(--primary-700); }
.color-accent    { color: var(--accent-500); }
.color-success   { color: var(--success-500); }
.color-danger    { color: var(--danger-500); }
.color-muted     { color: var(--text-muted); }
.color-secondary { color: var(--text-secondary); }

.bg-primary { background: var(--gradient-primary); }
.bg-surface { background: var(--bg-surface); }

.rounded     { border-radius: var(--radius-xl); }
.rounded-lg  { border-radius: var(--radius-2xl); }
.rounded-full{ border-radius: var(--radius-full); }

.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-4  { padding: var(--space-4); }
.p-6  { padding: var(--space-6); }
.p-8  { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden  { display: none !important; }
.visible { visibility: visible; }
.block   { display: block; }
.inline-flex { display: inline-flex; }

.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Loading spinner */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--primary-200);
  border-top-color: var(--primary-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 20px; height: 20px; border-width: 2px; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--neutral-200) 25%, var(--neutral-100) 50%, var(--neutral-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--neutral-200);
  margin: var(--space-6) 0;
  border: none;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-4);
}
.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}
.empty-state h3 { color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state p  { color: var(--text-muted); }

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}
.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Price formatting */
.price {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary-700);
}
.price-original {
  text-decoration: line-through;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.85em;
}
.price-discount {
  color: var(--danger-500);
  font-weight: 700;
}

/* Quantity selector */
.qty-selector {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 2px solid var(--neutral-200);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.qty-selector button {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-lg); font-weight: 600;
  background: var(--neutral-50);
  transition: background var(--transition-fast);
}
.qty-selector button:hover { background: var(--primary-100); color: var(--primary-700); }
.qty-selector .qty-value {
  width: 48px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-base);
  border-left: 2px solid var(--neutral-200);
  border-right: 2px solid var(--neutral-200);
}
