/* =========================================================
   OK-KANTIN7 — Animasi bersama
   Halus, ringan, dan otomatis nonaktif untuk prefers-reduced-motion.
   ========================================================= */

:root {
    --ok-ease: cubic-bezier(.22, .9, .3, 1);
    --ok-ease-out: cubic-bezier(.16, 1, .3, 1);
}

@keyframes ok-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ok-fade-up {
    from { opacity: 0; transform: translate3d(0, 22px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes ok-fade-down {
    from { opacity: 0; transform: translate3d(0, -18px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes ok-fade-left {
    from { opacity: 0; transform: translate3d(28px, 0, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes ok-fade-right {
    from { opacity: 0; transform: translate3d(-28px, 0, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes ok-pop {
    0% { opacity: 0; transform: scale(.88); }
    65% { opacity: 1; transform: scale(1.025); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes ok-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-9px); }
}

@keyframes ok-hero-float {
    0%, 100% { transform: rotate(1.5deg) translateY(0); }
    50% { transform: rotate(1.5deg) translateY(-12px); }
}

@keyframes ok-pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(255, 196, 0, .42); }
    65% { box-shadow: 0 0 0 14px rgba(255, 196, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 196, 0, 0); }
}

@keyframes ok-pulse-soft {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.045); }
}

@keyframes ok-glow {
    0%, 100% { text-shadow: 0 0 0 rgba(220, 31, 31, 0); }
    50% { text-shadow: 0 0 22px rgba(220, 31, 31, .28); }
}

@keyframes ok-shine {
    0% { transform: rotate(20deg) translateX(-180%); }
    100% { transform: rotate(20deg) translateX(420%); }
}

@keyframes ok-wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-9deg); }
    55% { transform: rotate(8deg); }
    80% { transform: rotate(-4deg); }
}

@keyframes ok-badge-pop {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.18); }
    70% { transform: scale(.96); }
}

/* ---------- Utility masuk ---------- */
.anim-fade-in { animation: ok-fade-in .65s var(--ok-ease) backwards; }
.anim-fade-up { animation: ok-fade-up .65s var(--ok-ease-out) backwards; }
.anim-fade-down { animation: ok-fade-down .6s var(--ok-ease-out) backwards; }
.anim-fade-left { animation: ok-fade-left .7s var(--ok-ease-out) backwards; }
.anim-fade-right { animation: ok-fade-right .7s var(--ok-ease-out) backwards; }
.anim-pop { animation: ok-pop .6s var(--ok-ease-out) backwards; }
.anim-float { animation: ok-float 5s ease-in-out infinite; }
.pulse-soft { animation: ok-pulse-soft 2.8s ease-in-out infinite; }
.avatar-ring { animation: ok-pulse-ring 3.4s ease-out infinite; }
.badge-pop { animation: ok-badge-pop 2.6s ease-in-out infinite; }

.anim-delay-1 { animation-delay: .06s; }
.anim-delay-2 { animation-delay: .12s; }
.anim-delay-3 { animation-delay: .18s; }
.anim-delay-4 { animation-delay: .24s; }
.anim-delay-5 { animation-delay: .30s; }
.anim-delay-6 { animation-delay: .36s; }
.anim-delay-7 { animation-delay: .42s; }
.anim-delay-8 { animation-delay: .48s; }

/* ---------- Micro-interaction ---------- */
.btn-lift {
    transition: transform .22s var(--ok-ease), box-shadow .22s ease,
                background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn-lift:hover { transform: translateY(-2px); }
.btn-lift:active { transform: translateY(0) scale(.97); }

.btn-shine { position: relative; overflow: hidden; isolation: isolate; }
.btn-shine::after {
    content: "";
    position: absolute;
    top: -60%;
    left: -70%;
    width: 38%;
    height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
    transform: rotate(20deg) translateX(-180%);
    pointer-events: none;
    z-index: 1;
}
.btn-shine:hover::after { animation: ok-shine .85s ease; }

.icon-pop {
    transition: transform .2s var(--ok-ease), color .2s ease, background-color .2s ease;
}
.icon-pop:hover { transform: translateY(-2px) scale(1.06); }
.icon-pop:active { transform: scale(.94); }
.icon-pop:hover svg { animation: ok-wiggle .5s ease; }

.card-lift {
    transition: transform .25s var(--ok-ease), box-shadow .25s ease,
                border-color .25s ease, background-color .2s ease;
}
.card-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 40px rgba(60, 20, 10, .12);
}
html.dark .card-lift:hover { box-shadow: 0 18px 40px rgba(0, 0, 0, .38); }

/* ---------- Scroll reveal (butuh animasi.js) ---------- */
.reveal {
    opacity: 1;
    transform: none;
    transition: opacity .7s var(--ok-ease-out), transform .7s var(--ok-ease-out);
    transition-delay: var(--reveal-delay, 0s);
    will-change: opacity, transform;
}
html.anim-ready .reveal { opacity: 0; transform: translate3d(0, 28px, 0); }
html.anim-ready .reveal.reveal-left { transform: translate3d(-30px, 0, 0); }
html.anim-ready .reveal.reveal-right { transform: translate3d(30px, 0, 0); }
html.anim-ready .reveal.reveal-zoom { transform: scale(.94); }
html.anim-ready .reveal.is-visible { opacity: 1; transform: none; }

/* =========================================================
   HOME
   ========================================================= */
.hero-copy { position: relative; z-index: 1; }
.home .hero::after {
    content: "";
    position: absolute;
    right: -90px;
    top: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 196, 0, .3), transparent 66%);
    animation: ok-float 9s ease-in-out infinite;
    pointer-events: none;
}
.home .hero > * { position: relative; z-index: 1; }
.hero-copy > * { animation: ok-fade-up .7s var(--ok-ease-out) backwards; }
.hero-copy > :nth-child(1) { animation-delay: .04s; }
.hero-copy > :nth-child(2) { animation-delay: .12s; }
.hero-copy > :nth-child(3) { animation-delay: .20s; }
.hero-copy > :nth-child(4) { animation-delay: .28s; }
.hero-copy > :nth-child(5) { animation-delay: .36s; }

