/* Custom styles for GrocerPrice */

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

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

/* Smooth dark mode transitions */
html.dark body,
html body {
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* HTMX loading indicator */
.htmx-request .htmx-indicator {
    display: inline;
}
.htmx-indicator {
    display: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 9999px;
}
.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

/* Hide scrollbar utility (for horizontal scroll chips) */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Fade-in-up animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Staggered animation delays */
.delay-100 { animation-delay: 0.1s; opacity: 0; }
.delay-200 { animation-delay: 0.2s; opacity: 0; }
.delay-300 { animation-delay: 0.3s; opacity: 0; }
.delay-400 { animation-delay: 0.4s; opacity: 0; }

/* Product card hover effect */
.product-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.product-card:hover {
    transform: translateY(-2px);
}

/* Subtle pulse for deal badge */
@keyframes subtlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.animate-subtle-pulse {
    animation: subtlePulse 2s ease-in-out infinite;
}

/* Price shimmer animation (for loading states) */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}
.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

/* Active nav link indicator */
.nav-link.active {
    background-color: rgba(16, 185, 129, 0.1);
}
.nav-link.active span {
    color: #059669;
}

/* Mobile filter drawer animation */
#mobile-filter-drawer > div:last-child {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Aspect ratio for product images */
.aspect-square {
    aspect-ratio: 1 / 1;
}

/* Tabular numbers for aligned counts */
.tabular-nums {
    font-variant-numeric: tabular-nums;
}

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

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
    border-radius: 0.5rem;
}

/* Better touch targets on mobile */
@media (max-width: 640px) {
    .product-card {
        -webkit-tap-highlight-color: transparent;
    }
    .product-card:hover {
        transform: none;
    }
    /* Tighter grid gap on very small screens */
    .grid.gap-3 {
        gap: 0.5rem;
    }
}

/* Safe area for bottom sticky bars on iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .sticky.bottom-0 {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* Sort button styles */
.sort-btn {
    color: #9ca3af;
    background: transparent;
}
.sort-btn.active {
    color: #059669;
    background: rgba(16, 185, 129, 0.1);
}
.sort-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.04);
}
.dark .sort-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
}

/* Store chip transitions */
.store-chip {
    transition: all 0.15s ease;
}

/* Mobile nav drawer slide-in */
@keyframes slideRight {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Active mobile nav link */
.mobile-nav-link.active {
    background-color: rgba(16, 185, 129, 0.1);
    color: #059669;
}

/* Pulse animation for user location marker */
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.25; }
    50% { transform: scale(1.5); opacity: 0.1; }
    100% { transform: scale(1); opacity: 0.25; }
}
