/* ==========================================================================
   Quenza Cloud Toolkit - Custom CSS
   Complements Tailwind (Play CDN) with refinements the Design System needs:
   smooth transitions, custom scrollbar, focus polish, and the tablet
   icon-only sidebar behavior.
   ========================================================================== */

:root {
  --q-brand-green: #22c55e;
  --q-brand-teal: #14b8a6;
  --q-nav-from: #0ea5a4;
  --q-nav-to: #84cc16;
  --q-canvas: #f5f7fa;
  --q-line: #e5e9f2;
  --q-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global smooth transitions on interactive elements (0.2-0.3s ease) */
a,
button,
input,
.quenza-input {
  transition-property: color, background-color, border-color, box-shadow,
    transform, filter;
  transition-duration: 250ms;
  transition-timing-function: var(--q-ease);
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Custom scrollbar (thin, subtle) - Quenza
   -------------------------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

/* --------------------------------------------------------------------------
   Sidebar responsive behavior
   - Mobile (<768px): off-canvas drawer (translate handled by Tailwind/JS).
       When .is-open is present, slide in.
   - Tablet (768-1023px): icon-only rail (72px), labels hidden.
   - Desktop (>=1024px): full 260px with labels.
   -------------------------------------------------------------------------- */

/* Mobile drawer open state */
.quenza-sidebar.is-open {
  transform: translateX(0) !important;
}

/* Tablet: collapse to icon-only rail */
@media (min-width: 768px) and (max-width: 1023px) {
  .quenza-sidebar {
    width: 72px;
    transform: translateX(0);
  }
  .quenza-sidebar .sidebar-label {
    display: none;
  }
  .quenza-sidebar nav a,
  .quenza-sidebar .border-t a {
    justify-content: center;
  }
  /* Offset main content by the rail width */
  #quenza-main {
    padding-left: 72px;
  }
}

/* Focus-visible polish for keyboard users */
:focus-visible {
  outline: none;
}

/* Prevent body scroll when mobile drawer is open */
body.quenza-no-scroll {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Modal entrance animation (subtle, 0.2-0.3s ease) - Quenza
   Applied when a .quenza-modal becomes visible (Tailwind toggles .flex).
   -------------------------------------------------------------------------- */
.quenza-modal.flex {
  animation: quenza-fade 0.2s var(--q-ease);
}
.quenza-modal.flex .quenza-modal-panel {
  animation: quenza-pop 0.25s var(--q-ease);
}

@keyframes quenza-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes quenza-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Card entrance for content sections (very subtle) */
@keyframes quenza-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Responsive refinements
   -------------------------------------------------------------------------- */

/* Tables: keep horizontal scroll smooth on small screens */
@media (max-width: 640px) {
  table {
    font-size: 0.8125rem;
  }
}

/* Ensure modals never overflow the viewport on short screens */
.quenza-modal-panel {
  max-height: calc(100vh - 2rem);
}

/* Reduce motion: disable entrance animations too */
@media (prefers-reduced-motion: reduce) {
  .quenza-modal.flex,
  .quenza-modal.flex .quenza-modal-panel {
    animation: none !important;
  }
}