.hero-img { animation: ok-hero-float 7s ease-in-out infinite; }

.home .navbar .logo { transition: transform .25s var(--ok-ease); }
.home .navbar .logo:hover { transform: scale(1.03); }
.home .nav-icons .icon-btn:hover svg { animation: ok-wiggle .5s ease; }

.home .cd-ico { animation: ok-pulse-soft 2.6s ease-in-out infinite; }
.home .cd-time { animation: ok-glow 3.2s ease-in-out infinite; }

.home .menu-grid .menu-card { animation: ok-fade-up .6s var(--ok-ease-out) backwards; }
.home .menu-grid .menu-card:nth-child(2) { animation-delay: .04s; }
.home .menu-grid .menu-card:nth-child(3) { animation-delay: .08s; }
.home .menu-grid .menu-card:nth-child(4) { animation-delay: .12s; }
.home .menu-grid .menu-card:nth-child(5) { animation-delay: .16s; }
.home .menu-grid .menu-card:nth-child(6) { animation-delay: .20s; }
.home .menu-grid .menu-card:nth-child(7) { animation-delay: .24s; }
.home .menu-grid .menu-card:nth-child(8) { animation-delay: .28s; }

.home .pill {
    transition: transform .2s var(--ok-ease), box-shadow .2s ease,
                border-color .2s ease, background-color .2s ease, color .2s ease;
}
.home .pill:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(60, 20, 10, .09); }
.home .pill:active { transform: scale(.97); }
.home .hero-search button:active,
.home .btn-outline:active { transform: scale(.97); }

.home .fab-chat { animation: ok-pulse-ring 3s ease-out infinite; }
.home .fab-chat:hover svg { animation: ok-wiggle .5s ease; }

/* =========================================================
   HALAMAN BERTEMA TAILWIND
   ========================================================= */
/* Profil */
.profile-hero { animation: ok-fade-up .7s var(--ok-ease-out) backwards; }
.profile-banner-ornament { animation: ok-float 6s ease-in-out infinite; }
.profile-stats > * { animation: ok-fade-up .55s var(--ok-ease-out) backwards; }
.profile-stats > :nth-child(2) { animation-delay: .06s; }
.profile-stats > :nth-child(3) { animation-delay: .12s; }
.profile-stats > :nth-child(4) { animation-delay: .18s; }

