/* ==============================================
   NONGOR - ADVANCED UI POLISH & ANIMATIONS
   ============================================== */

/* ===== CUSTOM KEYFRAME ANIMATIONS ===== */

/* Fade In Up - For staggered content */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Scale - For modals and cards */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Subtle Float - For hero elements */
@keyframes subtleFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Shimmer Effect - For loading states and highlights */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Pulse Glow - For CTAs and important buttons */
@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(224, 122, 95, 0.4);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(224, 122, 95, 0);
    }
}

/* Slide In Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Bounce In */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate In */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0);
    }

    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

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

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

.animate-fade-in-scale {
    animation: fadeInScale 0.4s ease-out forwards;
}

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

.animate-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

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

.animate-slide-in-left {
    animation: slideInLeft 0.5s ease-out forwards;
}

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

.animate-bounce-in {
    animation: bounceIn 0.6s ease-out forwards;
}

.animate-rotate-in {
    animation: rotateIn 0.5s ease-out forwards;
}

/* Staggered animation delays - elements start hidden, then animate in */
.anim-delay-1 {
    animation-delay: 0.1s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.anim-delay-2 {
    animation-delay: 0.2s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.anim-delay-3 {
    animation-delay: 0.3s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.anim-delay-4 {
    animation-delay: 0.4s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.anim-delay-5 {
    animation-delay: 0.5s;
    opacity: 0;
    animation-fill-mode: forwards;
}

/* ===== GLASSMORPHISM EFFECTS ===== */

.glass {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-dark {
    background: rgba(61, 64, 91, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-light {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ===== PREMIUM BUTTON EFFECTS ===== */

.btn-premium {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-premium:hover::before {
    left: 100%;
}

.btn-premium:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(224, 122, 95, 0.3);
}

.btn-premium:active {
    transform: translateY(-1px);
}

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

.card-hover {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.card-hover::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: linear-gradient(135deg, rgba(224, 122, 95, 0.1), transparent);
}

.card-hover:hover::after {
    opacity: 1;
}

/* ===== IMAGE EFFECTS ===== */

.img-zoom {
    overflow: hidden;
}

.img-zoom img {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.img-zoom:hover img {
    transform: scale(1.08);
}

/* ===== GRADIENT TEXT ===== */

.gradient-text {
    background: linear-gradient(135deg, #e07a5f 0%, #3d405b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-gold {
    background: linear-gradient(135deg, #f2cc8f 0%, #e07a5f 50%, #f2cc8f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== SCROLL REVEAL ===== */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== SMOOTH SCROLLBAR ===== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f4f1de;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #e07a5f, #3d405b);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #e07a5f;
}

/* ===== FOCUS STATES ===== */

.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.4);
}

.focus-ring:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.6);
}

/* ===== SELECTION STYLING ===== */

::selection {
    background: rgba(224, 122, 95, 0.3);
    color: #3d405b;
}

/* ===== LOADING SKELETON ===== */

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

/* ===== TOOLTIP ===== */

.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    padding: 8px 12px;
    background: #3d405b;
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px);
}

/* ===== RIPPLE EFFECT ===== */

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 60%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.ripple:active::after {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
    transition: transform 0s, opacity 0s;
}

/* ===== INPUT ANIMATIONS ===== */

.input-float {
    position: relative;
}

.input-float input:focus+label,
.input-float input:not(:placeholder-shown)+label {
    transform: translateY(-22px) scale(0.85);
    color: #e07a5f;
}

.input-float label {
    position: absolute;
    left: 12px;
    top: 12px;
    transition: all 0.3s ease;
    pointer-events: none;
    color: #9ca3af;
}

/* ===== BADGE PULSE ===== */

.badge-pulse {
    position: relative;
}

.badge-pulse::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    animation: pulseGlow 2s infinite;
}

/* ===== SHINE ON HOVER ===== */

.shine {
    position: relative;
    overflow: hidden;
}

.shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transform: skewX(-25deg);
    transition: left 0.6s ease;
}

.shine:hover::before {
    left: 125%;
}

/* ===== ENHANCED SEARCH BAR ===== */

.search-bar {
    transition: all 0.3s ease;
}

.search-bar:focus-within {
    transform: scale(1.02);
    box-shadow: 0 10px 40px rgba(224, 122, 95, 0.15);
}

/* ===== FILTER CONTROLS ===== */

.filter-control {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.filter-control:focus-within {
    border-color: #e07a5f;
    box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.2);
}

/* ===== TEXT SHADOW FOR HERO ===== */

.text-shadow-lg {
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.text-shadow-xl {
    text-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

/* ===== ACCENT UNDERLINE ===== */

.accent-underline {
    position: relative;
    display: inline-block;
}

.accent-underline::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #e07a5f, #f2cc8f);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.accent-underline:hover::after {
    transform: scaleX(1);
}

/* ===== SMOOTH SECTION TRANSITIONS ===== */

section {
    scroll-margin-top: 80px;
}

/* ===== MOBILE TOUCH FRIENDLY ===== */

@media (hover: none) {
    .card-hover:hover {
        transform: none;
    }

    .btn-premium:hover {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== MOBILE RESPONSIVE FIXES ===== */

/* Safe area for iPhones with gesture bar */
.safe-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Product card text on mobile 2-col grid */
@media (max-width: 639px) {
    .product-card .p-5 {
        padding: 0.75rem !important;
    }

    .product-card .text-lg {
        font-size: 0.875rem !important;
        line-height: 1.25rem !important;
    }

    .product-card .text-xl {
        font-size: 1rem !important;
    }

    .product-card .text-sm {
        font-size: 0.7rem !important;
    }

    .product-card .text-xs {
        font-size: 0.625rem !important;
    }

    /* Modal padding on mobile */
    #product-modal .p-8 {
        padding: 1rem !important;
    }

    #product-modal .p-6 {
        padding: 0.75rem !important;
    }

    /* Smaller FAB buttons on mobile */
    .safe-bottom a {
        padding: 0.625rem;
    }

    .safe-bottom .w-7 {
        width: 1.375rem;
        height: 1.375rem;
    }
}

/* No-scrollbar utility for thumbnails */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ===== SR-ONLY (Screen Reader Only) ===== */
/* Missing from compiled Tailwind build */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border-width: 0 !important;
}

/* ===== PEER-CHECKED TOGGLE FIX ===== */
/* Tailwind peer-checked utilities not in compiled build */
.peer:checked~.peer-checked\:bg-brand-terracotta {
    background-color: #E07A5F !important;
}

.peer:checked~.peer-checked\:translate-x-4 {
    transform: translateX(1rem) !important;
}

/* ===== MISSING TAILWIND TRANSITION UTILITIES ===== */
.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-colors {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.duration-300 {
    transition-duration: 300ms;
}

.duration-500 {
    transition-duration: 500ms;
}

/* Checkout radio buttons - delivery area & payment */
.peer:checked~.peer-checked\:border-brand-terracotta {
    border-color: #E07A5F !important;
}

.peer:checked~.peer-checked\:bg-brand-terracotta\/5 {
    background-color: rgba(224, 122, 95, 0.05) !important;
}

.peer:checked~div .peer-checked\:text-brand-terracotta {
    color: #E07A5F !important;
}

/* bKash payment option */
.peer:checked~.peer-checked\:border-pink-500 {
    border-color: #ec4899 !important;
}

.peer:checked~.peer-checked\:bg-pink-50\/30 {
    background-color: rgba(253, 242, 248, 0.3) !important;
}

.peer:checked~.peer-checked\:from-pink-500\/5 {
    --tw-gradient-from: rgba(236, 72, 153, 0.05) !important;
}

/* Custom Search Padding Override */
.pl-custom-mobile {
    padding-left: 4rem !important;
}

@media (min-width: 768px) {
    .pl-custom-desktop {
        padding-left: 5rem !important;
    }
}

/* ===== SEARCH BAR ICON POSITIONING FIX ===== */
.search-bar {
    position: relative !important;
}

.search-bar>div {
    position: absolute !important;
    left: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 10 !important;
}

.search-bar>input {
    padding-left: 3.5rem !important;
}

@media (min-width: 768px) {
    .search-bar>div {
        left: 1rem !important;
    }

    .search-bar>input {
        padding-left: 4.5rem !important;
    }
}

/* ===== IN STOCK TOGGLE KNOB FIX ===== */
/* The toggle track and knob need explicit positioning since Tailwind utilities are missing */
#instock-toggle~div:first-of-type {
    /* Track */
    width: 2.5rem !important;
    height: 1.5rem !important;
    background-color: #e5e7eb !important;
    border-radius: 9999px !important;
    transition: background-color 300ms ease !important;
}

#instock-toggle:checked~div:first-of-type {
    background-color: #E07A5F !important;
}

#instock-toggle~div:last-of-type {
    /* Knob */
    position: absolute !important;
    left: 0.25rem !important;
    top: 0.25rem !important;
    width: 1rem !important;
    height: 1rem !important;
    background-color: white !important;
    border-radius: 9999px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    transition: transform 300ms ease !important;
}

#instock-toggle:checked~div:last-of-type {
    transform: translateX(1rem) !important;
}

