/*
 * design-system.css — token & komponen visual (design-system.md)
 * Dimuat oleh layouts/main.php dan layouts/admin.php.
 *
 * Warna brand (primary/accent) di-override layout lewat variabel --brand-*
 * yang diambil dari application/config/brand.php — jadi brand.php tetap
 * satu-satunya sumber warna brand. Nilai di bawah hanya fallback.
 *
 * Catatan urutan: file ini dimuat SEBELUM stylesheet yang di-inject Tailwind
 * CDN, jadi utility class Tailwind (padding/ukuran) memenangkan tie-break.
 * Karena itu: jangan menaruh utility yang bentrok pada elemen yang memakai
 * kelas komponen di bawah (mis. .btn jangan dipasangi py-2.5 / rounded-lg).
 */

:root {
	/* Color — neutral */
	--color-ink-900: #0b0b0c;
	--color-ink-700: #374151;
	--color-ink-500: #6b7280;
	--color-line: #e5e7eb;
	--color-surface: #ffffff;
	--color-surface-alt: #f3f4f6;
	--color-on-dark: #ffffff;
	--color-on-dark-muted: rgba(255, 255, 255, 0.8);

	/* Color — brand (di-override layout dari brand.php) */
	--brand-primary: #1677ff;
	--brand-primary-dark: #0f5fd6;
	--brand-primary-100: #e6f0ff;
	--brand-accent: #ffb900;
	--brand-accent-600: #e6a600;

	/* Color — semantic */
	--color-success: #16a34a;
	--color-success-dark: #15803d;
	--color-warning: #f59e0b;
	--color-danger: #dc2626;
	--color-danger-dark: #b91c1c;
	--color-focus-ring: rgba(22, 119, 255, 0.4);

	/* Type */
	--font-sans: "Outfit", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--fs-display: clamp(2.25rem, 1.6rem + 3vw, 3.75rem);
	--fs-h2: clamp(1.75rem, 1.4rem + 1.6vw, 2.75rem);

	/* Radius */
	--radius-sm: 8px;
	--radius-md: 12px;
	--radius-lg: 20px;
	--radius-xl: 28px;
	--radius-full: 9999px;

	/* Shadow */
	--shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
	--shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
	--shadow-lg: 0 20px 48px rgba(16, 24, 40, 0.16);
	--shadow-blue: 0 12px 32px rgba(22, 119, 255, 0.28);

	/* Layout */
	--container-max: 1200px;
	--gutter: 16px;
	--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (min-width: 768px) {
	:root { --gutter: 32px; }
}

@media (min-width: 1024px) {
	:root { --gutter: 64px; }
}

/* ---------------------------------------------------------------- Base */

body {
	font-family: var(--font-sans);
	background-color: var(--color-surface);
	color: var(--color-ink-700);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

/* Fokus terlihat (a11y): ring 3px pada elemen interaktif non-input.
   Input punya gaya fokus sendiri lewat .input:focus. */
:where(a, button, [tabindex]):focus-visible {
	outline: 3px solid var(--color-focus-ring);
	outline-offset: 2px;
}

/* ------------------------------------------------------- Layout helpers */

/* Container utama: maks 1200px + gutter responsif (16/32/64px). */
.container-ds {
	width: 100%;
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

/* Jarak vertikal antar section: 64 / 80 / 96px (mobile/tablet/desktop). */
.section {
	padding-block: 64px;
}

@media (min-width: 768px) {
	.section { padding-block: 80px; }
}

@media (min-width: 1024px) {
	.section { padding-block: 96px; }
}

/* ------------------------------------------------------------ Typography */

.h-display {
	font-size: var(--fs-display);
	font-weight: 600;
	line-height: 1.05;
	letter-spacing: -0.03em;
	color: var(--color-ink-900);
}

.h-section {
	font-size: var(--fs-h2);
	font-weight: 600;
	line-height: 1.1;
	letter-spacing: -0.02em;
	color: var(--color-ink-900);
}

.h-card {
	font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.375rem);
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: var(--color-ink-900);
}

.eyebrow {
	display: inline-block;
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--brand-primary-dark);
}

/* Teks sekunder standar. */
.muted {
	color: var(--color-ink-500);
}

/* --------------------------------------------------------------- Buttons */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	height: 44px;
	padding: 0 20px;
	border: 1px solid transparent;
	border-radius: var(--radius-md);
	background: transparent;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 150ms var(--ease), border-color 150ms var(--ease),
		color 150ms var(--ease), transform 150ms var(--ease), box-shadow 150ms var(--ease);
}

