/* =====================================================================
   SIPANAS — Lapisan Tema 3D
   Tombol timbul (bisa "ditekan"), panel berlapis bayangan dalam, kartu
   miring mengikuti kursor, animasi muncul bertahap & modal 3D.
   Dimuat setelah style.css; semua gerak dimatikan bila pengguna memilih
   "kurangi gerakan" di perangkatnya.
   ===================================================================== */
:root {
  --pegas: cubic-bezier(.34, 1.56, .64, 1);
  --halus: cubic-bezier(.2, .8, .2, 1);
  --d3-panel:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    0 1px 2px rgba(74, 10, 16, .05),
    0 8px 18px -6px rgba(74, 10, 16, .12),
    0 22px 44px -22px rgba(74, 10, 16, .22);
  --d3-panel-naik:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    0 2px 4px rgba(74, 10, 16, .06),
    0 16px 30px -8px rgba(74, 10, 16, .2),
    0 34px 60px -24px rgba(74, 10, 16, .3);
}

/* ---------- latar halaman: cahaya lembut berlapis */
body {
  background:
    radial-gradient(1100px 520px at 105% -8%, rgba(227, 182, 79, .16), transparent 60%),
    radial-gradient(900px 520px at -12% 18%, rgba(163, 29, 42, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- header: kilau emas bergerak pelan */
/* header TIDAK boleh overflow:hidden — menu foto/akun menjulur ke bawah header.
   z-index 30: lapisan header (beserta menunya) selalu di atas navigasi (20) & isi halaman. */
.top { position: relative; z-index: 30; box-shadow: 0 10px 30px -12px rgba(74, 10, 16, .55); }
.top::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(242, 207, 116, .16) 50%, transparent 60%) no-repeat;
  background-size: 250% 100%;
  animation: kilau 9s ease-in-out infinite;
}
.top-inner { position: relative; }
@keyframes kilau { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0% 0; } }
.brand .logo {
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08), 0 6px 0 rgba(0, 0, 0, .18), 0 12px 24px rgba(0, 0, 0, .35);
  transition: transform .5s var(--pegas);
}
.brand:hover .logo { transform: perspective(300px) rotateY(-14deg) rotateX(6deg) scale(1.05); }
.clock, .usercard {
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(0, 0, 0, .18));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 6px 16px -6px rgba(0, 0, 0, .45);
  transition: transform .25s var(--pegas), box-shadow .25s;
}
@media (hover: hover) {
  .usercard:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 10px 22px -6px rgba(0, 0, 0, .5); }
}
.menu { z-index: 60; }
.avatar { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12), 0 3px 8px rgba(0, 0, 0, .25); }
.menu { animation: munculMenu .22s var(--halus); transform-origin: top right; box-shadow: var(--d3-panel-naik); }
@keyframes munculMenu { from { opacity: 0; transform: perspective(600px) rotateX(-14deg) translateY(-6px) scale(.97); } }

