/* components.css — komponen UI yang dipakai publik & admin */

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: .9375rem; line-height: 1;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ring); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn--outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn--outline:hover { background: var(--surface-2); border-color: #cbd5e1; }
.btn--ghost { background: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn--sm { height: 32px; padding: 0 12px; font-size: .8125rem; }
.btn--icon { width: 32px; height: 32px; padding: 0; }
.btn--icon.btn--sm { width: 30px; height: 30px; }
.btn--block { width: 100%; }

/* ---------- Badge / chip ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: 2px 9px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; line-height: 1.6; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}
.badge--accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.badge--success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.badge--warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }

.chip {
  display: inline-flex; align-items: center; gap: .4rem; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .875rem; font-weight: 500;
  text-decoration: none; transition: border-color .15s, background-color .15s, color .15s;
}
.chip:hover { border-color: var(--accent-border); text-decoration: none; }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field__label { font-size: .8125rem; font-weight: 600; color: var(--text); }
.field__hint { font-size: .75rem; color: var(--muted); }
.field__error { font-size: .75rem; color: var(--danger); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }

.input, .select, .textarea {
  width: 100%; min-height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: .875rem; transition: border-color .15s, box-shadow .15s;
}
.textarea { padding: 8px 10px; min-height: 80px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.input[type=color] { padding: 2px; width: 44px; cursor: pointer; }
.input--mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: .875rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .875rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 34px; height: 20px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background-color .15s; flex: none; }
.switch__track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--ring); }

/* ---------- Alert & toast ---------- */
.alert { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: .875rem; margin-bottom: 12px; }
.alert--error { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert--success { background: var(--success-soft); border-color: #bbf7d0; color: #166534; }
.alert--info { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1200; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: #0f172a; color: #fff; font-size: .8125rem; box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
}
.toast i { margin-top: 2px; }
.toast--success i { color: #4ade80; }
.toast--error i { color: #f87171; }
.toast__close { margin-left: auto; background: none; border: 0; color: #94a3b8; padding: 0 0 0 8px; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 1100; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .45); }
.modal.is-open { display: flex !important; }
.modal__box { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); max-height: calc(100vh - 32px); overflow: auto; }
.modal__title { font-size: 1rem; margin: 0 0 6px; }
.modal__text { color: var(--muted); font-size: .875rem; margin: 0 0 16px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.tabs__tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border: 0; background: none; color: var(--muted);
  font-size: .875rem; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none;
}
.tabs__tab:hover { color: var(--text); text-decoration: none; }
.tabs__tab[aria-selected="true"], .tabs__tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs__panel[hidden] { display: none; }

/* ---------- Card & tabel ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card--pad { padding: 16px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { padding: 8px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfd; }
.table__thumb { width: 56px; height: 36px; object-fit: cover; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.table__actions { display: flex; gap: 4px; justify-content: flex-end; }
.table__title { font-weight: 600; color: var(--text); }
.table__sub { color: var(--muted); font-size: .75rem; }

/* ---------- Pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 28px; }
.pagination__link {
  min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: .875rem; font-weight: 500; background: var(--surface); text-decoration: none;
}
.pagination__link:hover { border-color: var(--accent-border); text-decoration: none; }
.pagination__link.is-current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pagination__link.is-disabled { opacity: .45; pointer-events: none; }
.pagination__gap { color: var(--muted); padding: 0 2px; }

/* ---------- Konten rich text (hasil WYSIWYG) ---------- */
.prose { line-height: 1.75; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.5rem; margin: 1.8em 0 .6em; }
.prose h3 { font-size: 1.2rem; margin: 1.5em 0 .5em; }
.prose img, .prose video { border-radius: var(--radius-sm); margin: 1.2em auto; }
.prose iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: var(--radius-sm); margin: 1.2em 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin: .25em 0; }
.prose blockquote { margin: 1.4em 0; padding: .4em 1.1em; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose pre { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: var(--radius-sm); overflow-x: auto; margin: 1.2em 0; }
.prose :not(pre) > code { background: var(--surface-2); border: 1px solid var(--border); padding: .1em .4em; border-radius: 5px; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: .95em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--surface-2); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Logo: mode warnai via mask-image ---------- */
.logo-tint { display: inline-block; background-color: var(--tint, var(--accent)); -webkit-mask: var(--mask) center / contain no-repeat; mask: var(--mask) center / contain no-repeat; }
.logo-tint img { opacity: 0; display: block; width: auto; }