@media (min-width: 768px) {
	.btn { font-size: 0.9375rem; }
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

.btn-lg {
	height: 52px;
	padding: 0 28px;
}

/* Full-width (mobile-first); pasang sm:w-auto bila ingin auto di ≥640px. */
.btn-block { width: 100%; }

/* Primary — CTA utama, teks selalu ink-900 di atas amber. */
.btn-primary {
	background: var(--brand-accent);
	color: var(--color-ink-900);
}

.btn-primary:hover { background: var(--brand-accent-600); }

/* Dark — CTA sekunder kuat (navbar, aksi panel). */
.btn-dark {
	background: var(--color-ink-900);
	color: #ffffff;
}

.btn-dark:hover { background: #000000; }

/* Secondary — aksi pendukung dengan border tipis. */
.btn-secondary {
	background: var(--color-surface);
	color: var(--color-ink-900);
	border-color: var(--color-line);
}

.btn-secondary:hover {
	background: var(--color-surface-alt);
	border-color: #d1d5db;
}

/* Outline terang untuk dipakai di atas latar biru/hitam. */
.btn-outline-light {
	background: transparent;
	color: #ffffff;
	border-color: rgba(255, 255, 255, 0.5);
}

.btn-outline-light:hover {
	background: rgba(255, 255, 255, 0.12);
	border-color: #ffffff;
}

/* Semantic (approve/reject, dsb.). */
.btn-success {
	background: var(--color-success);
	color: #ffffff;
}

.btn-success:hover { background: var(--color-success-dark); }

.btn-danger {
	background: var(--color-danger);
	color: #ffffff;
}

.btn-danger:hover { background: var(--color-danger-dark); }

.btn-danger-ghost {
	background: var(--color-surface);
	color: var(--color-danger);
	border-color: #fca5a5;
}

.btn-danger-ghost:hover { background: #fef2f2; }

/* Link aksi bergaya "Read More →". */
.btn-link {
	height: auto;
	padding: 0;
	background: none;
	color: var(--brand-primary-dark);
	font-weight: 600;
}

.btn-link:hover { text-decoration: underline; }

/* ----------------------------------------------------------------- Forms */

.label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.5;
	color: var(--color-ink-700);
}

/* Input 48px, radius 8px, font 16px (mencegah auto-zoom iOS). */
.input {
	display: block;
	width: 100%;
	height: 48px;
	padding: 0 16px;
	border: 1px solid var(--color-line);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-ink-900);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
	transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}

.input::placeholder { color: var(--color-ink-500); }

.input:hover { border-color: #d1d5db; }

.input:focus {
	outline: none;
	border-color: var(--brand-primary);
	box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.input:disabled {
	background: var(--color-surface-alt);
	opacity: 0.7;
}

.input.is-error { border-color: var(--color-danger); }

textarea.input {
	height: auto;
	min-height: 96px;
	padding: 12px 16px;
	resize: vertical;
}

/* Select native + chevron di kanan. */
select.input {
	padding-right: 40px;
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}

.field { margin-bottom: 16px; }

.field-hint {
	margin-top: 4px;
	font-size: 0.75rem;
	line-height: 1.5;
	color: var(--color-ink-500);
}

.field-error {
	margin-top: 4px;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--color-danger);
}

/* ----------------------------------------------------------------- Cards */

.card {
	background: var(--color-surface);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-sm);
}

.card-lg { border-radius: var(--radius-lg); }

.card-raised { box-shadow: var(--shadow-md); }

/* Empty state (daftar kosong, placeholder). */
.empty {
	padding: 40px 24px;
	border: 1px dashed var(--color-line);
	border-radius: var(--radius-md);
	background: var(--color-surface-alt);
	color: var(--color-ink-500);
	font-size: 0.875rem;
	text-align: center;
}

/* ---------------------------------------------------------------- Badges */

.badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 10px;
	border-radius: var(--radius-full);
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: var(--brand-primary-100); color: var(--brand-primary-dark); }
.badge-neutral { background: var(--color-surface-alt); color: var(--color-ink-700); }
.badge-accent { background: var(--brand-accent); color: var(--color-ink-900); }

/* ---------------------------------------------------------------- Alerts */

.alert {
	padding: 12px 16px;
	border: 1px solid transparent;
	border-radius: var(--radius-md);
	font-size: 0.875rem;
	line-height: 1.5;
}

.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: var(--color-danger-dark); }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* --------------------------------------------------------------- Progress */

.progress {
	height: 8px;
	overflow: hidden;
	border-radius: var(--radius-full);
	background: var(--color-surface-alt);
}

.progress-bar {
	height: 100%;
	border-radius: var(--radius-full);
	background: var(--brand-primary);
	transition: width 300ms var(--ease);
}

/* ------------------------------------------------------------------ Stats */

.stat-number {
	font-size: 2rem;
	font-weight: 600;
	line-height: 1;
	letter-spacing: -0.02em;
	color: var(--color-ink-900);
	font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
	.stat-number { font-size: 2.5rem; }
}

@media (min-width: 1024px) {
	.stat-number { font-size: 3rem; }
}

.stat-label {
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-ink-500);
}

/* ------------------------------------------------------- Checklist item */

.check-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.check-icon {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: var(--radius-full);
	background: var(--brand-primary);
	color: #ffffff;
	font-size: 0.8125rem;
	font-weight: 700;
	line-height: 1;
}

/* ------------------------------------------------------ Header (sticky) */

.site-header {
	transition: box-shadow 150ms var(--ease);
}

.site-header.is-scrolled { box-shadow: var(--shadow-sm); }

/* -------------------------------------------------- Drawer menu mobile */

.drawer {
	position: fixed;
	inset: 0;
	z-index: 60;
	display: flex;
	flex-direction: column;
	background: var(--color-surface);
}

.drawer-header {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: space-between;
	height: 64px;
	padding-inline: 16px;
	border-bottom: 1px solid var(--color-line);
}

.drawer-nav {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 8px;
	overflow-y: auto;
	padding: 24px 16px;
}

.drawer-link {
	display: block;
	padding: 10px 12px;
	border-radius: var(--radius-md);
	font-size: 1.25rem;
	font-weight: 500;
	color: var(--color-ink-900);
	text-decoration: none;
	transition: background-color 150ms var(--ease);
}

.drawer-link:hover { background: var(--color-surface-alt); }

.drawer-link.is-active {
	background: var(--brand-primary-100);
	color: var(--brand-primary-dark);
	font-weight: 600;
}

.drawer-cta {
	display: flex;
	flex: none;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
	border-top: 1px solid var(--color-line);
}

/* Dekorasi lengkung transparan di hero biru (opacity ~8%). */
.hero-arc {
	position: absolute;
	border-radius: var(--radius-full);
	background: rgba(255, 255, 255, 0.08);
	pointer-events: none;
}

/* ------------------------------------------------------------ Reduced motion */

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