/* ============ Custom Styles ============ */

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

/* Safe Area */
.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* Animations */
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
@keyframes slideLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes progress {
    from { width: 0%; }
    to { width: 100%; }
}

.animate-slide-up { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.animate-slide-down { animation: slideDown 0.3s ease-out; }
.animate-slide-right { animation: slideRight 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.animate-slide-left { animation: slideLeft 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }
.animate-scale-in { animation: scaleIn 0.3s ease-out forwards; }
.animate-pulse-slow { animation: pulse-slow 2s ease-in-out infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* Staggered Animation */
.stagger-item { opacity: 0; animation: fadeIn 0.4s ease-out forwards; }
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }
.stagger-item:nth-child(9) { animation-delay: 0.45s; }
.stagger-item:nth-child(10) { animation-delay: 0.5s; }

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
.dark .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

/* Nav Items */
.nav-item { color: #64748b; }
.nav-item.active { color: #F57C00; }
.nav-item.active span { font-weight: 700; }

/* Category Scrollbar */
.category-scroll::-webkit-scrollbar { display: none; }
.category-scroll { -ms-overflow-style: none; scrollbar-width: none; }

/* Card Hover Effects */
.card-hover {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}
.dark .card-hover:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

/* Product Card */
.product-card {
    transition: all 0.25s ease;
}
.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}
.dark .product-card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* Promo Badge */
.promo-badge {
    background: linear-gradient(135deg, #F44336, #FF9800);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
}

/* Status Indicators */
.status-preparing { background: #FEF3C7; color: #D97706; }
.status-delivering { background: #DBEAFE; color: #2563EB; }
.status-delivered { background: #D1FAE5; color: #059669; }
.status-cancelled { background: #FEE2E2; color: #DC2626; }

/* Progress Steps */
.step-active { border-color: #F57C00; background: #F57C00; color: white; }
.step-completed { border-color: #059669; background: #059669; color: white; }
.step-pending { border-color: #e2e8f0; background: white; color: #94a3b8; }

/* RTL Support */
[dir="rtl"] .animate-slide-right { animation-name: slideLeft; }
[dir="rtl"] .rtl-flip { transform: scaleX(-1); }

/* Custom Gradient Texts */
.gradient-text {
    background: linear-gradient(135deg, #F57C00, #F44336);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Map placeholder */
.map-placeholder {
    background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
    position: relative;
    overflow: hidden;
}
.dark .map-placeholder {
    background: linear-gradient(135deg, #1e293b, #334155);
}
.map-placeholder::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 40px,
        rgba(0,0,0,0.03) 40px,
        rgba(0,0,0,0.03) 41px
    ),
    repeating-linear-gradient(
        90deg,
        transparent,
        transparent 40px,
        rgba(0,0,0,0.03) 40px,
        rgba(0,0,0,0.03) 41px
    );
}

/* Bottom Sheet */
.bottom-sheet {
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 60px rgba(0,0,0,0.15);
}

/* Image Overlay Gradient */
.img-overlay {
    position: relative;
}
.img-overlay::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    border-radius: inherit;
}

/* Quantity Button */
.qty-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.15s;
}
.qty-btn:active {
    transform: scale(0.9);
}

/* Rating Stars */
.star-filled { color: #FBBF24; }
.star-empty { color: #D1D5DB; }

/* Page transitions */
.page-enter {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(245, 124, 0, 0.4);
    z-index: 30;
    transition: all 0.3s;
}
.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(245, 124, 0, 0.5);
}

/* Tag Chip */
.tag-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    cursor: pointer;
}
.tag-chip:hover {
    transform: scale(1.02);
}
.tag-chip.active {
    background: linear-gradient(135deg, #F57C00, #EF6C00);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 124, 0, 0.3);
}

/* Delivery Tracking Dot */
.tracking-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    position: relative;
}
.tracking-dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0.3;
}
.tracking-dot.active {
    animation: pulse-slow 1.5s ease-in-out infinite;
}

/* Rating Display */
.rating-display {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}
.rating-green { background: #D1FAE5; color: #059669; }
.rating-yellow { background: #FEF3C7; color: #D97706; }
.rating-red { background: #FEE2E2; color: #DC2626; }

/* Switch Toggle */
.switch {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}
.switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 10px;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch.active {
    background: #F57C00;
}
.switch.active::after {
    transform: translateX(20px);
}

/* Horizontal Category Scroll */
.h-scroll-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.h-scroll-container > * {
    scroll-snap-align: start;
    flex-shrink: 0;
}