:root {
  --color-primary: #236591;
  --color-secondary: #915623;
  --color-accent: #23a591;
  --color-dark: #1a4c6e;
  --color-light: #4a8ab9;
  --color-background: #eaeded;
  --color-text: #333333;
  --color-error: #dc3545;
  --color-success: #28a745;
  --color-warning: #ffc107;
}

body {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.text-primary {
  color: var(--color-primary);
}
.text-success {
  color: var(--color-success);
}
.text-error {
  color: var(--color-error);
}
.bg-primary {
  background-color: var(--color-primary);
}
.bg-dark {
  background-color: var(--color-dark);
}

/* Utility additions for admin customers UI */
.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  background-color: var(--color-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(35, 101, 145, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid #d1d5db;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
  border-color: #9ca3af;
  transform: translateY(-1px);
}

.btn-secondary:focus,
.btn-link:focus,
.btn-primary:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.btn-secondary:active {
  transform: translateY(0);
}

.input {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.75rem;
  width: 100%;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background-color: #fff;
}

.input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.select {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.75rem;
  width: 100%;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background-color: #fff;
}

.select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Compact buttons for tight UIs (e.g., quantity steppers) */
.btn-compact {
  padding: 0.375rem 0.5rem;
}

/* Link-style button for subtle actions */
.btn-link {
  background: transparent;
  border: none;
  color: #374151;
  padding: 0.25rem 0.25rem;
}
.btn-link:hover {
  text-decoration: underline;
}

.badge {
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green {
  background-color: #d1fae5;
  color: #065f46;
}
.badge-yellow {
  background-color: #fef3c7;
  color: #92400e;
}
.badge-blue {
  background-color: #dbeafe;
  color: #1e40af;
}

/* Error state helpers */
.border-red-500 {
  border-color: var(--color-error) !important;
}
.input.border-red-500,
.select.border-red-500 {
  border-color: var(--color-error) !important;
}
.input.border-red-500:focus,
.select.border-red-500:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--color-error) inset;
}
.field-error {
  color: var(--color-error);
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
}

.toast {
  background: rgba(17, 24, 39, 0.95);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s ease;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Respect iOS safe area for bottom sticky bars */
.safe-bottom {
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

/* Skeleton */
@keyframes pulse-skeleton {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.35;
  }
  100% {
    opacity: 0.6;
  }
}

.skeleton {
  background: #e5e7eb;
  border-radius: 8px;
  animation: pulse-skeleton 1.5s ease-in-out infinite;
}

/* Product page specific styles */
.quantity-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quantity-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #374151;
}

.quantity-btn:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
  transform: scale(1.05);
}

.quantity-btn:active {
  transform: scale(0.95);
}

.quantity-input {
  width: 4rem;
  height: 2.5rem;
  text-align: center;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.quantity-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Product image gallery */
.product-thumbnail {
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.product-thumbnail:hover {
  transform: scale(1.05);
  border-color: #d1d5db;
}
.price-box {
  position: absolute;
  top: -4px;
  z-index: 20;
  left: 0px;
  font-size: 20px;
  background: white;
  padding: 5px;
  border: 1px solid #236591;
  border-radius: 8px;
  font-weight: 600;
}

.product-thumbnail.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Multi-line clamp utility without Tailwind plugin */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Icon button (compact, 44x44 target with no heavy chrome) */
.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  width: max-content;
  padding: 10px;
}
.icon-btn:hover {
  background: #f9fafb;
}

/* Subtotal update animation */
@keyframes flash-bg {
  0% {
    background-color: #fff7ed;
  }
  100% {
    background-color: transparent;
  }
}
.flash {
  animation: flash-bg 600ms ease-out;
}

/* Responsive improvements */
@media (max-width: 768px) {
  .btn-primary,
  .btn-secondary {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
  }

  .quantity-btn {
    width: 2.25rem;
    height: 2.25rem;
  }

  .quantity-input {
    width: 3.5rem;
    height: 2.25rem;
  }
}
