/* ==========================================================================
   Inventory Management - iOS-Inspired Minimal Design System
   Matches Stock Management, Sales Management & Waiter Management styling.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Sidebar Collapsible Inventory Management Accordion
   -------------------------------------------------------------------------- */
.inv-collapsible-group {
  margin: 2px 10px !important;
}

.inv-header-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 9.5px 14px !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  user-select: none !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: #64748b !important;
  background-color: transparent !important;
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out !important;
  box-sizing: border-box !important;
}

.inv-header-row:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

.inv-header-row:hover .inv-side-icon,
.inv-header-row:hover .inv-chevron {
  color: #0f172a !important;
  stroke: #0f172a !important;
}

.inv-header-row.is-active {
  color: #1e293b !important;
}

.inv-header-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.inv-side-icon {
  width: 17px !important;
  height: 17px !important;
  min-width: 17px !important;
  color: #64748b !important;
  stroke: #64748b !important;
  fill: none !important;
  margin: 0 !important;
  display: inline-block !important;
  vertical-align: middle !important;
  transition: color 0.15s ease, stroke 0.15s ease !important;
}

.inv-header-title {
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: inherit !important;
  letter-spacing: -0.01em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.inv-chevron {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  color: #94a3b8 !important;
  stroke: currentColor !important;
  display: inline-block !important;
  transform: rotate(0deg) !important;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.15s ease !important;
  transform-origin: center center !important;
}

.inv-chevron.expanded {
  transform: rotate(90deg) !important;
}

.inv-sub-container {
  margin-left: 22px !important;
  padding-left: 12px !important;
  border-left: 1.5px solid #e2e8f0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  overflow: hidden !important;
  transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, margin 0.25s ease !important;
}

.inv-sub-container.collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  pointer-events: none !important;
}

.inv-sub-container.expanded {
  max-height: 400px !important;
  opacity: 1 !important;
  margin-top: 4px !important;
  margin-bottom: 6px !important;
  pointer-events: auto !important;
}

.inv-sub-item {
  cursor: pointer !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: #64748b !important;
  padding: 7px 12px !important;
  border-radius: 10px !important;
  transition: background-color 0.15s ease, color 0.15s ease !important;
  user-select: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.inv-sub-item:not(.active):hover {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

.inv-sub-item.active {
  background-color: #0f172a !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15) !important;
}

/* --------------------------------------------------------------------------
   Root Container & Page Layout (Smooth Full Scrollability)
   -------------------------------------------------------------------------- */
.inv-root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #0f172a;
  background-color: #f8fafc;
  flex: 1 1 0% !important;
  width: 100% !important;
  max-width: 100% !important;
  height: calc(100vh - 64px) !important;
  max-height: calc(100vh - 64px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scroll-behavior: smooth !important;
  box-sizing: border-box !important;
  padding: 24px 28px 96px 28px !important;
}

body:has(.inv-root) main,
body:has(.inv-root) .flex-1.overflow-hidden,
body:has(.inv-root) .layout-bg main {
  overflow-y: auto !important;
}

.inv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.inv-title-group h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
}

.inv-title-group p {
  font-size: 13px;
  color: #64748b;
  margin: 4px 0 0 0;
}

.inv-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Cards & Stat Grids
   -------------------------------------------------------------------------- */
.inv-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.inv-stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 104px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.inv-stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.inv-stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.inv-stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 8px 0 4px 0;
}

.inv-stat-sub {
  font-size: 12px;
  color: #94a3b8;
}

.inv-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  padding: 20px 24px;
  margin-bottom: 24px;
  width: 100% !important;
  box-sizing: border-box !important;
}

.inv-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 10px;
}

.inv-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Form Controls & Focused Add Inventory Grid
   -------------------------------------------------------------------------- */
.inv-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.inv-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inv-form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.inv-input,
.inv-select {
  width: 100%;
  height: 42px;
  padding: 8px 13px;
  font-size: 13.5px;
  color: #0f172a;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.inv-input:focus,
.inv-select:focus {
  outline: none;
  border-color: #0f172a;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

/* Searchable Item Name Autocomplete Dropdown */
.inv-suggest-wrap {
  position: relative;
}

.inv-suggest-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.16);
  max-height: 240px;
  overflow-y: auto;
  z-index: 60;
  padding: 4px;
}

.inv-suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  background: transparent;
  border: none;
  transition: background-color 0.12s ease;
}

.inv-suggest-item:hover,
.inv-suggest-item.is-highlighted {
  background-color: #f1f5f9;
}

.inv-suggest-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
}

.inv-suggest-meta {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

/* Inline Button Content Fix (prevents SVG block stacking over text) */
.inv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  white-space: nowrap;
  user-select: none;
  line-height: 1.3;
}

.inv-btn svg {
  display: inline-block;
  flex-shrink: 0;
}

.inv-btn-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.inv-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed !important;
}

.inv-btn-primary {
  background-color: #0f172a;
  color: #ffffff;
}

.inv-btn-primary:hover:not(:disabled) {
  background-color: #1e293b;
}

.inv-btn-secondary {
  background-color: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

.inv-btn-secondary:hover:not(:disabled) {
  background-color: #f8fafc;
  border-color: #94a3b8;
}

@media (max-width: 768px) {
  .inv-root {
    padding: 16px;
  }
  .inv-stat-grid {
    grid-template-columns: 1fr;
  }
  .inv-form-grid {
    grid-template-columns: 1fr;
  }
}
