/* Magadi Farm Fresh — Custom Styles */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hero background pattern */
.hero-bg {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(74, 124, 89, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(196, 98, 45, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 60% 80%, rgba(74, 124, 89, 0.15) 0%, transparent 40%);
}

/* Product card styles */
.product-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(61, 43, 31, 0.1);
}

.product-card .product-image {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: 1rem 1rem 0 0;
}

.product-card .product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card .product-image .emoji-fallback {
  font-size: 3.5rem;
  line-height: 1;
}

/* Stock progress bar */
.stock-bar {
  height: 4px;
  border-radius: 2px;
  background: #e5e5e5;
  overflow: hidden;
}

.stock-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

/* Quantity selector */
.qty-selector {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid rgba(61, 43, 31, 0.15);
  border-radius: 0.75rem;
  overflow: hidden;
}

.qty-selector button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
  color: #3d2b1f;
}

.qty-selector button:hover:not(:disabled) {
  background: rgba(61, 43, 31, 0.05);
}

.qty-selector button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.qty-selector .qty-value {
  width: 32px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  border-left: 1px solid rgba(61, 43, 31, 0.1);
  border-right: 1px solid rgba(61, 43, 31, 0.1);
  padding: 0.5rem 0;
}

/* Stock badge */
.stock-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.stock-badge.available {
  background: rgba(74, 124, 89, 0.1);
  color: #4a7c59;
}

.stock-badge.low {
  background: rgba(196, 98, 45, 0.1);
  color: #c4622d;
}

.stock-badge.out {
  background: rgba(200, 50, 50, 0.1);
  color: #c83232;
}

/* Admin stock card */
.admin-stock-card {
  background: white;
  border: 1px solid rgba(61, 43, 31, 0.08);
  border-radius: 1rem;
  padding: 1rem;
  transition: box-shadow 0.2s;
}

.admin-stock-card:hover {
  box-shadow: 0 4px 15px rgba(61, 43, 31, 0.08);
}

.admin-stock-card .stock-display {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.admin-stock-card .stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid rgba(61, 43, 31, 0.15);
  border-radius: 0.5rem;
  overflow: hidden;
}

.admin-stock-card .stepper button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s;
}

.admin-stock-card .stepper button:hover {
  background: rgba(61, 43, 31, 0.05);
}

.admin-stock-card .stepper input {
  width: 50px;
  text-align: center;
  border: none;
  border-left: 1px solid rgba(61, 43, 31, 0.1);
  border-right: 1px solid rgba(61, 43, 31, 0.1);
  padding: 0.35rem 0;
  font-weight: 600;
  font-size: 0.85rem;
  background: transparent;
  -moz-appearance: textfield;
}

.admin-stock-card .stepper input::-webkit-inner-spin-button,
.admin-stock-card .stepper input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: #d1d5db;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.toggle-switch.active {
  background: #4a7c59;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.active::after {
  transform: translateX(20px);
}

/* Admin tabs */
.admin-tab {
  color: rgba(250, 246, 239, 0.5);
  border-color: transparent !important;
  transition: color 0.2s, border-color 0.2s;
}

.admin-tab:hover {
  color: rgba(250, 246, 239, 0.8);
}

.admin-tab.active {
  color: #faf6ef;
  border-color: #c4622d !important;
}

/* Order status badges */
.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  text-transform: capitalize;
}

.status-badge.new {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.status-badge.confirmed {
  background: rgba(74, 124, 89, 0.1);
  color: #4a7c59;
}

.status-badge.delivered {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
}

/* Toast animation */
.toast.show {
  transform: translateX(0) !important;
}

/* Floating cart bar animation */
.cart-visible {
  transform: translateY(0) !important;
}

/* Order modal / success modal */
.modal-flex {
  display: flex;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(61, 43, 31, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(61, 43, 31, 0.25);
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .product-card .product-image .emoji-fallback {
    font-size: 2.5rem;
  }

  #admin-dashboard table {
    font-size: 0.8rem;
  }

  #admin-dashboard table th,
  #admin-dashboard table td {
    padding: 0.5rem;
  }
}

/* Image placeholder shimmer */
.img-placeholder {
  background: linear-gradient(90deg, #f0ece5 25%, #e8e3da 50%, #f0ece5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(250, 246, 239, 0.3);
  border-top-color: #faf6ef;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
