/* ============================================================
   claymorphism.css — Main design language: cards, buttons,
   inputs, badges, modals, toasts, receipts, print rules.
   ============================================================ */

/* ============ Generic Clay Card ============ */
.clay-card {
  background: var(--grad-clay);
  border: var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-clay-outset);
  transition: var(--ease);
}

.clay-card--hover:hover {
  transform: translateY(-2px);
}

.clay-card--press:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: var(--shadow-clay-pressed);
}

.clay-inset {
  background: var(--bg-base-2);
  border: var(--hairline);
  box-shadow: var(--shadow-clay-inset);
  border-radius: var(--r-md);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: var(--hairline);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: #fff;
  background: var(--grad-clay);
  color: var(--text-primary);
  box-shadow: var(--shadow-clay-outset);
  transition: var(--ease);
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-clay-outset), 0 3px 6px rgba(166, 180, 200, 0.25);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-clay-pressed);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring), var(--shadow-clay-outset);
}

.btn svg { width: 18px; height: 18px; }

.btn--green {
  background: var(--grad-green);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-green-outset);
}

.btn--green:active { box-shadow: var(--shadow-clay-pressed), inset 0 2px 6px rgba(0,0,0,0.2); }

.btn--indigo {
  background: var(--grad-indigo);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-indigo-outset);
}

.btn--red {
  background: var(--grad-red);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-red-outset);
}

.btn--orange {
  background: var(--grad-clay);
  color: var(--accent-orange);
  border-color: rgba(234, 88, 12, 0.3);
  box-shadow: var(--shadow-orange-outset);
}

.btn--sky {
  background: var(--grad-sky);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  box-shadow: none;
  border-color: transparent;
}

.btn--ghost:hover { color: var(--text-primary); }

.btn--sm {
  padding: 7px 14px;
  font-size: 12px;
  border-radius: var(--r-sm);
}

.btn--block { width: 100%; }

.btn--pill { border-radius: var(--r-pill); }

/* Quantity stepper buttons */
.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  border: var(--hairline);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--grad-clay);
  box-shadow: var(--shadow-clay-soft);
  color: var(--accent-indigo);
  transition: var(--ease);
}

.qty-btn:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-clay-pressed);
}

/* ============ Inputs ============ */
.input, .select, .textarea {
  width: 100%;
  padding: 11px 16px;
  border: var(--hairline);
  border-radius: var(--r-md);
  background: var(--bg-base-2);
  box-shadow: var(--shadow-clay-inset);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--ease);
  outline: none;
  appearance: none;
}

.input::placeholder { color: var(--text-faint); }

.input:focus, .select:focus, .textarea:focus {
  box-shadow: var(--ring), var(--shadow-clay-inset);
}

.input--search {
  padding-left: 42px;
  font-size: 15px;
}

.select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============ Product Card ============ */
.product-card {
  background: var(--grad-clay);
  border: var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-clay-outset);
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: var(--ease);
  text-align: left;
  font-family: inherit;
  color: inherit;
  width: 100%;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-clay-outset), 0 6px 12px rgba(166, 180, 200, 0.2);
}

.product-card:active {
  transform: translateY(0) scale(0.99);
}

.product-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.product-img {
  height: 84px;
  border-radius: var(--r-sm);
  background: var(--grad-clay);
  box-shadow: var(--shadow-clay-inset);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-faint);
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-img i.fa-solid {
  font-size: 30px;
}

.product-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
}

.product-sku {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.price-badge {
  font-weight: 700;
  font-size: 15px;
  color: var(--accent-indigo-deep);
}

/* ============ Badges ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-sky-soft);
  color: var(--accent-sky);
  white-space: nowrap;
  border: var(--hairline);
}

.badge--green { background: var(--accent-green-soft); color: var(--accent-green-deep); }
.badge--red { background: var(--accent-red-soft); color: var(--accent-red-deep); }
.badge--amber { background: var(--accent-amber-soft); color: var(--accent-amber); }
.badge--indigo { background: var(--accent-indigo-soft); color: var(--accent-indigo-deep); }
.badge--outline {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.4);
  color: var(--text-muted);
}

/* Stock badge color logic */
.badge--stock.ok { background: var(--accent-green-soft); color: var(--accent-green-deep); }
.badge--stock.low { background: var(--accent-amber-soft); color: var(--accent-amber); }
.badge--stock.empty { background: var(--accent-red-soft); color: var(--accent-red-deep); }

/* ============ Platform Admin Console ============ */
.console-panel { display: none; }
.console-panel.active { display: block; }

.console-tab.active {
  background: var(--accent-indigo-soft);
  color: var(--accent-indigo-deep);
  box-shadow: var(--shadow-clay-pressed), inset 0 2px 4px rgba(0,0,0,0.15);
}

.empty-row {
  text-align: center;
  color: var(--text-faint);
  padding: 28px 12px !important;
  font-size: 13px;
}

/* ============ Cart Item Row ============ */
.cart-item {
  background: var(--grad-clay);
  border: var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-clay-soft);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: cartIn 0.18s ease-out;
}

@keyframes cartIn {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: translateX(0); }
}

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 600;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-item-qty span {
  font-weight: 700;
  font-size: 13px;
  min-width: 22px;
  text-align: center;
}

