/* ==========================================================
   assets/css/app.css
   Sebelumnya CSS ini nempel sebagai <style> inline di dalam
   partials/header.php, sehingga dikirim ulang & di-parse ulang
   oleh browser di SETIAP perpindahan halaman (karena tiap
   halaman = reload penuh dari server). Dengan dipindah ke file
   eksternal ini, browser akan meng-cache file-nya sekali lalu
   memakainya lagi tanpa download ulang di halaman berikutnya.
   ========================================================== */

:root {
    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --primary: #4338ca;
    --primary-hover: #3730a3;
    --primary-light: #eef2ff;
    --accent: #0ea5e9;
    --bg-main: #f8fafc;
    --surface: #ffffff;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border-subtle: rgba(15, 23, 42, 0.06);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 12px 24px -8px rgba(0, 0, 0, 0.08);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 50px;

    --page-fade-ms: 160ms;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-dark);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    /* Gradient dijadikan flat + non "fixed" di mobile (lihat media query di bawah)
       karena background-attachment: fixed memaksa repaint penuh saat scroll di banyak HP. */
    background-image:
        radial-gradient(circle at 15% 50%, rgba(67, 56, 202, 0.03), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.03), transparent 25%);
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-dark);
}

/* ===== NAVBAR GLASSMORPHISM =====
   Blur diturunkan dari 20px -> 10px. Efek blur backdrop-filter dihitung ulang
   oleh GPU tiap frame saat elemennya sticky/fixed dan halaman di-scroll;
   makin besar radius blur-nya, makin berat, terutama di HP kelas menengah-bawah.
   Ini salah satu penyebab utama terasa "berat"/tidak smooth saat scroll. */
.navbar-glass {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-glass);
    padding: 0.8rem 0;
    transition: box-shadow 0.2s ease;
}

.brand-logo-img {
    height: 38px;
    max-height: 38px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
    transition: transform 0.25s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05));
}

@media (max-width: 576px) {
    .brand-logo-img {
        height: 30px;
        max-height: 30px;
        max-width: 110px;
    }
}

.navbar-brand:hover .brand-logo-img {
    transform: scale(1.05);
}

.link-reset {
    background: none; border: 0; padding: 0; margin: 0;
    font: inherit; color: inherit; text-align: inherit;
    cursor: pointer; outline: none;
}

/* ===== USER PILLS (WALLET & PROFILE) ===== */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.wallet-pill {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    padding: 0.4rem 1rem 0.4rem 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    text-decoration: none;
}
.wallet-pill:hover {
    border-color: rgba(67, 56, 202, 0.2);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.wallet-icon {
    background: var(--primary-light);
    color: var(--primary);
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
}
.wallet-amount {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-dark);
}

.profile-pill {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    padding: 0.25rem 1rem 0.25rem 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s ease;
    text-decoration: none;
}
.profile-pill:hover {
    background: var(--surface);
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-sm);
}
.profile-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--surface);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.profile-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
}

.btn-logout {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #fee2e2;
    color: #ef4444;
    border: none;
    transition: background 0.2s ease, transform 0.2s ease;
    text-decoration: none;
}
.btn-logout:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.05);
}

/* ===== AUTH BUTTONS (GUEST) ===== */
.btn-auth-login {
    color: var(--primary);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-pill);
    transition: background 0.2s ease;
    text-decoration: none;
}
.btn-auth-login:hover {
    background: var(--primary-light);
}
.btn-auth-register {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-pill);
    box-shadow: 0 4px 12px rgba(67, 56, 202, 0.3);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    border: none;
}
.btn-auth-register:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(67, 56, 202, 0.4);
    color: white;
}

/* ===== BOTTOM NAVIGATION (APP LIKE) ===== */
body.has-bottom-nav main {
    padding-bottom: 90px;
}
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1030;
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-subtle);
    padding-bottom: env(safe-area-inset-bottom, 12px);
    padding-top: 8px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.04);
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    transition: color 0.2s ease;
    padding: 4px;
}
.bottom-nav-item i {
    font-size: 1.35rem;
    transition: transform 0.2s ease;
}
.bottom-nav-item:hover, .bottom-nav-item.active {
    color: var(--primary);
}
.bottom-nav-item.active i {
    transform: translateY(-2px);
    text-shadow: 0 4px 12px rgba(67, 56, 202, 0.3);
}

/* ===== ALERTS (TOAST STYLE) ===== */
.alert-custom {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    background: var(--surface);
    animation: slideDown 0.35s ease;
    padding: 1rem 1.25rem;
}
.alert-custom .icon-box {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.alert-custom.alert-success .icon-box { background: #dcfce7; color: #16a34a; }
.alert-custom.alert-danger .icon-box { background: #fee2e2; color: #ef4444; }

@keyframes slideDown {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ==========================================================
   PAGE TRANSITION (dipakai bareng assets/js/page-transition.js)
   Website ini multi-halaman (tiap klik = reload penuh dari
   server), bukan single-page app. Efek "smooth" antar halaman
   didapat dengan:
   1) meta tag view-transition (native, Chrome/Edge terbaru)
      -> lihat partials/header.php
   2) fallback fade in/out via CSS + JS untuk browser lain
   ========================================================== */
html {
    view-transition-name: none;
}

body {
    animation: pageFadeIn var(--page-fade-ms) ease both;
}

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

body.is-leaving {
    opacity: 0;
    transition: opacity var(--page-fade-ms) ease;
}

/* Progress bar tipis di atas halaman saat pindah halaman */
#page-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    z-index: 99999;
    transition: width 0.3s ease, opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
}
#page-progress.is-active {
    opacity: 1;
}

/* Native browser View Transition (Chrome/Edge) untuk navigasi dokumen */
@supports (view-transition-name: none) {
    ::view-transition-old(root) {
        animation: pageFadeOutVT var(--page-fade-ms) ease both;
    }
    ::view-transition-new(root) {
        animation: pageFadeInVT var(--page-fade-ms) ease both;
    }
}
@keyframes pageFadeOutVT { to { opacity: 0; } }
@keyframes pageFadeInVT { from { opacity: 0; } }

/* Hormati preferensi user yang minta animasi dikurangi (aksesibilitas + baterai HP) */
@media (prefers-reduced-motion: reduce) {
    body, .alert-custom, #page-progress {
        animation: none !important;
        transition: none !important;
    }
}

/* Di layar kecil, background-attachment:fixed & blur berat dimatikan/dikurangi
   lagi karena repaint-nya jauh lebih mahal di GPU mobile murah */
@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }
    .navbar-glass,
    .bottom-nav {
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }
}