/* Daftar pesanan & favorit */
.order-list > * {
    animation: ok-fade-up .55s var(--ok-ease-out) backwards;
}
.order-list > :nth-child(2) { animation-delay: .05s; }
.order-list > :nth-child(3) { animation-delay: .10s; }
.order-list > :nth-child(4) { animation-delay: .15s; }
.order-list > :nth-child(5) { animation-delay: .20s; }
.order-list > :nth-child(6) { animation-delay: .25s; }

.fav-grid .kantin-card {
    animation: ok-fade-up .55s var(--ok-ease-out) backwards;
}
.fav-grid .kantin-card:nth-child(2) { animation-delay: .05s; }
.fav-grid .kantin-card:nth-child(3) { animation-delay: .10s; }
.fav-grid .kantin-card:nth-child(4) { animation-delay: .15s; }
.fav-grid .kantin-card:nth-child(5) { animation-delay: .20s; }
.fav-grid .kantin-card:nth-child(6) { animation-delay: .25s; }

/* Dashboard */
.dashboard-metrics > * { animation: ok-fade-up .6s var(--ok-ease-out) backwards; }
.dashboard-metrics > :nth-child(2) { animation-delay: .08s; }
.dashboard-metrics > :nth-child(3) { animation-delay: .16s; }
.dash-order { transition: transform .22s var(--ok-ease), box-shadow .22s ease, border-color .2s ease; }
.dash-order:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(60, 20, 10, .1); }
html.dark .dash-order:hover { box-shadow: 0 12px 28px rgba(0, 0, 0, .35); }

/* Detail produk */
.product-hero { animation: ok-fade-up .65s var(--ok-ease-out) backwards; }
.product-photo { animation: ok-pop .7s var(--ok-ease-out) backwards; }
.product-info > * { animation: ok-fade-up .55s var(--ok-ease-out) backwards; }
.product-info > :nth-child(2) { animation-delay: .06s; }
.product-info > :nth-child(3) { animation-delay: .10s; }
.product-info > :nth-child(4) { animation-delay: .14s; }
.product-info > :nth-child(5) { animation-delay: .18s; }
.product-info > :nth-child(6) { animation-delay: .22s; }
.product-info > :nth-child(7) { animation-delay: .26s; }
.product-info > :nth-child(8) { animation-delay: .30s; }

/* Detail pesanan */
.order-hero { animation: ok-fade-up .65s var(--ok-ease-out) backwards; }
.code-box { animation: ok-pop .65s var(--ok-ease-out) .12s backwards, ok-glow 3.4s ease-in-out 1s infinite; }
.qr-card { animation: ok-pop .55s var(--ok-ease-out) backwards; }
.qr-card:nth-child(2) { animation-delay: .1s; }
.qr-card:nth-child(3) { animation-delay: .18s; }
.qr-card:nth-child(4) { animation-delay: .26s; }
.qr-card { transition: transform .25s var(--ok-ease), box-shadow .25s ease; }
.qr-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(60, 20, 10, .12); }
.order-item { transition: transform .2s var(--ok-ease), background-color .2s ease; }
.order-item:hover { transform: translateX(4px); }

/* Login / Register */
.auth-container { animation: ok-pop .7s var(--ok-ease-out) backwards; }
.auth-banner-left h1 { animation: ok-fade-up .7s var(--ok-ease-out) .12s backwards; }
.auth-banner-left p { animation: ok-fade-up .7s var(--ok-ease-out) .2s backwards; }
.auth-form-right { animation: ok-fade-up .7s var(--ok-ease-out) .1s backwards; }
.delivery-illustration { animation: ok-float 6s ease-in-out infinite; }

/* =========================================================
   AKSESIBILITAS — hormati preferensi pengguna
   ========================================================= */
@media (max-width: 1100px) {
    .hero-img { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
    html.anim-ready .reveal,
    html.anim-ready .reveal.reveal-left,
    html.anim-ready .reveal.reveal-right,
    html.anim-ready .reveal.reveal-zoom {
        opacity: 1 !important;
        transform: none !important;
    }
}
