/**
 * TendPOS Storefront Custom Styles
 */

/* CSS Variables for Dynamic Theming */
:root {
  /* Primary Colors - Default purple theme */
  --color-primary: #7c3aed;
  --color-primary-hover: #6d28d9;
  --color-primary-light: #8b5cf6;
  --color-primary-dark: #5b21b6;

  /* Primary shades for backgrounds and accents */
  --color-primary-50: #f5f3ff;
  --color-primary-100: #ede9fe;
  --color-primary-200: #ddd6fe;
  --color-primary-300: #c4b5fd;
  --color-primary-400: #a78bfa;
  --color-primary-500: #8b5cf6;
  --color-primary-600: #7c3aed;
  --color-primary-700: #6d28d9;
  --color-primary-800: #5b21b6;
  --color-primary-900: #4c1d95;

  /* Accent color (for gradients) */
  --color-accent: #764ba2;

  /* RGB versions for alpha transparency */
  --color-primary-rgb: 124, 58, 237;
}

/* Safe area insets for notched devices */
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Hide scrollbar but keep functionality */
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Product Card */
.product-card {
  background: white;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-card-image {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  background: #f3f4f6;
}

.product-card-body {
  padding: 1rem;
}

.product-card-title {
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-card-price {
  font-weight: 700;
  color: var(--color-primary);
}

.product-card-compare-price {
  text-decoration: line-through;
  color: #9ca3af;
  font-size: 0.875rem;
  margin-left: 0.5rem;
}

/* Category Pills */
.category-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.category-pill {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.category-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.category-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

/* Quantity Selector */
.quantity-selector {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
}

.quantity-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.quantity-btn:hover {
  background: #f3f4f6;
}

.quantity-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity-value {
  width: 3rem;
  text-align: center;
  font-weight: 600;
  color: #111827;
}

/* Cart Item */
.cart-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-image {
  width: 5rem;
  height: 5rem;
  object-fit: cover;
  border-radius: 0.5rem;
  background: #f3f4f6;
}

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

.cart-item-title {
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.25rem;
}

.cart-item-modifiers {
  font-size: 0.75rem;
  color: #6b7280;
}

.cart-item-price {
  font-weight: 600;
  color: var(--color-primary);
}

/* Modifier Selection */
.modifier-group {
  margin-bottom: 1.5rem;
}

.modifier-group-title {
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

.modifier-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.5rem;
}

.modifier-option:hover {
  border-color: var(--color-primary);
}

.modifier-option.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-50);
}

.modifier-option input {
  accent-color: var(--color-primary);
}

/* Toast Notifications */
.toast {
  padding: 1rem 1.5rem;
  background: #111827;
  color: white;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toast-in 0.3s ease-out;
}

.toast.success {
  background: #059669;
}

.toast.error {
  background: #dc2626;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 0.25rem;
}

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

/* Page Transitions */
.page-enter {
  opacity: 0;
  transform: translateY(10px);
}

.page-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s, transform 0.2s;
}

/* Checkout Steps */
.checkout-steps {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.checkout-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #9ca3af;
}

.checkout-step.active {
  color: var(--color-primary);
  font-weight: 600;
}

.checkout-step.completed {
  color: #059669;
}

.checkout-step-number {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #e5e7eb;
  font-size: 0.75rem;
  font-weight: 600;
}

.checkout-step.active .checkout-step-number {
  background: var(--color-primary);
  color: white;
}

.checkout-step.completed .checkout-step-number {
  background: #059669;
  color: white;
}

/* Form Styles */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

.form-input.error {
  border-color: #dc2626;
}

.form-error {
  font-size: 0.75rem;
  color: #dc2626;
  margin-top: 0.25rem;
}

/* Order Status */
.order-status-tracker {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 2rem 0;
}

.order-status-tracker::before {
  content: '';
  position: absolute;
  top: 1rem;
  left: 2rem;
  right: 2rem;
  height: 2px;
  background: #e5e7eb;
}

.order-status-tracker::after {
  content: '';
  position: absolute;
  top: 1rem;
  left: 2rem;
  height: 2px;
  background: var(--color-primary);
  width: var(--progress, 0%);
  transition: width 0.5s ease-out;
}

.order-status-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.order-status-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #e5e7eb;
  color: #9ca3af;
}

.order-status-step.active .order-status-icon,
.order-status-step.completed .order-status-icon {
  background: var(--color-primary);
  color: white;
}

.order-status-label {
  font-size: 0.75rem;
  color: #6b7280;
  text-align: center;
}

.order-status-step.active .order-status-label {
  color: var(--color-primary);
  font-weight: 600;
}

/* ========================================
   Location Picker Styles
   ======================================== */

.location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.location-card {
  background: white;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
  cursor: pointer;
}

.location-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.location-card.selected {
  border-color: var(--color-primary);
}

.location-card-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.location-card-body {
  padding: 1.5rem;
}

.location-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.location-status.open {
  background: #d1fae5;
  color: #065f46;
}

.location-status.closed {
  background: #fee2e2;
  color: #991b1b;
}

.location-status.closing-soon {
  background: #fef3c7;
  color: #92400e;
}

/* ========================================
   Fulfillment Selector Styles
   ======================================== */

.fulfillment-tabs {
  display: flex;
  gap: 0.5rem;
  background: #f3f4f6;
  padding: 0.25rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.fulfillment-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.fulfillment-tab:hover {
  color: #374151;
}

.fulfillment-tab.active {
  background: white;
  color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fulfillment-tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fulfillment-content {
  background: #f9fafb;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

/* Time Slot Picker */
.time-slot-group {
  margin-bottom: 1rem;
}

.time-slot-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}

.time-slot-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.time-slot-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: white;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.time-slot-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.time-slot-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.time-slot-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   Tip Selector Styles
   ======================================== */

.tip-selector {
  margin-bottom: 1rem;
}

.tip-options {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.tip-btn {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: white;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.tip-btn:hover {
  border-color: var(--color-primary);
}

.tip-btn.active {
  background: var(--color-primary-50);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.tip-btn-amount {
  display: block;
  font-weight: 600;
  font-size: 1rem;
}

.tip-btn-percent {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
}

.tip-btn.active .tip-btn-percent {
  color: var(--color-primary);
}

.tip-custom-input {
  width: 100%;
  padding: 0.75rem 1rem;
  padding-left: 1.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
}

.tip-custom-wrapper {
  position: relative;
}

.tip-custom-wrapper::before {
  content: '$';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
}

/* ========================================
   Order Tracking Styles
   ======================================== */

.tracking-header {
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent, var(--color-primary-dark)));
  border-radius: 0.75rem;
  color: white;
  margin-bottom: 2rem;
}

.tracking-order-number {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-bottom: 0.25rem;
}

.tracking-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  font-weight: 500;
  margin-top: 1rem;
}

.tracking-eta {
  margin-top: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.tracking-details {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tracking-section-title {
  font-weight: 600;
  color: #374151;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Animated status pulse */
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-pulse {
  animation: status-pulse 2s ease-in-out infinite;
}
