/* ==========================================
   BihariMunch v2 — Custom Design System
   Brand: Orange #f97316 / #ea580c / #c2410c
   Fonts: Poppins (heading), Inter (body)
   Tailwind handles utilities; this file owns
   animations, custom components & overrides.
   ========================================== */

/* ─────────────────────────────────────────
   0. BASE / ROOT
───────────────────────────────────────── */
html {
    scroll-behavior: smooth;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* Page-load fade-in */
body {
    animation: pageFadeIn 0.35s ease-out both;
}

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

/* ─────────────────────────────────────────
   1. CUSTOM SCROLLBAR (webkit)
───────────────────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #f97316;
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
    background: #ea580c;
}

/* ─────────────────────────────────────────
   2. KEYFRAMES LIBRARY
───────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0);    }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0);     }
}

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

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

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

@keyframes bounceIn {
    0%   { opacity: 0; transform: scale(0.3);  }
    50%  { opacity: 1; transform: scale(1.05); }
    70%  { transform: scale(0.9);  }
    100% { transform: scale(1);    }
}

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

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

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0  rgba(249,115,22, 0.45); }
    50%       { box-shadow: 0 0 0 14px rgba(249,115,22, 0);   }
}

@keyframes cartPop {
    0%   { transform: scale(1);   }
    35%  { transform: scale(1.6); }
    65%  { transform: scale(0.9); }
    100% { transform: scale(1);   }
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(110%) scale(0.92); }
    to   { opacity: 1; transform: translateX(0)    scale(1);    }
}

@keyframes toastSlideOut {
    to   { opacity: 0; transform: translateX(110%) scale(0.92); }
}

@keyframes marquee {
    0%   { transform: translateX(0);    }
    100% { transform: translateX(-50%); }
}

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

@keyframes flashOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
        height: 0;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

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

/* ─────────────────────────────────────────
   3. SCROLL-REVEAL ANIMATIONS
───────────────────────────────────────── */
.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.65s cubic-bezier(.4,0,.2,1),
                transform 0.65s cubic-bezier(.4,0,.2,1);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-42px);
    transition: opacity 0.65s cubic-bezier(.4,0,.2,1),
                transform 0.65s cubic-bezier(.4,0,.2,1);
}
.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(42px);
    transition: opacity 0.65s cubic-bezier(.4,0,.2,1),
                transform 0.65s cubic-bezier(.4,0,.2,1);
}
.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.84);
    transition: opacity 0.6s cubic-bezier(.4,0,.2,1),
                transform 0.6s cubic-bezier(.4,0,.2,1);
}
.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* Stagger children via CSS custom property --i */
.stagger-children > * {
    transition-delay: calc(var(--i, 0) * 0.09s);
}

/* ─────────────────────────────────────────
   4. DECORATIVE / AMBIENT ANIMATIONS
───────────────────────────────────────── */
.float-slow {
    animation: floatSlow 7s ease-in-out infinite;
}
.float-delayed {
    animation: floatSlow 7s ease-in-out 2.5s infinite;
}

/* CTA pulse glow */
.pulse-glow {
    animation: pulseGlow 2.6s ease-in-out infinite;
}

/* ─────────────────────────────────────────
   5. FLASH / SYSTEM MESSAGES
───────────────────────────────────────── */
.flash-message {
    animation: flashIn 0.3s ease-out both,
               flashOut 0.45s ease-in 4.5s forwards;
}

/* ─────────────────────────────────────────
   6. SKELETON LOADING
───────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e9ebee 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite;
    border-radius: 0.5rem;
}

/* ─────────────────────────────────────────
   7. PRODUCT CARDS
───────────────────────────────────────── */
.product-card {
    transition: transform 0.38s cubic-bezier(.21,1.02,.73,1),
                box-shadow 0.38s ease,
                border-color 0.3s ease;
    will-change: transform;
}
.product-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 22px 44px rgba(249,115,22, 0.13),
                0 8px  18px rgba(0,0,0, 0.07);
}

/* Smooth show/hide on filter */
.product-card.filter-hidden {
    display: none;
}
.product-card.filter-visible {
    animation: fadeInUp 0.38s ease both;
}

/* ─────────────────────────────────────────
   8. PRODUCT IMAGE CAROUSEL
───────────────────────────────────────── */
.card-carousel {
    position: relative;
    overflow: hidden;
}
.card-carousel .carousel-track {
    display: flex;
    transition: transform 0.48s cubic-bezier(.4,0,.2,1);
}
.card-carousel .carousel-track img {
    min-width: 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
}

