/* ShopMart animations */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-32px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(32px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes kenBurns {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}

@keyframes captionPop {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes captionPopFull {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 166, 153, 0.45); }
    50% { box-shadow: 0 0 0 8px rgba(0, 166, 153, 0); }
}

/* Hero carousel */
.hero-carousel {
    position: relative;
    height: 360px;
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Full viewport-width hero (homepage) */
.hero-carousel.hero-fullpage {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-bottom: 0;
    height: 100vh;
    min-height: 520px;
    border-radius: 0;
    box-shadow: none;
}

.page-home.cashify-home .hero-carousel.hero-fullpage {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.page-home:not(.cashify-home) .main-content {
    padding-top: 36px;
}

.hero-track { position: relative; width: 100%; height: 100%; }

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s;
    z-index: 0;
}

.hero-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

.hero-slide.active .hero-slide-img {
    animation: kenBurns 10s ease-out forwards;
}

.hero-fullpage .hero-slide.active .hero-slide-img {
    animation: kenBurnsFull 12s ease-out forwards;
}

@keyframes kenBurnsFull {
    from { transform: scale(1); }
    to { transform: scale(1.12); }
}

.hero-slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, rgba(12,18,34,0.82) 0%, rgba(26,39,68,0.45) 42%, rgba(13,148,136,0.12) 100%);
    pointer-events: none;
}

.hero-fullpage .hero-overlay {
    background: linear-gradient(90deg, rgba(12,18,34,0.88) 0%, rgba(26,39,68,0.5) 38%, transparent 70%);
}

.hero-fullpage .hero-overlay-lite {
    background: linear-gradient(90deg, rgba(12, 18, 34, 0.55) 0%, transparent 55%);
}

.hero-caption {
    position: absolute;
    bottom: 40px;
    left: 40px;
    max-width: 480px;
    z-index: 2;
    color: #fff;
}

.hero-fullpage .hero-caption {
    top: auto;
    bottom: 96px;
    left: max(5vw, 48px);
    right: max(5vw, 48px);
    transform: none;
    max-width: min(560px, 52vw);
    padding-bottom: 4px;
}

.hero-tag {
    display: inline-block;
    background: var(--brand-accent, #0d9488);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.hero-slide.active .hero-caption {
    animation: captionPop 0.7s ease 0.2s both;
}

.hero-fullpage .hero-slide.active .hero-caption {
    animation: captionPopFull 0.7s ease 0.2s both;
}

.hero-caption h2 {
    font-size: 2rem;
    margin-bottom: 8px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.5);
    color: #fff;
    line-height: 1.15;
}

.hero-fullpage .hero-caption h2 {
    font-size: clamp(1.65rem, 3.2vw, 2.5rem);
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero-caption p {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: #f0f0f0;
}

.hero-fullpage .hero-caption p {
    font-size: clamp(1rem, 2vw, 1.45rem);
    margin-bottom: 28px;
    line-height: 1.5;
}

.btn-lg {
    padding: 14px 36px;
    font-size: 1.1rem;
    font-weight: 600;
}

.hero-cta {
    animation: pulseGlow 2s ease infinite;
}

.hero-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.2);
    z-index: 4;
}

