/* Stars 'n' Stripes Foods - Shared Components CSS */
/* Use with Tailwind CDN */

/* ============================================
   ANIMATIONS & KEYFRAMES
   ============================================ */

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* ============================================
   UTILITY CLASSES
   ============================================ */

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-fade-in-up {
  animation: fadeInUp 0.4s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

.animate-slide-in-up {
  animation: slideInUp 0.3s ease-out;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-bounce {
  animation: bounce 0.5s ease-in-out;
}

.animate-scale-in {
  animation: scaleIn 0.2s ease-out;
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* ============================================
   BUTTON STYLES
   ============================================ */

.btn-press {
  transition: transform 0.1s ease;
}

.btn-press:active {
  transform: scale(0.97);
}

/* Loading spinner for buttons */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ============================================
   CARD EFFECTS
   ============================================ */

.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* ============================================
   FORM ELEMENTS
   ============================================ */

/* Custom focus ring */
.input-focus {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-focus:focus {
  outline: none;
  border-color: #fdba74;
  box-shadow: 0 0 0 3px rgba(253, 186, 116, 0.3);
}

/* ============================================
   MOBILE BOTTOM SHEET
   ============================================ */

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  z-index: 50;
  max-height: 85vh;
  overflow-y: auto;
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: #d1d5db;
  border-radius: 999px;
  margin: 12px auto;
}

/* ============================================
   OVERLAY / BACKDROP
   ============================================ */

.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  z-index: 40;
  pointer-events: none;
}

.overlay-backdrop.open {
  background: rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

/* ============================================
   BADGE ANIMATIONS
   ============================================ */

.badge-pulse {
  animation: pulse 0.5s ease-in-out;
}

/* Live indicator dot */
.live-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* ============================================
   QUANTITY CONTROLS
   ============================================ */

.qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: #f3f4f6;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.qty-btn:hover {
  background: #e5e7eb;
}

.qty-btn:active {
  transform: scale(0.9);
  background: #d1d5db;
}

/* ============================================
   CUSTOM SCROLLBAR (webkit)
   ============================================ */

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* ============================================
   SAFE AREA (for mobile notches)
   ============================================ */

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.safe-area-top {
  padding-top: env(safe-area-inset-top, 0);
}

/* ============================================
   TOUCH TARGET (accessibility)
   ============================================ */

.touch-target {
  min-width: 44px;
  min-height: 44px;
}

/* ============================================
   ENHANCED MICRO-INTERACTIONS
   ============================================ */

/* Ripple effect for buttons */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.4s, opacity 0.8s;
}

.btn-ripple:active::after {
  transform: scale(0, 0);
  opacity: 1;
  transition: 0s;
}

/* Success flash animation */
@keyframes successFlash {
  0% { background-color: inherit; }
  50% { background-color: rgba(34, 197, 94, 0.2); }
  100% { background-color: inherit; }
}

.animate-success-flash {
  animation: successFlash 0.6s ease-out;
}

/* Error shake animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

/* Slide out left (for removing items) */
@keyframes slideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-100%);
  }
}

.animate-slide-out-left {
  animation: slideOutLeft 0.3s ease-out forwards;
}

/* Pop in animation */
@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-pop-in {
  animation: popIn 0.3s ease-out;
}

/* Number tick animation */
@keyframes numberTick {
  0% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

.animate-number-tick {
  animation: numberTick 0.2s ease-out;
}

/* Glow pulse for highlights */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 31, 0); }
  50% { box-shadow: 0 0 0 8px rgba(255, 90, 31, 0.2); }
}

.animate-glow-pulse {
  animation: glowPulse 1s ease-in-out;
}

/* Status badge transition */
.status-badge {
  transition: all 0.3s ease;
}

.status-badge.status-changed {
  animation: popIn 0.3s ease-out;
}

/* Staggered children animation */
.stagger-children > * {
  opacity: 0;
  animation: fadeInUp 0.4s ease-out forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.5s; }

/* Cart item animations */
.cart-item {
  transition: all 0.3s ease;
}

.cart-item.adding {
  animation: slideInRight 0.3s ease-out;
}

.cart-item.removing {
  animation: slideOutLeft 0.3s ease-out forwards;
}

.cart-item.quantity-changed {
  animation: successFlash 0.3s ease-out;
}

/* Toast notification */
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.toast {
  animation: toastSlideIn 0.3s ease-out;
}

.toast.hiding {
  animation: toastSlideOut 0.3s ease-out forwards;
}

/* Modal animations */
@keyframes modalBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalContentIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-backdrop {
  animation: modalBackdropIn 0.2s ease-out;
}

.modal-content {
  animation: modalContentIn 0.3s ease-out;
}

