/*
 * FulfillKaro Affiliate portal — plain CSS extras that do not depend on the Tailwind build.
 * Safe to load alongside either the Tailwind CDN or a compiled portal build.
 */

/* Custom scrollbars (sidebar, tables, scan logs) */
.scroll-thin {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}
.scroll-thin::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.scroll-thin::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
}
.scroll-thin::-webkit-scrollbar-track {
  background: transparent;
}

/* Staggered card entrance — set style="--i:3" on children */
[data-stagger] > * {
  animation: fk-rise 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

/* Toast stack */
#fk-toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
#fk-toasts .fk-toast {
  pointer-events: auto;
  animation: fk-toast-in 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
#fk-toasts .fk-toast.is-leaving {
  animation: fk-toast-out 200ms ease-in both;
}
@keyframes fk-toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}
@keyframes fk-toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* Modal / drawer transitions driven by the [hidden] attribute + .is-open */
.fk-overlay {
  transition: opacity 200ms ease;
  opacity: 0;
}
.fk-overlay.is-open {
  opacity: 1;
}
.fk-drawer-panel {
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateX(100%);
}
.fk-drawer-panel.is-open {
  transform: none;
}
.fk-modal-panel {
  transition:
    transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 200ms ease;
  transform: translateY(10px) scale(0.98);
  opacity: 0;
}
.fk-modal-panel.is-open {
  transform: none;
  opacity: 1;
}

/* Charts inherit the design tokens */
.apexcharts-tooltip {
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lift) !important;
  font-size: 12px !important;
}

/* Print sheets: isolate documents from the portal shell */
@page {
  margin: 12mm;
}
@media print {
  .no-print {
    display: none !important;
  }
  .print-sheet {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    width: 100% !important;
    break-inside: avoid;
  }
  .print-break {
    break-after: page;
  }
  body {
    background: #fff !important;
  }
}

/* =============================================================
 * Collapsed sidebar rail (desktop only). Toggled by portal.js via
 * <html class="sidebar-collapsed">, so no framework state is needed.
 * ============================================================= */
@media (min-width: 1024px) {
  html.sidebar-collapsed [data-shell-sidebar] {
    width: 76px;
  }
  html.sidebar-collapsed [data-shell-main] {
    padding-left: 76px;
  }
  [data-shell-sidebar],
  [data-shell-main] {
    transition:
      width 220ms cubic-bezier(0.22, 1, 0.36, 1),
      padding-left 220ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  html.sidebar-collapsed [data-nav-label],
  html.sidebar-collapsed [data-nav-group-label],
  html.sidebar-collapsed [data-sidebar-expanded-only] {
    display: none !important;
  }
  html.sidebar-collapsed [data-nav-link] {
    justify-content: center;
  }
  html.sidebar-collapsed [data-nav-badge] {
    position: absolute;
    top: 0.25rem;
    right: 0.4rem;
    min-width: 0.95rem;
    padding: 0 0.2rem;
    font-size: 9px;
    line-height: 0.95rem;
  }
}

/* Live operations feed */
.live-dot {
  position: relative;
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--success);
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 9999px;
  border: 1px solid var(--success);
  opacity: 0.6;
  animation: fk-live-ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes fk-live-ping {
  0% {
    transform: scale(0.7);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}
[data-live-item] {
  transition:
    background-color 400ms ease,
    border-color 400ms ease;
}
[data-live-item].is-live {
  background-color: color-mix(in oklab, var(--brand-600) 8%, transparent);
  border-color: color-mix(in oklab, var(--brand-600) 35%, transparent);
}

/* Network movement flow line */
.flow-line {
  background-image: linear-gradient(
    90deg,
    color-mix(in oklab, var(--brand-600) 65%, transparent) 0 12px,
    transparent 12px 26px
  );
  background-size: 26px 100%;
  animation: fk-flow 1.6s linear infinite;
}
@keyframes fk-flow {
  to {
    background-position: 26px 0;
  }
}

/* Scan feedback */
@keyframes fk-scan-flash {
  0% {
    background-color: color-mix(in oklab, var(--success) 28%, transparent);
  }
  100% {
    background-color: transparent;
  }
}
.scan-flash {
  animation: fk-scan-flash 700ms ease-out 1;
}
@keyframes fk-scan-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}
.scan-shake {
  animation: fk-scan-shake 260ms ease-in-out 1;
}

/* Sparkline / rank bars grow-in */
@keyframes fk-grow-x {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
.grow-x {
  transform-origin: left center;
  animation: fk-grow-x 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Rail-mode brand mark: only visible when the sidebar is collapsed */
@media (min-width: 1024px) {
  html.sidebar-collapsed [data-sidebar-rail-only] {
    display: block !important;
  }
  html.sidebar-collapsed [data-sidebar-collapse] i {
    transform: rotate(180deg);
  }
}

/* Affiliate extras */
[data-progress] { transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1); }
[data-copy-link].is-copied { transform: scale(1.04); filter: saturate(1.2); transition: transform 180ms ease; }
