/* Custom backdrop blur for modals */
.backdrop-blur-md {
  --tw-backdrop-blur: blur(8px);
  -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
  backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
}

/* Kanban Board Layout */
.kanban-board {
  display: flex;
  overflow-x: auto;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  min-height: 500px;
}

.kanban-column {
  flex: 0 0 300px;
  background: hsl(var(--secondary) / 0.3);
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border) / 0.5);
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  padding: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid hsl(var(--border) / 0.3);
}

.kanban-column-content {
  flex: 1;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100px;
}

/* Task Expanding Row Transition */
.task-expand-row {
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease-out;
  opacity: 0;
}

.task-expand-row.expanded {
  max-height: 1000px;
  opacity: 1;
  padding: 1rem;
}

/* Glassmorphism Accents */
.glass-panel {
  background: hsl(var(--card) / 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Priority Backgrounds (Light mode fallback) */
.priority-low { background-color: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.3); color: #22c55e; }
.priority-medium { background-color: rgba(250, 204, 21, 0.1); border-color: rgba(250, 204, 21, 0.3); color: #eab308; }
.priority-high { background-color: rgba(251, 146, 60, 0.1); border-color: rgba(251, 146, 60, 0.3); color: #f97316; }
.priority-urgent { background-color: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); color: #ef4444; }

/* Status Backgrounds */
.status-pending { background-color: rgba(156, 163, 175, 0.1); color: #6b7280; }
.status-in-progress { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.status-on-hold { background-color: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.status-completed { background-color: rgba(34, 197, 94, 0.1); color: #22c55e; }
.status-cancelled { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; }

/* Drag and Drop Helpers */
.task-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.kanban-column-content.drag-over {
  background: hsl(var(--primary) / 0.05);
  border: 1px dashed hsl(var(--primary));
}

/* ── Page & table entry animations ── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Use forwards (not both) so content is visible before animation plays */
main {
  animation: fadeSlideUp 0.40s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

tbody tr {
  animation: fadeSlideUp 0.26s ease-out forwards;
}
tbody tr:nth-child(1)   { animation-delay: 0.03s; }
tbody tr:nth-child(2)   { animation-delay: 0.07s; }
tbody tr:nth-child(3)   { animation-delay: 0.11s; }
tbody tr:nth-child(4)   { animation-delay: 0.15s; }
tbody tr:nth-child(5)   { animation-delay: 0.19s; }
tbody tr:nth-child(6)   { animation-delay: 0.23s; }
tbody tr:nth-child(n+7) { animation-delay: 0.26s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Collapsed sections */
.section-content {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}

.section-content.collapsed {
  max-height: 0;
}

/* Luxury Design System Tokens */
:root {
  --luxury-gold: #c5a059;
  --luxury-gold-dark: #a6813d;
  --luxury-gold-light: #dfc28d;
  --luxury-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
  --luxury-shadow-accent: 0 10px 30px -10px rgba(197, 160, 89, 0.3);
}

.shadow-luxury { box-shadow: var(--luxury-shadow); }
.shadow-luxury-accent { box-shadow: var(--luxury-shadow-accent); }
.shadow-luxury-massive { box-shadow: 0 30px 60px -12px rgba(0,0,0,0.7), 0 18px 36px -18px rgba(0,0,0,0.75); }

.luxury-input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 0 1.25rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: hsl(var(--foreground));
  backdrop-filter: blur(4px);
}

.luxury-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--luxury-gold);
  box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.1);
  transform: translateY(-1px);
}

.animate-pulse-gentle {
  animation: pulse-gentle 3s ease-in-out infinite;
}

@keyframes pulse-gentle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.95); }
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

/* Scrollbar styling for luxury */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.02); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--luxury-gold); }

/* ─── Missing Tailwind Utilities (not in compiled output) ─── */

/* Z-index */
.z-10  { z-index: 10; }
.z-40  { z-index: 40; }
.z-50  { z-index: 50; }
.z-\[60\]  { z-index: 60; }
.z-\[70\]  { z-index: 70; }
.z-\[100\] { z-index: 100; }
.z-\[100000\] { z-index: 100000; }

/* Backdrop */
.bg-black\/50 { background-color: rgb(0 0 0 / 0.5); }

/* Shadow */
.shadow-2xl {
  --tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  --tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

/* Max-height */
.max-h-\[85vh\] { max-height: 85vh; }

/* Border widths */
.border-l-4 { border-left-width: 4px; }

/* Border colors */
.border-l-accent { border-left-color: hsl(var(--accent)); }
.border-l-blue-500 { border-left-color: #3b82f6; }
.border-l-orange-500 { border-left-color: #f97316; }

/* Success color token */
.text-success { color: #22c55e; }
.border-l-success { border-left-color: #22c55e; }

/* Green palette (used for bonus/loyalty) */
.text-green-500 { color: #22c55e; }
.text-green-600 { color: #16a34a; }
.text-green-600\/80 { color: rgb(22 163 74 / 0.8); }
.bg-green-500\/10 { background-color: rgb(34 197 94 / 0.1); }
.bg-green-500\/30 { background-color: rgb(34 197 94 / 0.3); }
.border-green-500 { border-color: #22c55e; }
.border-green-500\/30 { border-color: rgb(34 197 94 / 0.3); }
.focus\:ring-green-500:focus { --tw-ring-color: #22c55e; }

/* Orange palette */
.text-orange-500 { color: #f97316; }
.text-orange-600 { color: #ea580c; }
.bg-orange-500\/20 { background-color: rgb(249 115 22 / 0.2); }
.bg-orange-500\/30 { background-color: rgb(249 115 22 / 0.3); }

/* Red palette */
.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }
.bg-red-500\/20 { background-color: rgb(239 68 68 / 0.2); }

/* Gray palette */
.bg-gray-500\/20 { background-color: rgb(107 114 128 / 0.2); }
.text-gray-500 { color: #6b7280; }

/* Blue palette */
.text-blue-500 { color: #3b82f6; }
.text-blue-600 { color: #2563eb; }

/* Spin animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.animate-spin {
  animation: spin 1s linear infinite;
}

/* Active scale */
.active\:scale-95:active {
  --tw-scale-x: .95;
  --tw-scale-y: .95;
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

/* Modal open/close animation */
@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
@keyframes modal-backdrop-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.animate-modal-in {
  animation: modal-enter 0.2s ease-out forwards;
}
.animate-modal-backdrop {
  animation: modal-backdrop-enter 0.15s ease-out forwards;
}

/* Toast notification */
@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toast-slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}
.toast-enter { animation: toast-slide-in 0.3s ease-out forwards; }
.toast-exit  { animation: toast-slide-out 0.3s ease-in forwards; }

/* Search result highlight when navigating from global search */
.search-result-highlight {
  background: hsl(var(--primary) / 0.15) !important;
  animation: search-highlight-pulse 2s ease-out;
}
@keyframes search-highlight-pulse {
  0% { background: hsl(var(--primary) / 0.35) !important; }
  100% { background: hsl(var(--primary) / 0.1) !important; }
}

/* Purchase Order items grid – scrollable fixed-height container */
#create-po-items-grid,
#edit-po-items-grid {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
}

/* Purchase Order item cards – fixed height with content truncation */
.create-po-item-card,
.edit-po-item-card {
  min-width: 150px;
  max-width: 180px;
  width: 100%;
  height: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Fixed-height image area inside PO item cards */
.create-po-item-card .po-item-thumb,
.edit-po-item-card .po-item-thumb {
  height: 130px;
  min-height: 130px;
  max-height: 130px;
  flex-shrink: 0;
}

/* Let the text area fill remaining space but clip overflow */
.create-po-item-card .po-item-info,
.edit-po-item-card .po-item-info {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ── Global Floating Label System ─────────────────────────────────
   Applied automatically by js/utils/floatingLabels.js
   Works with label-before-input markup: restructures DOM at runtime.
   ─────────────────────────────────────────────────────────────── */
.fl-field {
  position: relative;
}

/* Taller input to fit both the floating label and the typed text */
.fl-field .fl-input {
  min-height: 52px !important;
  height: auto !important;
  padding-top: 20px !important;
  padding-bottom: 6px !important;
}

/* Label sits centered over the input when empty / unfocused */
.fl-field .fl-label {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 26px);
  transition:
    top        0.18s cubic-bezier(0.4, 0, 0.2, 1),
    transform  0.18s cubic-bezier(0.4, 0, 0.2, 1),
    font-size  0.18s cubic-bezier(0.4, 0, 0.2, 1),
    color      0.18s ease,
    font-weight 0.18s ease;
  /* hide the now-redundant block label spacing */
  margin: 0 !important;
  display: block !important;
}

/* Floated state — triggered by focus or when input has content */
.fl-field .fl-input:focus ~ .fl-label,
.fl-field .fl-input:not(:placeholder-shown) ~ .fl-label {
  top: 3px;
  transform: translateY(0);
  font-size: 0.68rem;
  font-weight: 600;
  color: hsl(var(--primary));
  letter-spacing: 0.05em;
}

/* Focus ring colour tweak when floating */
.fl-field .fl-input:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12);
}

/* Textarea support */
.fl-field textarea.fl-input {
  padding-top: 22px !important;
  resize: vertical;
}

/* Dark mode: floated label colour */
html.dark .fl-field .fl-input:focus ~ .fl-label,
html.dark .fl-field .fl-input:not(:placeholder-shown) ~ .fl-label {
  color: hsl(var(--primary));
}

@media (prefers-reduced-motion: reduce) {
  .fl-field .fl-label { transition: none; }
}