/* Mobile modal (slides up) */
@media (max-width: 640px) {
  .modal-content-mobile {
    animation: slideInUp 0.3s ease-out;
  }
}

/* Add to cart button feedback */
.add-to-cart-btn {
  transition: all 0.2s ease;
}

.add-to-cart-btn:active {
  transform: scale(0.95);
}

.add-to-cart-btn.added {
  animation: popIn 0.3s ease-out;
}

/* Price update animation */
@keyframes priceUpdate {
  0% {
    transform: scale(1);
    color: inherit;
  }
  50% {
    transform: scale(1.1);
    color: #ff5a1f;
  }
  100% {
    transform: scale(1);
    color: inherit;
  }
}

.animate-price-update {
  animation: priceUpdate 0.4s ease-out;
}

/* Checkmark draw animation */
@keyframes checkmarkDraw {
  0% {
    stroke-dashoffset: 24;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.checkmark-animated {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: checkmarkDraw 0.4s ease-out 0.2s forwards;
}

/* Order card highlight on new order */
@keyframes newOrderHighlight {
  0% {
    background-color: rgba(255, 90, 31, 0.1);
    border-color: #ff5a1f;
  }
  100% {
    background-color: transparent;
    border-color: #e7e5e4;
  }
}

.order-card-new {
  animation: newOrderHighlight 2s ease-out;
}

/* Hover lift effect */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* Button icon spin on hover */
.btn-icon-spin:hover svg {
  animation: spin 0.5s ease-in-out;
}

/* Subtle float animation for specials */
@keyframes subtleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.animate-float {
  animation: subtleFloat 3s ease-in-out infinite;
}

/* Badge count bump */
@keyframes badgeBump {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.badge-bump {
  animation: badgeBump 0.3s ease-out;
}

/* Focus ring animation */
.focus-ring-animated:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.3);
  animation: glowPulse 0.5s ease-out;
}

/* Loading dots animation */
@keyframes loadingDots {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.loading-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background-color: currentColor;
  border-radius: 50%;
  animation: loadingDots 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* ============================================
   ENHANCED UX - QUICK WINS
   ============================================ */

/* Image hover zoom effect */
.img-zoom {
  transition: transform 0.3s ease;
  overflow: hidden;
}

.img-zoom:hover img,
.img-zoom:hover .img-placeholder {
  transform: scale(1.1);
}

.img-zoom img,
.img-zoom .img-placeholder {
  transition: transform 0.3s ease;
}

/* Flying cart animation */
@keyframes flyToCart {
  0% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
  50% {
    opacity: 0.8;
    transform: scale(0.5) translate(50px, -50px);
  }
  100% {
    opacity: 0;
    transform: scale(0.2) translate(100px, -100px);
  }
}

.fly-to-cart {
  animation: flyToCart 0.6s ease-in-out forwards;
  position: fixed;
  z-index: 9999;
  pointer-events: none;
}

/* Confetti animation */
@keyframes confetti-fall {
  0% {
    transform: translateY(-100%) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: 9999;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  width: 100%;
  height: 100%;
  animation: confetti-fall 3s ease-in-out forwards;
}

/* Success celebration overlay */
@keyframes celebrationPulse {
  0% { transform: scale(1); opacity: 0; }
  50% { transform: scale(1.5); opacity: 0.3; }
  100% { transform: scale(2); opacity: 0; }
}

.celebration-ring {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  margin: -50px 0 0 -50px;
  border-radius: 50%;
  border: 4px solid #ff5a1f;
  animation: celebrationPulse 0.8s ease-out forwards;
  pointer-events: none;
  z-index: 9998;
}

/* Popular badge pulse */
@keyframes popularPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 31, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(255, 90, 31, 0); }
}

.badge-popular {
  animation: popularPulse 2s ease-in-out infinite;
}

/* Empty cart illustration bounce */
@keyframes emptyCartBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty-cart-icon {
  animation: emptyCartBounce 2s ease-in-out infinite;
}

/* Skeleton loader with better styling */
.skeleton-card {
  background: linear-gradient(90deg, #f5f5f4 25%, #e7e5e4 50%, #f5f5f4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
}

/* Add button success state */
@keyframes addSuccess {
  0% { background-color: #ff5a1f; }
  50% { background-color: #22c55e; }
  100% { background-color: #ff5a1f; }
}

.add-btn-success {
  animation: addSuccess 0.6s ease-out;
}

/* Cart item slide in with bounce */
@keyframes slideInBounce {
  0% {
    opacity: 0;
    transform: translateX(30px);
  }
  60% {
    transform: translateX(-5px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.cart-item-new {
  animation: slideInBounce 0.4s ease-out;
}

/* ============================================
   TEXT UTILITIES (line-clamp)
   ============================================ */

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