.carousel-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 5;
    pointer-events: none; /* dots themselves handle pointer in JS */
}
.carousel-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.55);
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
}
.carousel-dots span.active {
    background: #fff;
    transform: scale(1.4);
    box-shadow: 0 0 5px rgba(0,0,0,0.25);
}

/* ─────────────────────────────────────────
   9. CATEGORY FILTER TABS
───────────────────────────────────────── */
.filter-btn {
    transition: background 0.25s ease,
                color 0.25s ease,
                border-color 0.25s ease,
                box-shadow 0.25s ease,
                transform 0.2s ease;
}
.filter-btn:hover:not(.active) {
    transform: translateY(-1px);
}
.filter-btn.active {
    background: #f97316;
    color: #fff;
    border-color: #f97316;
    box-shadow: 0 4px 14px rgba(249,115,22, 0.32);
}

/* ─────────────────────────────────────────
   10. CART BADGE & ADD-TO-CART BUTTON
───────────────────────────────────────── */
.cart-bounce {
    animation: cartPop 0.52s cubic-bezier(.21,1.02,.73,1);
}

.add-cart-btn {
    position: relative;
    overflow: hidden;
    transition: background 0.25s ease,
                transform 0.22s ease,
                box-shadow 0.25s ease;
}
.add-cart-btn:hover {
    transform: translateY(-1px);
}
.add-cart-btn:active {
    transform: scale(0.97);
}

/* Ripple container element (created by JS) */
.add-cart-btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    pointer-events: none;
    transform: scale(0);
    animation: ripple 0.55s linear;
}

/* Loading / adding state */
.add-cart-btn.adding {
    pointer-events: none;
    opacity: 0.72;
}
.add-cart-btn.added {
    background: #16a34a !important;
    border-color: #16a34a !important;
}

/* ─────────────────────────────────────────
   11. TOAST NOTIFICATIONS
───────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    pointer-events: none;
    max-width: calc(100vw - 3rem);
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem 1.15rem;
    border-radius: 0.9rem;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 10px 28px rgba(0,0,0,0.18), 0 3px 8px rgba(0,0,0,0.1);
    pointer-events: auto;
    animation: toastSlideIn 0.42s cubic-bezier(.21,1.02,.73,1) both;
    min-width: 220px;
    max-width: 340px;
    cursor: pointer;
}
.toast.dismissing {
    animation: toastSlideOut 0.3s ease forwards;
}

.toast-success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}
.toast-error {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}
.toast-info {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}
.toast-warning {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.toast i {
    font-size: 1rem;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────
   12. MARQUEE TRUST STRIP
───────────────────────────────────────── */
.marquee-wrapper {
    overflow: hidden;
}
.marquee-inner {
    display: flex;
    width: max-content;
    animation: marquee 28s linear infinite;
}
.marquee-inner:hover {
    animation-play-state: paused;
}

/* ─────────────────────────────────────────
   13. ANIMATED COUNTER
───────────────────────────────────────── */
.counter {
    font-variant-numeric: tabular-nums;
    transition: color 0.2s;
}

/* ─────────────────────────────────────────
   14. NAVBAR
───────────────────────────────────────── */
.nav-link {
    position: relative;
    transition: color 0.2s;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #f97316;
    border-radius: 99px;
    transition: width 0.28s ease;
}
.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}
.nav-link.active {
    color: #ea580c;
    font-weight: 600;
}

/* Mobile menu slide */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(.4,0,.2,1);
}
#mobile-menu.show {
    max-height: 640px;
}

/* Mobile menu overlay */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.menu-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* ─────────────────────────────────────────
   15. SEARCH BAR
───────────────────────────────────────── */
#search-bar {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.32s cubic-bezier(.4,0,.2,1);
}
#search-bar.show {
    max-height: 120px;
}

/* ─────────────────────────────────────────
   16. FORM INPUTS — FOCUS GLOW
───────────────────────────────────────── */
.input-glow {
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input-glow:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249,115,22, 0.18);
    background: #fff;
}

/* Input group — icon left */
.input-group {
    position: relative;
}
.input-group .input-icon {
    position: absolute;
    top: 50%;
    left: 0.875rem;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.2s;
}
.input-group input:focus ~ .input-icon,
.input-group input:focus + .input-icon {
    color: #f97316;
}

