/*
 * dz.css — Transition and state classes for the Dazzle micro-runtime.
 * Replaces Alpine.js x-transition with CSS-only animations.
 * ~40 lines. Works with Tailwind/DaisyUI.
 */

/* ── Toggle show/hide with fade ─────────────────────────────────────── */

[data-dz-show] {
  transition: opacity 150ms ease-in, transform 150ms ease-in;
}

[data-dz-toggleable]:not([data-dz-open]) [data-dz-show] {
  display: none;
}

/* ── Dropdown animation ─────────────────────────────────────────────── */

[data-dz-show="dropdown"] {
  transition: opacity 150ms ease-out, transform 150ms ease-out;
  transform-origin: top right;
}

[data-dz-toggleable][data-dz-open] [data-dz-show="dropdown"] {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* ── Slide-over panel ───────────────────────────────────────────────── */

[data-dz-slide-over] [data-dz-show="backdrop"] {
  transition: opacity 200ms ease-out;
}

[data-dz-slide-over] [data-dz-show="panel"] {
  transition: transform 200ms ease-out;
  transform: translateX(100%);
}

[data-dz-slide-over][data-dz-open] [data-dz-show="panel"] {
  transform: translateX(0);
}

/* ── Bulk actions bar ───────────────────────────────────────────────── */

[data-dz-bulk-bar] {
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}

/* ── Toast notifications ────────────────────────────────────────────── */

.dz-toast-enter {
  opacity: 0;
  transform: translateX(1rem);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.dz-toast-leave {
  opacity: 0;
  transform: translateX(1rem);
  transition: opacity 150ms ease-in, transform 150ms ease-in;
}

#dz-toast .alert {
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}

/* ── Desktop sidebar (replaces lg:drawer-open, unavailable in DaisyUI CDN) ── */

@media (min-width: 1024px) {
  /* Two-column grid when sidebar is open */
  .drawer[data-dz-sidebar="open"] {
    grid-template-columns: auto 1fr;
  }

  /* Show sidebar in-place (not overlay) */
  .drawer[data-dz-sidebar="open"] > .drawer-side {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    visibility: visible;
    pointer-events: auto;
  }

  /* No overlay needed on desktop */
  .drawer[data-dz-sidebar="open"] > .drawer-side > .drawer-overlay {
    visibility: hidden;
  }

  /* Slide content into view */
  .drawer[data-dz-sidebar="open"] > .drawer-side > *:not(.drawer-overlay) {
    transform: translateX(0);
  }

  /* Hide top navbar when sidebar provides navigation */
  .drawer[data-dz-sidebar="open"] > .drawer-content > [data-dz-sidebar-navbar] {
    display: none;
  }
}

/* ── Native dialog backdrop ─────────────────────────────────────────── */

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

dialog[open] {
  animation: dz-dialog-in 200ms ease-out;
}

@keyframes dz-dialog-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