.hero-progress-bar {
    display: block;
    height: 100%;
    width: 0;
    background: var(--brand-accent, #0d9488);
    transition: width 0.1s linear;
}

.hero-fullpage .hero-progress-bar.is-running {
    animation: heroProgress var(--hero-duration, 7s) linear forwards;
}

@keyframes heroProgress {
    from { width: 0; }
    to { width: 100%; }
}

.hero-scroll {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    color: #fff;
    text-align: center;
    font-size: 0.85rem;
    text-decoration: none;
    opacity: 0.85;
    animation: bounceDown 2s ease infinite;
}

.hero-scroll:hover {
    color: var(--brand-warm, #fbbf24);
    opacity: 1;
    text-decoration: none;
}

.hero-scroll svg {
    display: block;
    margin: 6px auto 0;
}

@keyframes bounceDown {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

.hero-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    line-height: 1;
}

.hero-nav:hover {
    transform: translateY(-50%) scale(1.1);
    background: #fff;
}

.hero-prev { left: 16px; }
.hero-next { right: 16px; }

.hero-fullpage .hero-nav {
    width: 52px;
    height: 52px;
    font-size: 1.75rem;
    background: rgba(255,255,255,0.15);
    color: #fff;
    backdrop-filter: blur(4px);
}

.hero-fullpage .hero-nav:hover {
    background: rgba(255,255,255,0.95);
    color: #111;
}

.hero-dots {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

.hero-fullpage .hero-dots {
    bottom: 72px;
    left: auto;
    right: max(5vw, 48px);
    transform: none;
}

.hero-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.25s, background 0.25s;
}

.hero-dot.active,
.hero-dot:hover {
    background: var(--brand-accent, #0d9488);
    border-color: var(--brand-accent, #0d9488);
    transform: scale(1.2);
}

.product-card-img {
    position: relative;
    overflow: hidden;
}

.card-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.35) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.product-card:hover .card-shine {
    transform: translateX(100%);
}

.card-quick-view {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: rgba(12, 18, 34, 0.88);
    color: #fff;
    text-align: center;
    font-size: 0.85rem;
    transform: translateY(100%);
    transition: transform 0.35s ease;
}

.product-card:hover .card-quick-view {
    transform: translateY(0);
}

.card-highlight {
    font-size: 0.8rem;
    color: var(--muted, #565959);
    margin: 4px 0 6px;
    line-height: 1.3;
}

.pulse-deal {
    animation: pulseDeal 2s ease infinite;
}

@keyframes pulseDeal {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

/* Product detail enhancements */
.detail-title {
    animation: fadeInUp 0.5s ease both;
}

.gallery-main-wrap {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md, 16px);
    background: var(--v-gradient-soft, #f5f0ff);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    cursor: zoom-in;
}

.gallery-main-wrap #mainImage {
    max-height: 420px;
    width: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

.gallery-expand-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--v-primary-dark, #5b21b6);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, background 0.2s;
    z-index: 2;
}

.gallery-expand-btn:hover {
    transform: scale(1.04);
    background: #fff;
}

.thumb-list {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.thumb-btn {
    padding: 0;
    border: 2px solid var(--v-border, #e8e2f0);
    border-radius: var(--radius-sm, 10px);
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.thumb-btn:hover,
.thumb-btn.active {
    border-color: var(--v-primary, #7c3aed);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.thumb-btn .thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    display: block;
}

/* Fullscreen photo lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.gallery-lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.gallery-lightbox-open {
    overflow: hidden;
}

.gallery-lightbox .lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 10, 30, 0.92);
    cursor: pointer;
}

.gallery-lightbox .lb-panel {
    position: relative;
    z-index: 1;
    width: min(960px, 100%);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-lightbox .lb-figure {
    margin: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.gallery-lightbox #lightboxImage {
    max-width: 100%;
    max-height: min(70vh, 720px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.gallery-lightbox .lb-close {
    position: absolute;
    top: -48px;
    right: 0;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.gallery-lightbox .lb-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.gallery-lightbox .lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.gallery-lightbox .lb-nav:hover {
    background: var(--v-primary, #7c3aed);
}

.gallery-lightbox .lb-prev { left: -60px; }
.gallery-lightbox .lb-next { right: -60px; }

.gallery-lightbox .lb-counter {
    color: #fff;
    margin-top: 16px;
    font-size: 0.95rem;
    font-weight: 600;
}

.gallery-lightbox .lb-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
}

.gallery-lightbox .lb-thumb {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
}

.gallery-lightbox .lb-thumb.active,
.gallery-lightbox .lb-thumb:hover {
    opacity: 1;
    border-color: var(--v-primary, #7c3aed);
}

.gallery-lightbox .lb-thumb img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

@media (max-width: 768px) {
    .gallery-lightbox .lb-prev { left: 8px; top: auto; bottom: 100%; transform: none; }
    .gallery-lightbox .lb-next { right: 8px; top: auto; bottom: 100%; transform: none; }
    .gallery-lightbox .lb-close { top: 8px; right: 8px; }
}

.product-highlights {
    list-style: none;
    margin: 16px 0;
    padding: 0;
}

.highlight-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.95rem;
    opacity: 0;
    animation: fadeInUp 0.45s ease var(--delay, 0ms) both;
}

.highlight-item::before {
    content: '✓';
    color: var(--success, #067d62);
    font-weight: bold;
    flex-shrink: 0;
}

.delivery-estimate {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.animate-fade-in {
    animation: fadeIn 0.6s ease 0.3s both;
}

.stock.in {
    color: var(--success);
    animation: stockPulse 2s ease infinite;
}

@keyframes stockPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.btn-animated {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-animated:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(13, 148, 136, 0.35);
}

.btn-animated:active:not(:disabled) {
    transform: scale(0.97);
}

.detail-section.is-visible .attr-row {
    animation: fadeInUp 0.4s ease var(--delay, 0ms) both;
}

.detail-section.is-visible .review-item {
    animation: fadeInUp 0.5s ease var(--delay, 0ms) both;
}

.desc-content {
    line-height: 1.7;
    color: #333;
}

.page-product-detail .detail-section h2 {
    animation: slideInLeft 0.5s ease both;
}

/* Listing animations */
.animate-section {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.animate-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s ease;
    transition-delay: var(--delay, 0ms);
}

.animate-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.product-card.animate-card.is-visible:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.product-card-img img {
    transition: transform 0.45s ease;
}

.product-card:hover .product-card-img img {
    transform: scale(1.06);
}

.category-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
    transform: translateY(-4px) scale(1.02);
}

.category-icon {
    display: block;
    font-size: 2rem;
    margin-bottom: 8px;
}

/* Product detail page */
.page-product-detail .breadcrumb {
    animation: fadeIn 0.5s ease both;
}

.product-detail {
    animation: fadeInUp 0.6s ease both;
}

.product-gallery {
    animation: slideInLeft 0.65s ease both;
}

.product-gallery #mainImage {
    transition: opacity 0.25s ease;
}

.product-info {
    animation: slideInRight 0.65s ease 0.1s both;
}

.product-info .price-current {
    display: inline-block;
    animation: fadeInUp 0.5s ease 0.3s both;
}

.buy-form .btn-accent:hover {
    animation: pulseGlow 1.5s ease infinite;
}

.btn-clicked {
    transform: scale(0.96);
    transition: transform 0.15s ease;
}

.cart-count.cart-bump {
    animation: cartBump 0.45s ease;
}

@keyframes cartBump {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.35); }
}

.cart-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--brand-deep, #0c1222); color: #fff; padding: 12px 24px; border-radius: 8px;
    z-index: 9999; opacity: 0; transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2); font-size: 0.95rem;
}
.cart-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.cart-toast-error { background: var(--brand-highlight, #f43f5e); }

.product-card-actions .btn-animated:hover {
    transform: translateY(-1px);
}

.thumb-list .thumb {
    transition: transform 0.25s, border-color 0.25s, opacity 0.25s;
    opacity: 0.75;
}

.thumb-list .thumb:hover,
.thumb-list .thumb.active {
    opacity: 1;
    transform: scale(1.08);
    border-color: var(--brand-accent, #0d9488);
}

.detail-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

.detail-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.review-item {
    animation: fadeInUp 0.5s ease both;
}

.review-item:nth-child(2) { animation-delay: 0.05s; }
.review-item:nth-child(3) { animation-delay: 0.1s; }
.review-item:nth-child(4) { animation-delay: 0.15s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .hero-slide.active .hero-slide-img { animation: none; }
}

@media (max-width: 768px) {
    .hero-carousel { height: 240px; }
    .hero-carousel.hero-fullpage {
        height: 100vh;
        min-height: 420px;
    }
    .hero-fullpage .hero-caption {
        top: auto;
        bottom: 108px;
        left: 20px;
        right: 72px;
        transform: none;
        max-width: none;
    }

    .hero-fullpage .hero-slide.active .hero-caption {
        animation: captionPopFull 0.7s ease 0.2s both;
    }
    .hero-fullpage .hero-caption h2 { font-size: 1.75rem; }
    .hero-fullpage .hero-dots { right: 20px; bottom: 56px; }
    .hero-scroll { bottom: 24px; }
    .hero-caption { left: 20px; bottom: 24px; }
    .hero-caption h2 { font-size: 1.35rem; }
    .hero-nav { width: 36px; height: 36px; font-size: 1.2rem; }
}
