/* Komponen bersama (website dan dashboard) */

/* ---------- Tombol ---------- */
.btn {
  --btn-bg: var(--navy-3);
  --btn-fg: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.65rem 1.35rem;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn:hover {
  transform: translateY(-2px);
  color: var(--btn-fg);
}
.btn:hover::after {
  transform: translateX(120%);
}
.btn:active {
  transform: translateY(0) scale(0.98);
}
.btn[disabled],
.btn.is-loading {
  opacity: 0.6;
  pointer-events: none;
}
.btn svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.btn-primary {
  --btn-bg: var(--grad-cta);
  background: var(--grad-cta);
  box-shadow: 0 10px 30px -10px rgba(56, 189, 248, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 16px 38px -10px rgba(56, 189, 248, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-ghost {
  --btn-bg: transparent;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line-2);
  color: var(--text);
}
.btn-ghost:hover {
  background: rgba(56, 189, 248, 0.1);
  box-shadow: inset 0 0 0 1.5px var(--sky);
}
.btn-soft {
  --btn-bg: rgba(56, 189, 248, 0.14);
  background: rgba(56, 189, 248, 0.14);
  color: var(--sky-2);
}
.btn-soft:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}
.btn-wa {
  --btn-bg: #1faa59;
  background: linear-gradient(135deg, #17a34a, #25d366);
  color: #04210f;
}
.btn-wa:hover {
  color: #04210f;
}
.btn-danger {
  --btn-bg: rgba(248, 113, 113, 0.16);
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.4);
}
.btn-danger:hover {
  background: rgba(248, 113, 113, 0.3);
  color: #fff;
}
.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.9rem;
  font-size: var(--fs-xs);
}
.btn-lg {
  min-height: 54px;
  padding: 0.85rem 1.9rem;
  font-size: var(--fs-md);
}
.btn-block {
  width: 100%;
}
.btn-icon {
  min-height: 40px;
  width: 40px;
  padding: 0;
}
.btn.is-loading::before {
  content: '';
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Formulir ---------- */
.field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  align-content: start;
}
.field > label,
.label {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-2);
}
.field .hint {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.field .err {
  font-size: var(--fs-xs);
  color: var(--bad);
  font-weight: 600;
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.95rem;
  background: rgba(3, 8, 24, 0.6);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.55;
}
.input::placeholder,
.textarea::placeholder {
  color: #5f7ab0;
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--line-2);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
  background: rgba(3, 8, 24, 0.85);
}
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea {
  border-color: var(--bad);
}
.select {
  appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237dd3fc' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
}
.select option {
  background: var(--navy);
  color: var(--text);
}
.input-group {
  display: flex;
  align-items: stretch;
}
.input-group > .addon {
  display: grid;
  place-items: center;
  padding: 0 0.85rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1.5px solid var(--line);
  color: var(--sky-2);
  font-weight: 700;
  font-size: var(--fs-sm);
}
.input-group > .addon:first-child {
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  border-right: 0;
}
.input-group > .addon:last-child {
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  border-left: 0;
}
.input-group > .input:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.input-group > .input:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.form-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid .full {
  grid-column: 1 / -1;
}
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Saklar */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-sm);
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch .track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 99px;
  background: #16295e;
  border: 1.5px solid var(--line-2);
  transition: background 0.25s, border-color 0.25s;
  flex: none;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #9fb7e6;
  transition: transform 0.3s var(--ease-spring), background 0.25s;
}
.switch input:checked + .track {
  background: var(--royal);
  border-color: var(--sky);
}
.switch input:checked + .track::after {
  transform: translateX(20px);
  background: #fff;
}
.switch input:focus-visible + .track {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
}

/* Pilihan chip (checkbox / radio berbentuk pil) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.chip {
  position: relative;
}
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  border-radius: 99px;
  border: 1.5px solid var(--line);
  background: rgba(3, 8, 24, 0.5);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
}
.chip span:hover {
  border-color: var(--sky);
  color: #fff;
}
.chip input:checked + span {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--sky);
  color: #fff;
}
.chip input:focus-visible + span {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}

/* ---------- Lencana ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.65rem;
  border-radius: 99px;
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.5;
  background: rgba(56, 189, 248, 0.16);
  color: var(--sky-2);
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.plain::before {
  display: none;
}
.badge.ok {
  background: rgba(52, 211, 153, 0.16);
  color: #6ee7b7;
}
.badge.warn {
  background: rgba(251, 191, 36, 0.16);
  color: #fcd34d;
}
.badge.bad {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}
.badge.mute {
  background: rgba(138, 163, 209, 0.16);
  color: var(--muted);
}

/* ---------- Kartu panel ---------- */
.panel {
  background: var(--grad-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(1rem, 2vw, 1.5rem);
  backdrop-filter: blur(10px);
}

/* ---------- Tab ---------- */
.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.3rem;
  border-radius: 12px;
  background: rgba(3, 8, 24, 0.6);
  border: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-sm);
  transition: background 0.2s, color 0.2s;
}
.tab:hover {
  color: #fff;
}
.tab.is-active {
  background: var(--royal);
  color: #fff;
  box-shadow: 0 6px 18px -8px rgba(56, 189, 248, 0.8);
}
.tab .count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.72rem;
  line-height: 20px;
  text-align: center;
}