/* Password strength bar */
#pwStrengthBar {
    transition: width 0.35s ease, background-color 0.35s ease;
}

/* ─────────────────────────────────────────
   17. TESTIMONIAL SLIDER
───────────────────────────────────────── */
.testimonial-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(.4,0,.2,1);
}
.testimonial-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background 0.25s, transform 0.25s;
    cursor: pointer;
}
.testimonial-dot.active {
    transform: scale(1.35);
}

/* ─────────────────────────────────────────
   18. FAQ ACCORDION
───────────────────────────────────────── */
.faq-question {
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}
.faq-question i.chevron {
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}
.faq-question[aria-expanded="true"] i.chevron {
    transform: rotate(180deg);
}
.faq-question[aria-expanded="true"] {
    background: rgba(249, 115, 22, 0.04);
}
.faq-question[aria-expanded="true"] ~ .faq-answer {
    border-top-color: rgba(249, 115, 22, 0.15);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    transition: max-height 0.38s cubic-bezier(.4,0,.2,1),
                padding 0.3s ease,
                opacity 0.25s ease;
}
.faq-answer.show {
    max-height: 600px;
    padding-top: 0.25rem;
    padding-bottom: 1.25rem;
    opacity: 1;
}

/* ─────────────────────────────────────────
   19. LINE CLAMP UTILITIES
───────────────────────────────────────── */
.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;
}

/* ─────────────────────────────────────────
   20. HERO SECTION
───────────────────────────────────────── */
.hero-animate {
    animation: heroSlideUp 0.72s cubic-bezier(.21,1.02,.73,1) both;
}
.hero-animate-delayed {
    animation: heroSlideUp 0.72s cubic-bezier(.21,1.02,.73,1) 0.2s both;
}

/* ─────────────────────────────────────────
   21. PROFILE DROPDOWN
───────────────────────────────────────── */
#profile-dropdown {
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
#profile-dropdown.hidden {
    opacity: 0;
    transform: scale(0.94) translateY(-6px);
    pointer-events: none;
}
#profile-dropdown:not(.hidden) {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* ─────────────────────────────────────────
   22. CART PAGE
───────────────────────────────────────── */
/* Qty input — hide native spin arrows */
input[type="number"].qty-input {
    -moz-appearance: textfield;
    appearance: textfield;
}
input[type="number"].qty-input::-webkit-inner-spin-button,
input[type="number"].qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Shipping progress */
.shipping-progress-bar {
    transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

/* ─────────────────────────────────────────
   23. ORDER SUMMARY STICKY
───────────────────────────────────────── */
.order-summary-sticky {
    position: sticky;
    top: 5.5rem; /* below fixed navbar */
}

/* ─────────────────────────────────────────
   24. MODAL (addresses / generic)
───────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: pageFadeIn 0.2s ease both;
}
.modal-box {
    background: #fff;
    border-radius: 1.25rem;
    box-shadow: 0 32px 64px rgba(0,0,0,0.22);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.28s cubic-bezier(.21,1.02,.73,1) both;
}

/* ─────────────────────────────────────────
   25. BADGE / TAG CHIP
───────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.5;
}
.badge-orange {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}
.badge-green {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
.badge-red {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* ─────────────────────────────────────────
   26. COUPON INPUT
───────────────────────────────────────── */
.coupon-input:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249,115,22,0.15);
}
.coupon-success {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 3px rgba(22,163,74,0.15) !important;
}
.coupon-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,0.12) !important;
}

/* ─────────────────────────────────────────
   27. RESPONSIVE OVERRIDES
───────────────────────────────────────── */
@media (max-width: 640px) {
    .hero-heading {
        font-size: 2.1rem;
        line-height: 1.18;
    }
    .toast-container {
        right: 1rem;
        left: 1rem;
        max-width: 100%;
    }
    .toast {
        max-width: 100%;
        min-width: unset;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .modal-box {
        border-radius: 0.85rem;
    }
}

/* ─────────────────────────────────────────
   28. PRINT
───────────────────────────────────────── */
@media print {
    header,
    footer,
    .toast-container,
    #mobile-menu,
    .whatsapp-float {
        display: none !important;
    }
    main {
        padding: 0 !important;
    }
    body {
        animation: none;
    }
}
