/* ═══════════════════════════════════════════════════════
   Custom Styles — Inventory Management SPA
   ═══════════════════════════════════════════════════════ */

/* ─── Custom Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Card ─── */
.card {
  background: white;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  overflow: hidden;
}

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  background: white;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.2s;
  cursor: pointer;
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  color: #94a3b8;
}
.btn-icon:hover { background: #f1f5f9; color: #475569; }
.btn-icon.danger:hover { background: #fef2f2; color: #ef4444; }

/* ─── Navigation Buttons ─── */
.nav-btn {
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nav-btn:hover {
  background: #f8fafc;
  color: #334155;
}
.nav-btn.active {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  color: #4f46e5;
  font-weight: 600;
}
.nav-badge {
  background: #f1f5f9;
  color: #94a3b8;
  font-weight: 600;
  min-width: 1.5rem;
  text-align: center;
}
.nav-btn.active .nav-badge {
  background: rgba(79, 70, 229, 0.15);
  color: #4f46e5;
}

/* ─── Data Tables ─── */
.data-table thead th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  user-select: none;
}
.data-table thead th.sortable { cursor: pointer; }
.data-table thead th.sortable:hover { color: #4f46e5; }
.data-table thead th.sorted-asc i,
.data-table thead th.sorted-desc i { opacity: 1; color: #4f46e5; }
.data-table thead th.sorted-asc i::before { content: "\e109"; } /* ph-arrow-up */
.data-table thead th.sorted-desc i::before { content: "\e107"; } /* ph-arrow-down */

.data-table tbody td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tbody tr {
  transition: background 0.15s;
}
.data-table tbody tr:hover {
  background: #fafbfe;
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
}

/* ─── Form Inputs ─── */
.form-group {
  margin-bottom: 1rem;
}
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.375rem;
}
.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: white;
  font-size: 0.875rem;
  color: #1e293b;
  transition: all 0.2s;
  outline: none;
  font-family: inherit;
}
.form-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.form-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.form-input:disabled,
.form-input.readonly {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}
.form-error {
  font-size: 0.75rem;
  color: #ef4444;
  margin-top: 0.25rem;
  display: none;
}
.form-error.visible {
  display: block;
}

/* ─── Toast Notifications ─── */
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: 0.75rem;
  background: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid #e2e8f0;
  font-size: 0.875rem;
  color: #334155;
  min-width: 280px;
  animation: toast-in 0.3s ease-out;
}
.toast.success .toast-icon { color: #22c55e; }
.toast.error .toast-icon { color: #ef4444; }
.toast.info .toast-icon { color: #3b82f6; }

.toast-icon { font-size: 1.25rem; flex-shrink: 0; }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ─── Modal Animation ─── */
#modal-overlay.open #modal-container {
  transform: scale(1);
  opacity: 1;
}

/* ─── Negative balance highlight ─── */
.negative-balance {
  color: #ef4444 !important;
  font-weight: 600;
}
.positive-balance {
  color: #22c55e !important;
  font-weight: 600;
}

/* ─── Autocomplete Dropdown ─── */
.autocomplete-wrap {
  position: relative;
}
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  max-height: 200px;
  overflow-y: auto;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.05);
  z-index: 100;
  animation: ac-fade-in 0.15s ease-out;
}
@keyframes ac-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.ac-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  transition: background 0.1s;
}
.ac-option:first-child { border-radius: 0.75rem 0.75rem 0 0; }
.ac-option:last-child { border-radius: 0 0 0.75rem 0.75rem; }
.ac-option:hover,
.ac-option.ac-active {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
}
.ac-option-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
}
.ac-option-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-left: auto;
}

/* ─── Responsive ─── */
@media (max-width: 1023px) {
  .sidebar-panel {
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.1);
  }
  .sidebar-panel.open {
    transform: translateX(0) !important;
  }
}