/* ---------- Tabel ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--glass);
}
.table th,
.table td {
  padding: 0.8rem 1rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.table th {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  background: rgba(3, 8, 24, 0.5);
  white-space: nowrap;
}
.table tbody tr {
  transition: background 0.15s;
}
.table tbody tr:hover {
  background: rgba(56, 189, 248, 0.06);
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Paginasi ---------- */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.pager button {
  min-width: 40px;
  height: 40px;
  padding: 0 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(3, 8, 24, 0.5);
  color: var(--text-2);
  font-weight: 700;
  transition: all 0.2s;
}
.pager button:hover:not([disabled]) {
  border-color: var(--sky);
  color: #fff;
}
.pager button.is-active {
  background: var(--royal);
  border-color: var(--sky);
  color: #fff;
}
.pager button[disabled] {
  opacity: 0.35;
  cursor: default;
}

/* ---------- Modal dan laci ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 6, 20, 0.78);
  backdrop-filter: blur(6px);
  animation: fade-in 0.2s ease;
}
.overlay.is-drawer {
  place-items: stretch end;
  padding: 0;
}
.dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: linear-gradient(170deg, #0d2260, #07122e);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  animation: pop-in 0.35s var(--ease-spring);
}
.dialog.wide {
  width: min(860px, 100%);
}
.is-drawer .dialog {
  width: min(720px, 100%);
  height: 100vh;
  max-height: none;
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  animation: slide-in 0.4s var(--ease);
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  background: rgba(7, 18, 46, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.dialog-head h3 {
  font-size: var(--fs-xl);
}
.dialog-body {
  padding: 1.4rem;
}
.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  background: rgba(7, 18, 46, 0.95);
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
}
@keyframes slide-in {
  from {
    transform: translateX(100%);
  }
}

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: grid;
  gap: 0.6rem;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: #0b1c4d;
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  animation: toast-in 0.45s var(--ease-spring);
}
.toast.ok {
  border-color: rgba(52, 211, 153, 0.55);
}
.toast.err {
  border-color: rgba(248, 113, 113, 0.6);
}
.toast .ico {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--sky);
  color: var(--ink);
}
.toast.ok .ico {
  background: var(--ok);
}
.toast.err .ico {
  background: var(--bad);
}
.toast.out {
  animation: toast-out 0.3s ease forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

/* ---------- Skeleton dan kosong ---------- */
.skel {
  position: relative;
  overflow: hidden;
  background: rgba(56, 189, 248, 0.07);
  border-radius: var(--r-sm);
}
.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(125, 211, 252, 0.16) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}
.empty {
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}
.empty svg {
  width: 56px;
  height: 56px;
  color: var(--sky);
  opacity: 0.8;
}
.empty h3 {
  font-size: var(--fs-xl);
  color: var(--text);
}
.empty p {
  max-width: 44ch;
}

/* ---------- Pemuat gambar (dropzone) ---------- */
.dropzone {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  padding: 1.6rem 1rem;
  text-align: center;
  border: 2px dashed var(--line-2);
  border-radius: var(--r);
  background: rgba(56, 189, 248, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.dropzone:hover,
.dropzone.is-over {
  border-color: var(--sky);
  background: rgba(56, 189, 248, 0.12);
  color: #fff;
  transform: scale(1.01);
}
.dropzone svg {
  width: 38px;
  height: 38px;
  color: var(--sky);
}
.dropzone strong {
  color: var(--text);
}
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
}
.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--navy);
  border: 1.5px solid var(--line);
  cursor: grab;
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.thumb.is-drag {
  opacity: 0.4;
  transform: scale(0.95);
}
.thumb.is-target {
  border-color: var(--sky);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb .cover-tag {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--sky);
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 800;
}
.thumb .acts {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 6px;
  background: linear-gradient(0deg, rgba(3, 8, 24, 0.9), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.thumb:hover .acts,
.thumb:focus-within .acts {
  opacity: 1;
}
.thumb .acts button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 0;
  background: rgba(3, 8, 24, 0.85);
  color: #fff;
  display: grid;
  place-items: center;
}
.thumb .acts button:hover {
  background: var(--royal);
}
.thumb .acts button.del:hover {
  background: var(--bad);
}
.thumb .acts svg {
  width: 14px;
  height: 14px;
}
.thumb .prog {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 8, 24, 0.7);
  font-weight: 800;
  font-size: var(--fs-sm);
}
.thumb .prog i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  background: var(--sky);
  transition: width 0.2s;
}

/* ---------- Lain-lain ---------- */
.progress {
  height: 8px;
  border-radius: 99px;
  background: rgba(56, 189, 248, 0.15);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--grad-cta);
  transition: width 0.6s var(--ease);
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 1rem 0;
}
.kbd {
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.14);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.copy-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--r-sm);
  background: rgba(3, 8, 24, 0.7);
  border: 1px dashed var(--line-2);
  font-weight: 700;
  word-break: break-all;
}
.text-muted {
  color: var(--muted);
}
.text-ok {
  color: var(--ok);
}
.text-bad {
  color: var(--bad);
}
.text-sky {
  color: var(--sky-2);
}
.num {
  font-variant-numeric: tabular-nums;
}
