/* ============================================================
   OpsFlow — Prototype stylesheet
   Tailwind handles layout/typography; this file adds tokens,
   semantic status colors, and small motion/scrollbar polish.
   ============================================================ */

:root {
  --ring: 99 102 241; /* brand-500 */
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* Focus visibility for keyboard users */
:focus-visible {
  outline: 2px solid rgb(var(--ring) / 0.55);
  outline-offset: 2px;
}

/* Sidebar nav active / hover states */
.nav-link.is-active {
  background-color: rgb(79 70 229 / 0.16);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgb(129 140 248 / 0.25);
}
.nav-link.is-active i {
  color: #a5b4fc;
}
.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: 1.25rem;
  width: 3px;
  transform: translateY(-50%);
  border-radius: 0 9999px 9999px 0;
  background: #818cf8;
}
.nav-link {
  position: relative;
}

/* Scrollbar polish */
* {
  scrollbar-width: thin;
  scrollbar-color: rgb(148 163 184 / 0.5) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background-color: rgb(148 163 184 / 0.5);
  border-radius: 9999px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
#sidebar *::-webkit-scrollbar-thumb {
  background-color: rgb(71 85 105 / 0.7);
}

/* ============================ Status badges ============================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 9999px;
  padding: 0.125rem 0.55rem;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge .dot {
  height: 0.4rem;
  width: 0.4rem;
  border-radius: 9999px;
  background: currentColor;
  flex-shrink: 0;
}

/* slate */
.badge-slate   { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
/* indigo / blue */
.badge-blue    { background: #eef2ff; color: #4338ca; border-color: #e0e7ff; }
/* amber */
.badge-amber   { background: #fffbeb; color: #b45309; border-color: #fef3c7; }
/* emerald */
.badge-emerald { background: #ecfdf5; color: #047857; border-color: #d1fae5; }
/* rose */
.badge-rose    { background: #fff1f2; color: #be123c; border-color: #ffe4e6; }
/* violet */
.badge-violet  { background: #f5f3ff; color: #6d28d9; border-color: #ede9fe; }

/* ============================ Toggle switch ============================ */
/* Knob berada di dalam track (child), jadi peer-checked: tidak menjangkaunya.
   Gunakan sibling combinator + child selector. */
[data-autosync] + span > span {
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-autosync]:checked + span > span {
  transform: translateX(1rem);
}
[data-autosync]:focus-visible + span {
  outline: 2px solid rgb(var(--ring) / 0.55);
  outline-offset: 2px;
}

/* ============================ Document preview ============================ */
.doc-paper {
  min-height: 26cm;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}
@media (max-width: 640px) {
  .doc-paper { min-height: auto; }
}

/* ============================ Toasts ============================ */
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 0.7rem 0.85rem;
  box-shadow: 0 10px 30px -12px rgb(15 23 42 / 0.25);
  animation: toast-in 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.is-leaving {
  animation: toast-out 0.18s ease-in forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(12px); }
}

/* ============================ View fade-in ============================ */
.view-enter {
  animation: view-in 0.22s ease-out;
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================ Misc ============================ */
.skeleton {
  animation: pulse 1.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Print helper for future document previews */
@media print {
  #sidebar, header, footer, #toastStack { display: none !important; }
  main { padding: 0 !important; }
}
