/* ==========================================================================
   AROMA CAFÉ - ADMIN FOOD ITEMS & AVAILABILITY MANAGEMENT STYLES
   Ultra-clean modern SaaS design with iOS-inspired toggle switches
   ========================================================================== */

.admin-products-wrap {
  flex: 1 1 0% !important;
  height: calc(100vh - 64px) !important;
  max-height: calc(100vh - 64px) !important;
  overflow-y: scroll !important; /* Forces scroll bar to always be present on the right side */
  overflow-x: hidden !important;
  scroll-behavior: smooth !important;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
  box-sizing: border-box !important;
  padding: 24px 32px 80px !important;
  max-width: 1400px;
  margin: 0 auto;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
}

/* Custom visible scrollbar on the right side for Items page */
.admin-products-wrap::-webkit-scrollbar {
  width: 10px !important;
  display: block !important;
}
.admin-products-wrap::-webkit-scrollbar-track {
  background: #f1f5f9 !important;
  border-radius: 6px !important;
}
.admin-products-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
  border-radius: 6px !important;
  border: 2px solid #f1f5f9 !important;
}
.admin-products-wrap::-webkit-scrollbar-thumb:hover {
  background: #94a3b8 !important;
}

/* Ensure layout containers allow scrolling for Items page */
body:has(.admin-products-wrap) main,
body:has(.admin-products-wrap) .flex-1.overflow-hidden,
body:has(.admin-products-wrap) .layout-bg main {
  overflow-y: auto !important;
}

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

.ap-title-group h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #0f172a;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ap-title-icon {
  width: 28px;
  height: 28px;
  color: #0f172a;
}

.ap-subtitle {
  font-size: 13.5px;
  color: #64748b;
  margin: 0;
}

.ap-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ap-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #000000;
  color: #ffffff !important;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  border: 1px solid #000000;
}

.ap-btn-primary:hover {
  background: #27272a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.ap-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: #334155 !important;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ap-btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a !important;
}

/* KPI Summary Cards */
.ap-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .ap-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.ap-kpi-card {
  background: #ffffff;
  border: 1px solid #eaedf0;
  border-radius: 16px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.ap-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.ap-kpi-info h3 {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin: 0 0 6px 0;
}

.ap-kpi-val {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
  line-height: 1;
}

.ap-kpi-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9999px;
}

.ap-kpi-card.is-total .ap-kpi-pill {
  background: #f1f5f9;
  color: #475569;
}

.ap-kpi-card.is-available .ap-kpi-pill {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.ap-kpi-card.is-soldout .ap-kpi-pill {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.ap-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.ap-dot.is-green {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.ap-dot.is-red {
  background: #f43f5e;
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.6);
}

/* Filter Toolbar */
.ap-toolbar {
  background: #ffffff;
  border: 1px solid #eaedf0;
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.ap-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 280px;
}

.ap-search-box {
  position: relative;
  flex: 1;
  max-width: 320px;
  min-width: 200px;
}

.ap-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.ap-search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13.5px;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.ap-search-input:focus {
  background: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.ap-select {
  padding: 9px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13.5px;
  color: #0f172a;
  background: #f8fafc;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ap-select:focus {
  background: #ffffff;
  border-color: #0f172a;
}

/* Status Filter Tabs */
.ap-status-tabs {
  display: inline-flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  gap: 2px;
}

.ap-status-tab {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ap-status-tab:hover {
  color: #0f172a;
}

.ap-status-tab.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Items Table */
.ap-table-wrap {
  background: #ffffff;
  border: 1px solid #eaedf0;
  border-radius: 16px;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.ap-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.ap-table th {
  background: #fafbfc;
  padding: 13px 18px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  border-bottom: 1px solid #eaedf0;
}

.ap-table td {
  padding: 14px 18px;
  font-size: 13.5px;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.ap-table tr:last-child td {
  border-bottom: none;
}

.ap-table tr:hover td {
  background: #fbfcfd;
}

/* Product Info Cell */
.ap-product-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ap-product-img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: #f1f5f9;
  border: 1px solid #eef2f6;
  flex-shrink: 0;
}

.ap-product-info {
  display: flex;
  flex-direction: column;
}

.ap-product-name {
  font-weight: 700;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.25;
}

.ap-product-sku {
  font-size: 11.5px;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  margin-top: 2px;
}

/* Category Badge */
.ap-category-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

/* Price & Cost */
.ap-price {
  font-weight: 700;
  color: #0f172a;
  font-size: 14px;
}

.ap-cost {
  font-size: 13px;
  color: #64748b;
}

/* Waiter Availability Status Column & Toggle */
.ap-status-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ap-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 9999px;
  white-space: nowrap;
}

.ap-status-badge.is-available {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.ap-status-badge.is-soldout {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

/* iOS Toggle Switch in Table */
.ap-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.ap-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ap-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 9999px;
}

.ap-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ap-toggle-switch input:checked + .ap-toggle-slider {
  background-color: #10b981;
}

.ap-toggle-switch input:checked + .ap-toggle-slider:before {
  transform: translateX(20px);
}

.ap-toggle-switch.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Actions Cell */
.ap-actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ap-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.ap-action-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.ap-action-btn.is-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* Pagination Footer */
.ap-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #fafbfc;
  border-top: 1px solid #eaedf0;
  font-size: 13px;
  color: #64748b;
}

.ap-page-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ap-page-btn {
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ap-page-btn:hover:not(:disabled) {
  background: #f1f5f9;
  color: #0f172a;
}

.ap-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Delete Modal */
.ap-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: apFadeIn 0.15s ease-out;
}

.ap-modal-card {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.ap-modal-icon {
  width: 52px;
  height: 52px;
  background: #fef2f2;
  color: #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.ap-modal-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px 0;
}

.ap-modal-card p {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.ap-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.ap-btn-cancel {
  padding: 10px 20px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

.ap-btn-delete-confirm {
  padding: 10px 20px;
  background: #ef4444;
  color: #ffffff;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

.ap-btn-delete-confirm:hover {
  background: #dc2626;
}

/* Toast */
.ap-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 9999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ap-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes apFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