/* ---------- navigasi: menu aktif timbul seperti tombol */
.nav { background: rgba(255, 255, 255, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 6px 18px -12px rgba(74, 10, 16, .35); }
.nav-inner { padding-top: 6px; padding-bottom: 6px; gap: 4px; }
.nav a { border-radius: 10px; border-bottom: 0; padding: 9px 12px; transition: transform .2s var(--pegas), background .2s, box-shadow .2s; }
.nav a:hover { transform: translateY(-1px); background: #fbf4ee; }
.nav a.active {
  background: linear-gradient(180deg, #fff, #fbefe3); color: var(--maroon-700);
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 var(--gold-500), 0 6px 14px -6px rgba(139, 21, 32, .35);
}

/* ---------- tombol 3D: timbul, terangkat saat disorot, "masuk" saat ditekan */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: 12px; border: 1px solid #e3d2c7;
  background: linear-gradient(180deg, #fff 0%, #f9f2ec 100%);
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 #dcc6b8, 0 6px 14px -5px rgba(74, 10, 16, .22);
  transform: translateY(0);
  transition: transform .2s var(--pegas), box-shadow .2s, filter .2s, background .2s;
}
.btn:hover { background: linear-gradient(180deg, #fff 0%, #f6ebe2 100%); transform: translateY(-2px); box-shadow: inset 0 1px 0 #fff, 0 5px 0 #dcc6b8, 0 12px 22px -6px rgba(74, 10, 16, .28); }
.btn:active { transform: translateY(2px); transition-duration: .06s; box-shadow: inset 0 2px 4px rgba(74, 10, 16, .12), 0 1px 0 #dcc6b8, 0 2px 6px -2px rgba(74, 10, 16, .2); }
.btn.primary {
  border-color: #6b0f18; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
  background: linear-gradient(180deg, #b52b3c 0%, var(--maroon-700) 55%, #741019 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 3px 0 #4a0a10, 0 8px 18px -4px rgba(139, 21, 32, .55);
}
.btn.primary:hover { background: linear-gradient(180deg, #c03244 0%, #9a1824 55%, #7c1220 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 5px 0 #4a0a10, 0 14px 26px -6px rgba(139, 21, 32, .6); }
.btn.primary:active { box-shadow: inset 0 2px 6px rgba(0, 0, 0, .3), 0 1px 0 #4a0a10, 0 3px 8px -2px rgba(139, 21, 32, .5); }
.btn.gold {
  border-color: #b8861f; color: var(--maroon-900);
  background: linear-gradient(180deg, #ffe39a 0%, var(--gold-500) 60%, #d4a53a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 3px 0 #9c7016, 0 8px 18px -4px rgba(201, 154, 46, .6);
}
.btn.gold:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 5px 0 #9c7016, 0 14px 24px -6px rgba(201, 154, 46, .65); }
.btn.gold:active { box-shadow: inset 0 2px 5px rgba(0, 0, 0, .18), 0 1px 0 #9c7016; }
.btn.danger { border-color: #efc0bb; background: linear-gradient(180deg, #fff, #fdf0ee); box-shadow: inset 0 1px 0 #fff, 0 3px 0 #ecb8b2, 0 6px 14px -5px rgba(179, 38, 30, .25); }
.btn.danger:hover { background: linear-gradient(180deg, #fff, #fce4e1); box-shadow: inset 0 1px 0 #fff, 0 5px 0 #ecb8b2, 0 12px 22px -6px rgba(179, 38, 30, .3); }
.btn.sm { border-radius: 10px; box-shadow: inset 0 1px 0 #fff, 0 2px 0 #dcc6b8, 0 4px 10px -4px rgba(74, 10, 16, .2); }
.btn.sm:hover { box-shadow: inset 0 1px 0 #fff, 0 4px 0 #dcc6b8, 0 9px 16px -6px rgba(74, 10, 16, .26); }
.btn.sm.primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 2px 0 #4a0a10, 0 6px 14px -4px rgba(139, 21, 32, .5); }
.btn.sm.primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 4px 0 #4a0a10, 0 10px 20px -6px rgba(139, 21, 32, .55); }
.btn.sm.gold { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 0 #9c7016, 0 6px 14px -4px rgba(201, 154, 46, .55); }
.btn:disabled, .btn:disabled:hover { transform: none; filter: saturate(.4); box-shadow: inset 0 1px 0 #fff, 0 1px 0 #e6d8ce; }
/* kilatan cahaya melintas saat disorot */
.btn::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 48%, transparent 66%);
  transform: translateX(-130%); transition: transform .7s var(--halus);
}
.btn.primary::after { background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .28) 48%, transparent 66%); }
.btn:hover::after { transform: translateX(130%); }
/* riak sentuhan (dibuat oleh app.js) */
.riak { position: absolute; border-radius: 50%; pointer-events: none; z-index: -1; background: currentColor; opacity: .22; transform: scale(0); animation: riak .6s var(--halus) forwards; }
@keyframes riak { to { transform: scale(1); opacity: 0; } }
.icon-btn { border-radius: 10px; transition: transform .2s var(--pegas), background .2s, box-shadow .2s; }
.icon-btn:hover { transform: translateY(-2px) scale(1.08); background: #fff; box-shadow: 0 6px 14px -6px rgba(74, 10, 16, .35); }
.icon-btn:active { transform: translateY(1px) scale(.96); }

/* ---------- panel & kartu berlapis */
.card {
  border-radius: 18px; border-color: rgba(236, 223, 216, .9);
  background: linear-gradient(180deg, #fff 0%, #fffcfa 100%);
  box-shadow: var(--d3-panel);
}
.card h3 { letter-spacing: .1px; }
fieldset { border-radius: 14px; background: linear-gradient(180deg, #fff, #fffaf6); box-shadow: inset 0 1px 0 #fff, 0 4px 14px -10px rgba(74, 10, 16, .3); }
legend { background: linear-gradient(180deg, #fff, #fbefe3); border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; box-shadow: 0 3px 8px -4px rgba(74, 10, 16, .3); }

/* elemen yang miring mengikuti kursor (diatur app.js) */
.stat, .tcard, .hari-ini, .hero, .auth .box, .tilt3d {
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px));
  transform-style: preserve-3d;
  transition: transform .45s var(--halus), box-shadow .35s;
}
.miring { --ty: -4px; transition: transform .08s linear, box-shadow .35s; }
.card.stat.miring, .tcard.miring, .hari-ini.miring { box-shadow: var(--d3-panel-naik); }
/* pantulan cahaya mengikuti kursor */
.stat::before, .tcard::before, .hari-ini::before, .hero::after, .auth .box::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .55), transparent 45%);
}
.hero::after { background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .14), transparent 45%); }
.stat, .tcard, .hari-ini, .auth .box { position: relative; }
.miring::before, .hero.miring::after { opacity: 1; }

/* kartu statistik: ikon "melayang" di atas kartu */
.stat .ic {
  background: linear-gradient(145deg, #fff8ee, #f5d9bf);
  box-shadow: inset 0 1px 0 #fff, inset 0 -3px 0 rgba(139, 21, 32, .12), 0 8px 14px -6px rgba(139, 21, 32, .45);
  transform: translateZ(28px); transition: transform .45s var(--pegas);
}
.stat:hover .ic { transform: translateZ(40px) rotate(-8deg) scale(1.1); }
.stat .val { transform: translateZ(18px); background: linear-gradient(180deg, var(--maroon-800), var(--maroon-600)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .val.neg, .stat .val .neg { -webkit-text-fill-color: var(--bad); }

/* hero dashboard: kedalaman + bola cahaya mengambang */
.hero { position: relative; overflow: hidden; box-shadow: 0 2px 0 rgba(0, 0, 0, .15), 0 18px 40px -16px rgba(74, 10, 16, .7); }
.hero::before {
  content: ''; position: absolute; width: 340px; height: 340px; right: -90px; top: -150px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 35%, rgba(242, 207, 116, .45), rgba(242, 207, 116, 0) 65%);
  animation: melayang 7s ease-in-out infinite;
}
.hero > * { position: relative; z-index: 1; }
.hero .clock { transform: translateZ(30px); }
@keyframes melayang { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-30px, 24px) scale(1.08); } }

/* kartu pengingat & hari ini */
.reminder { box-shadow: 0 8px 22px -14px rgba(154, 100, 0, .5); background: linear-gradient(180deg, #fffcf4, #fff6e2); }
.hari-ini { box-shadow: var(--d3-panel); }

/* ---------- formulir: kolom "terbenam" & cincin fokus bercahaya */
input[type=text], input[type=password], input[type=date], input[type=time], input[type=email], input[type=number], input[type=search], input[type=tel], select, textarea {
  box-shadow: inset 0 2px 3px rgba(74, 10, 16, .06), 0 1px 0 #fff;
  transition: box-shadow .2s, border-color .2s, transform .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-500) !important; box-shadow: inset 0 2px 3px rgba(74, 10, 16, .05), 0 0 0 4px rgba(227, 182, 79, .28) !important; }
input[type=checkbox] { accent-color: var(--maroon-700); }

/* ---------- tabel, pill & ringkasan biaya */
.table-wrap { border-radius: 14px; box-shadow: 0 6px 18px -12px rgba(74, 10, 16, .3); }
table.t th { background: linear-gradient(180deg, #fdf7f1, #f7ece3); }
table.t tbody tr { transition: background .2s, box-shadow .2s; }
table.t tbody tr:hover td { background: #fff8f1; }
table.t tbody tr:hover { box-shadow: inset 3px 0 0 var(--gold-500); }
.pill { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 2px rgba(0, 0, 0, .06); }
.sum-box { background: linear-gradient(180deg, #fdf6f0, #f8ebe0); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(139, 21, 32, .06), 0 8px 18px -12px rgba(74, 10, 16, .35); }
.berkas-item { transition: transform .25s var(--pegas), box-shadow .25s; }
.berkas-item:hover { transform: translateY(-3px); box-shadow: 0 12px 22px -12px rgba(74, 10, 16, .35); }

/* ---------- kalender */
.cal { box-shadow: var(--d3-panel); border-radius: 16px; }
.cal .d { transition: background .2s, box-shadow .2s; }
.cal .d:hover { box-shadow: inset 0 0 0 2px rgba(227, 182, 79, .7); }
.cal .ev { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 2px 4px -1px rgba(0, 0, 0, .25); transition: transform .2s var(--pegas); }
.cal .ev:hover { transform: translateY(-1px) scale(1.03); }
.cal .d.today .n { animation: denyut 2.4s ease-in-out infinite; }
@keyframes denyut { 0%, 100% { box-shadow: 0 0 0 3px rgba(211, 47, 47, .22); } 50% { box-shadow: 0 0 0 7px rgba(211, 47, 47, .08); } }

/* ---------- modal: muncul dengan putaran 3D, latar buram */
.modal-back { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: pudar .25s ease; }
@keyframes pudar { from { opacity: 0; } }
@media (min-width: 901px) {
  .modal { animation: modal3d .5s var(--pegas); transform-origin: 50% 0; box-shadow: 0 2px 0 rgba(0, 0, 0, .06), 0 40px 80px -20px rgba(40, 10, 14, .55); }
  @keyframes modal3d { from { opacity: 0; transform: perspective(1400px) rotateX(-14deg) translateY(28px) scale(.96); } }
}

/* ---------- notifikasi toast */
.toast { animation: toast3d .45s var(--pegas); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 14px 30px -10px rgba(0, 0, 0, .45); }
@keyframes toast3d { from { opacity: 0; transform: perspective(600px) rotateX(40deg) translateY(16px); } }

/* ---------- halaman muncul bertahap */
main > .stack > *, main > .page-title, main > .grid > *, main > .card, main > .cal, main > .hari-ini, main > .table-wrap, main .grid > .card {
  animation: muncul .55s var(--halus) backwards;
}
main .grid > .card:nth-child(2), main > .stack > :nth-child(2) { animation-delay: .05s; }
main .grid > .card:nth-child(3), main > .stack > :nth-child(3) { animation-delay: .1s; }
main .grid > .card:nth-child(4), main > .stack > :nth-child(4) { animation-delay: .15s; }
main .grid > .card:nth-child(5), main > .stack > :nth-child(5) { animation-delay: .2s; }
main .grid > .card:nth-child(n+6), main > .stack > :nth-child(n+6) { animation-delay: .25s; }
@keyframes muncul { from { opacity: 0; transform: perspective(1000px) translateY(18px) rotateX(6deg); } }

/* ---------- halaman login */
.auth .box { box-shadow: inset 0 1px 0 #fff, 0 2px 0 rgba(0, 0, 0, .08), 0 40px 80px -24px rgba(0, 0, 0, .6); animation: muncul .7s var(--halus) backwards; }
.auth .logo { box-shadow: inset 0 -3px 0 rgba(139, 21, 32, .1), 0 10px 22px -8px rgba(139, 21, 32, .45); transform: translateZ(40px); animation: apung 4s ease-in-out infinite; }
@keyframes apung { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }

/* ---------- tampilan HP */
@media (max-width: 900px) {
  .nav-inner { padding-top: 0; padding-bottom: 0; }
  .bnav { box-shadow: 0 -10px 30px -12px rgba(74, 10, 16, .35); }
  .bnav a { transition: transform .25s var(--pegas); }
  .bnav a:active { transform: scale(.9); }
  .bnav-fab {
    background: radial-gradient(circle at 32% 28%, #c8394b, var(--maroon-700) 55%, var(--maroon-900));
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), inset 0 -4px 0 rgba(0, 0, 0, .25), 0 10px 22px rgba(139, 21, 32, .5);
    transition: transform .25s var(--pegas);
  }
  .bnav-fab::after {
    content: ''; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
    box-shadow: 0 0 0 0 rgba(163, 29, 42, .45); animation: cincin 2.6s ease-out infinite;
  }
  .bnav-fab { position: relative; }
  @keyframes cincin { 0% { box-shadow: 0 0 0 0 rgba(163, 29, 42, .45); } 80%, 100% { box-shadow: 0 0 0 16px rgba(163, 29, 42, 0); } }
  .tcard { box-shadow: var(--d3-panel); transition: transform .25s var(--pegas), box-shadow .25s; }
  .tcard:active { transform: scale(.98) translateY(1px); box-shadow: 0 4px 10px -6px rgba(74, 10, 16, .3); }
  .card:active.stat { transform: scale(.98); }
  .stat .ic, .stat:hover .ic, .stat .val { transform: none; }
  .modal, .modal.sm { animation: lembar .45s var(--pegas); }
  @keyframes lembar { from { transform: translateY(70px); opacity: .3; } }
}

/* ---------- hormati preferensi "kurangi gerakan" */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .stat, .tcard, .hari-ini, .hero, .auth .box, .tilt3d { transform: none !important; }
}