.cart-item-subtotal {
  font-weight: 700;
  font-size: 13px;
  min-width: 56px;
  text-align: right;
  color: var(--text-primary);
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: var(--hairline);
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--grad-clay);
  box-shadow: var(--shadow-clay-soft);
  color: var(--text-muted);
  transition: var(--ease);
}

.icon-btn:hover { color: var(--accent-red); }
.icon-btn:active { transform: translateY(1px); box-shadow: var(--shadow-clay-pressed); }

.icon-btn svg { width: 16px; height: 16px; }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 41, 59, 0.35);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-in-out;
  padding: 20px;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--grad-clay);
  border: var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-clay-outset), 0 24px 48px rgba(30, 41, 59, 0.25);
  padding: 26px;
  transform: translateY(16px) scale(0.98);
  transition: all 0.2s ease-in-out;
}

.modal--wide { max-width: 620px; }

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: none;
  background: var(--grad-clay);
  box-shadow: var(--shadow-clay-soft);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--ease);
}

.modal-close:hover { color: var(--accent-red); }

.modal-body { display: flex; flex-direction: column; gap: 14px; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.table-wrap {
  max-height: 340px;
  overflow-y: auto;
  border: var(--hairline);
  border-radius: var(--r-md);
  background: var(--bg-base-1);
}

.table-wrap .data-table { border-spacing: 0 4px; }
.table-wrap th { padding: 8px 10px; }
.table-wrap td { padding: 7px 10px; }

/* Checkout quick cash buttons */
.quick-cash {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-cash .btn {
  flex: 1;
  min-width: 84px;
  padding: 9px 10px;
  font-size: 13px;
}

/* Change display */
.change-display {
  text-align: center;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--bg-base-2);
  box-shadow: var(--shadow-clay-inset);
}

.change-display .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

.change-display .value {
  font-size: 30px;
  font-weight: 800;
  margin-top: 4px;
  letter-spacing: -0.02em;
}

.change-display .value.negative { color: var(--accent-red); }
.change-display .value.positive { color: var(--accent-green-deep); }

/* ============ Toast ============ */
.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--grad-clay);
  box-shadow: var(--shadow-clay-outset);
  border-radius: var(--r-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  min-width: 240px;
  max-width: 340px;
  animation: toastIn 0.25s ease-out;
  border-left: 4px solid var(--accent-sky);
}

.toast--success { border-left-color: var(--accent-green); }
.toast--error { border-left-color: var(--accent-red); }
.toast--warn { border-left-color: var(--accent-amber); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.out {
  opacity: 0;
  transform: translateX(24px);
  transition: all 0.25s ease-in-out;
}

/* ============ Form modal layout ============ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid .span-2 { grid-column: span 2; }

.upload-preview {
  width: 84px;
  height: 84px;
  border-radius: var(--r-md);
  background: var(--bg-base-2);
  box-shadow: var(--shadow-clay-inset);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-faint);
  cursor: pointer;
}

.upload-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ============ Held orders list ============ */
.held-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.held-item {
  background: var(--grad-clay);
  border: var(--hairline);
  box-shadow: var(--shadow-clay-soft);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ============ Scrollbars ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.7); }

/* ============ Utility ============ */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.grow { flex: 1; min-width: 0; }

/* ============ Receipt (print only) ============ */
.receipt-sheet {
  display: none;
}

@media print {
  body > *:not(.receipt-sheet) { display: none !important; }
  body { background: #fff; }
  .receipt-sheet { display: block !important; }
  .receipt {
    width: 80mm;
    margin: 0 auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #000;
    line-height: 1.35;
  }
  .receipt .r-center { text-align: center; }
  .receipt .r-line { border-top: 1px dashed #000; margin: 6px 0; }
  .receipt .r-head { text-align: center; margin-bottom: 8px; }
  .receipt .r-head .name { font-size: 16px; font-weight: 700; }
  .receipt .r-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }
  .receipt .r-qty {
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
  }
  .receipt .r-total-row {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 13px;
  }
  .receipt .r-barcode {
    text-align: center;
    letter-spacing: 2px;
    margin: 8px 0;
  }
  .receipt .r-footer { text-align: center; margin-top: 8px; font-size: 11px; }
}


/* ============ Toggle switch ============ */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .track {
  width: 46px;
  height: 26px;
  border-radius: var(--r-pill);
  background: var(--bg-base-2);
  box-shadow: var(--shadow-clay-inset);
  position: relative;
  transition: var(--ease);
  flex-shrink: 0;
  border: var(--hairline);
}

.switch .track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--grad-clay);
  box-shadow: var(--shadow-clay-soft);
  transition: all 0.2s ease-in-out;
}

.switch input:checked + .track {
  background: var(--grad-green);
  border-color: rgba(255,255,255,0.2);
}

.switch input:checked + .track::after {
  left: 23px;
}

.switch .switch-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============ Permission checklist ============ */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.perm-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--grad-clay);
  border: var(--hairline);
  box-shadow: var(--shadow-clay-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  transition: var(--ease);
}

.perm-chip:hover { transform: translateY(-1px); }

.perm-chip input {
  accent-color: var(--accent-indigo);
  width: 16px;
  height: 16px;
}

.perm-chip.disabled { opacity: 0.55; cursor: not-allowed; }

/* ============ Role badge ============ */
.role-badge { text-transform: capitalize; }