/* ===== PREMIUM "GOLDEN STITCH" ANIMATION ===== */

/* Thread Weaving Effect */
@keyframes stitch {
    0% {
        stroke-dashoffset: 200;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        stroke-dashoffset: 0;
        opacity: 1;
    }

    100% {
        stroke-dashoffset: 0;
        opacity: 0;
    }
}

/* Fabric/Liquid Fill Effect (Horizontal Wipe) */
@keyframes liquidFill {
    0% {
        width: 0;
    }

    100% {
        width: 100%;
    }
}

/* Needle Pulse */
@keyframes needlePulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 4px 6px rgba(224, 122, 95, 0.2));
    }

    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 8px 12px rgba(224, 122, 95, 0.5));
    }
}

/* Subtle Fabric Ripple Background */
@keyframes fabricRipple {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.animate-stitch {
    stroke-dasharray: 200;
    animation: stitch 3s ease-in-out infinite;
}

.animate-liquid-fill {
    animation: liquidFill 2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-fabric-bg {
    background: radial-gradient(circle at center, #ffffff 0%, #faf9f6 100%);
    background-size: 200% 200%;
    animation: fabricRipple 10s ease infinite;
}

/* ===== LIGHTBOX ZOOM ANIMATIONS ===== */

@keyframes lightbox-zoom-in {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes lightbox-zoom-out {
    from {
        transform: scale(1);
        opacity: 1;
    }

    to {
        transform: scale(0.8);
        opacity: 0;
    }
}

/* ===== GROUP HOVER UTILITY ===== */
/* Ensures group-hover:opacity-100 works in compiled Tailwind build */
.group:hover .group-hover\:opacity-100 {
    opacity: 1;
}