/* ====================================
   Kaly4cid - Smooth Animations CSS
   ==================================== */

/* ============= KEYFRAMES ============= */

/* Fade In Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleUp {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.05);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Slide Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Glow Animation */
@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.2),
            0 0 10px rgba(99, 102, 241, 0.1);
    }

    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.4),
            0 0 30px rgba(99, 102, 241, 0.2);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Bounce */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============= SCROLL REVEAL CLASSES ============= */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Stagger children animation */
.stagger-children>* {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-children.active>*:nth-child(1) {
    transition-delay: 0.05s;
}

.stagger-children.active>*:nth-child(2) {
    transition-delay: 0.1s;
}

.stagger-children.active>*:nth-child(3) {
    transition-delay: 0.15s;
}

.stagger-children.active>*:nth-child(4) {
    transition-delay: 0.2s;
}

.stagger-children.active>*:nth-child(5) {
    transition-delay: 0.25s;
}

.stagger-children.active>*:nth-child(6) {
    transition-delay: 0.3s;
}

.stagger-children.active>*:nth-child(7) {
    transition-delay: 0.35s;
}

.stagger-children.active>*:nth-child(8) {
    transition-delay: 0.4s;
}

.stagger-children.active>* {
    opacity: 1;
    transform: translateY(0);
}

/* ============= PAGE TRANSITIONS ============= */

/* Only animate main content, not bottom nav */
.page-enter .main-content,
.page-enter .app-container>*:not(.bottom-nav) {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.page-exit .main-content,
.page-exit .app-container>*:not(.bottom-nav) {
    animation: fadeOut 0.3s ease forwards;
}

/* Ensure bottom nav is never affected by page animations */
.page-enter .bottom-nav,
.page-exit .bottom-nav {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ============= CARD ANIMATIONS ============= */

.card-animate {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-animate:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(99, 102, 241, 0.15);
}

/* Product Card Specific */
.product-card {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4),
        0 0 50px rgba(99, 102, 241, 0.2);
}

.product-card:hover .product-image {
    transform: scale(1.08);
}

.product-card .product-image {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============= BUTTON ANIMATIONS ============= */

.btn-animate {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-animate::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-animate:hover::before {
    width: 300px;
    height: 300px;
}

.btn-animate:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.btn-animate:active {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

/* Pulse on hover */
.btn-pulse:hover {
    animation: pulse 1s infinite;
}

/* ============= NAV ANIMATIONS ============= */

.nav-item {
    position: relative;
    transition: all 0.3s ease;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.nav-item:hover::after,
.nav-item.active::after {
    width: 100%;
}

.nav-item:hover {
    color: var(--primary);
    transform: translateY(-2px);
}

/* Bottom Nav Animation */
.bottom-nav-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    transform: translateY(-3px);
}

.bottom-nav-item i {
    transition: all 0.3s ease;
}

.bottom-nav-item:hover i,
.bottom-nav-item.active i {
    transform: scale(1.2);
}

/* ============= INPUT ANIMATIONS ============= */

.input-animate {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
}

.input-animate:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

/* Floating Label */
.input-group-animate {
    position: relative;
}

.input-group-animate label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    color: var(--text-secondary);
}

.input-group-animate input:focus+label,
.input-group-animate input:not(:placeholder-shown)+label {
    top: 0;
    font-size: 0.75rem;
    background: var(--bg-card);
    padding: 0 8px;
    color: var(--primary);
}

/* ============= MODAL ANIMATIONS ============= */

.modal-overlay {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-content {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* ============= TOAST ANIMATIONS ============= */

.toast-enter {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-exit {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============= LIST ITEM ANIMATIONS ============= */

.list-item-animate {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-item-animate:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(8px);
    border-left: 3px solid var(--primary);
}

/* ============= IMAGE ANIMATIONS ============= */

.img-zoom {
    overflow: hidden;
}

.img-zoom img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.img-zoom:hover img {
    transform: scale(1.1);
}

/* ============= SKELETON LOADING ============= */

.skeleton {
    background: linear-gradient(90deg,
            var(--bg-card) 0%,
            var(--bg-card-hover) 50%,
            var(--bg-card) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ============= SCROLL INDICATOR ============= */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ============= HOVER GLOW EFFECT ============= */

.glow-on-hover {
    transition: all 0.3s ease;
}

.glow-on-hover:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5),
        0 0 60px rgba(99, 102, 241, 0.3);
}

/* ============= TAB ANIMATIONS ============= */

.tab {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.tab::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab:hover::before,
.tab.active::before {
    transform: scaleX(1);
}

/* ============= BADGE ANIMATIONS ============= */

.badge-pulse {
    animation: pulse 2s infinite;
}

.badge-bounce {
    animation: bounce 1s infinite;
}

/* ============= PARALLAX SCROLL ============= */

.parallax {
    transform: translateY(var(--parallax-offset, 0));
    transition: transform 0.1s linear;
}

/* ============= SMOOTH SCROLL SNAP ============= */

.scroll-snap-container {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    scroll-behavior: smooth;
}

.scroll-snap-item {
    scroll-snap-align: start;
}

/* ============= LOADING SPINNER ============= */

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============= CATEGORY PILLS ANIMATION ============= */

.category-pill {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-pill:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.3);
}

.category-pill.active {
    animation: scaleIn 0.3s ease forwards;
}

/* ============= ACCORDION ANIMATION ============= */

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion.open .accordion-content {
    max-height: 500px;
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion.open .accordion-icon {
    transform: rotate(180deg);
}

/* ============= COUNTER ANIMATION ============= */

.counter {
    transition: all 0.5s ease;
}

.counter.counting {
    transform: scale(1.2);
    color: var(--primary);
}