/* Putra Arimbi Design System Tokens & Base Components */
:root {
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --surface-alt: #FAF8F4;
  --surface-sand: #EFECE4;
  --primary: #183B2B;
  --primary-hover: #122D20;
  --primary-soft: #E7F2EC;
  --primary-text: #165B38;
  --accent: #C79A63;
  --text: #1B241F;
  --text-muted: #55615A;
  --border: #E6E1D6;
  --border-strong: #D5CEC0;
  --danger: #B91C1C;
  --danger-soft: #FEE2E2;
  --warning: #92400E;
  --warning-soft: #FEF3C7;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --icon-sm: 16px;
  --icon-md: 18px;
  --icon-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(24, 59, 43, 0.05);
  --shadow-md: 0 8px 24px rgba(24, 59, 43, 0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a, button, select, summary, [role="button"] { touch-action: manipulation; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Smooth fade-in for lazy loaded images */
img[loading="lazy"] {
  background: #EAE4D8;
  transition: opacity 0.22s ease;
}

/* Shimmer Skeleton Loaders */
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #ECE7DC 25%, #F5F2EA 50%, #ECE7DC 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
.skeleton-img { width: 100%; aspect-ratio: 4/3; border-radius: 0; }
.skeleton-img-cat { width: 100%; aspect-ratio: 16/10; border-radius: 0; }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-90 { width: 90%; }
.skeleton-btn { height: 34px; width: 100%; border-radius: var(--radius-sm); margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .skeleton { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: var(--icon-sm); height: var(--icon-sm); flex-shrink: 0; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--surface-alt); border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: rgba(24, 59, 43, 0.06); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #991B1B; }
.btn-sm { padding: 7px 13px; font-size: 0.8125rem; }
.btn-pill { border-radius: 999px; }
.btn-icon { padding: 0; width: 34px; height: 34px; border-radius: var(--radius-sm); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}
.badge-published { background: var(--primary-soft); color: var(--primary-text); }
.badge-draft { background: var(--warning-soft); color: var(--warning); }
.badge-neutral { background: #ECEAE4; color: var(--text-muted); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.8125rem; font-weight: 600; color: var(--text); }
.field label .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24, 59, 43, 0.12);
}
.textarea { resize: vertical; min-height: 96px; }
.hint { font-size: 0.75rem; color: var(--text-muted); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 22, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.modal-lg { max-width: 780px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
}

/* Toast */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1200;
}
.toast {
  background: var(--primary);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  max-width: 360px;
}
.toast.error { background: var(--danger); }

/* Empty & Error States */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.state-card {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.state-card svg { width: 32px; height: 32px; color: var(--text-muted); opacity: 0.7; }
.state-card h3 { margin: 0; font-size: 1rem; color: var(--text); }
.state-card p { margin: 0; font-size: 0.85rem; color: var(--text-muted); max-width: 420px; }
