/* src/css/wishas.css (Wallet UI Edition) */

.wishas {
    width: 100%;
    position: relative;
    z-index: 2;
    padding: 50px 1rem 60px 1rem; /* Padding diperkecil agar sobekan tidak terlalu jauh menjorok ke dalam */
    margin-bottom: 5rem;
    color: var(--ticket-text-bright);
    text-align: center;
    border: none !important;
    box-shadow: none !important;
    overflow-x: clip; /* Memotong sobekan SVG yang tumpah ke pinggir layar */
    
    /* Latar Belakang Gradien Bolong untuk Sobekan Kertas (Merapat) */
    background: linear-gradient(
        transparent 0%,
        transparent 30px,
        var(--ticket-bg-bold) 30px, 
        var(--ticket-bg-bold) calc(100% - 40px), 
        transparent calc(100% - 40px), 
        transparent 100%
    ) !important;
}

/* TORN PAPER BORDERS (TOP & BOTTOM) */
.wishas-tear-top {
    position: absolute;
    top: 0; 
    height: 80px; /* Tinggi sobekan dipangkas */
    left: -30px;
    right: -30px;
    background-color: var(--ticket-bg-bold);
    z-index: -1;
    filter: url('#torn-paper');
}

.wishas-tear-top-alt {
    position: absolute;
    top: -10px; 
    height: 90px; /* Tinggi sobekan dipangkas */
    left: -30px;
    right: -30px;
    background-color: var(--ticket-bg-bold);
    opacity: 0.3;
    z-index: -2;
    filter: url('#torn-paper');
}

.wishas::before {
    content: '';
    position: absolute;
    bottom: -15px; 
    height: 80px; /* Tinggi sobekan dipangkas */
    left: -30px;
    right: -30px;
    background-color: var(--ticket-bg-bold);
    z-index: -1;
    filter: url('#torn-paper');
}

.wishas::after {
    content: '';
    position: absolute;
    bottom: -25px; 
    height: 90px; /* Tinggi sobekan dipangkas */
    left: -30px;
    right: -30px;
    background-color: var(--ticket-bg-bold);
    opacity: 0.3; 
    z-index: -2;
    filter: url('#torn-paper');
}

/* Header Text */
.wishas h2 {
    font-family: var(--sacramento);
    font-size: 3rem;
    color: #ffffff !important; /* Diubah sesuai keinginan user menjadi putih */
    margin-bottom: 1rem;
}

.wishas p {
    font-size: 0.95rem;
    max-width: 600px;
    margin: 0 auto 3rem auto;
    color: var(--ticket-text-bright);
    opacity: 0.9;
}

.wishas-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ============================================== */
/* DIGITAL WALLET UI */
/* ============================================== */
.wishas-app-container {
    padding-top: 80px; /* Ditambah untuk mengakomodasi scale 1.25 dari wallet yang mengembang */
    padding-bottom: 50px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.wallet {
  position: relative;
  width: 280px;
  height: 230px;
  cursor: pointer;
  perspective: 1000px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin: 30px auto; 
  transition: transform 0.4s ease;
  -webkit-tap-highlight-color: transparent;
  transform: scale(1.25); /* Ini adalah trik rahasia untuk memperbesar ukuran semua isi dompet sekaligus 25% tanpa merusak SVG */
}

.wallet-back {
  position: absolute;
  bottom: 0;
  width: 280px;
  height: 200px;
  background: var(--heading-text-color); /* Menyatu sempurna dengan warna latar belakang sobekan kertas */
  border-radius: 22px 22px 60px 60px;
  z-index: 5;
  box-shadow:
    inset 0 35px 45px rgba(0, 0, 0, 0.6), /* Menciptakan ilusi lubang/rongga gelap yang dalam menembus kertas latar */
    inset 0 5px 15px rgba(0, 0, 0, 0.8);
}

/* Cards things */
.wishas-card {
  position: absolute;
  width: 260px;
  height: 140px;
  left: 10px;
  border-radius: 16px;
  padding: 18px;
  color: white;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.3),
    0 -4px 15px rgba(0, 0, 0, 0.1);
  /* Use transform dynamically from JS classes */
  transition:
    transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
    z-index 0.3s;
  /* Prevent clicks from bleeding through to wallet if card is clicked */
  pointer-events: auto;
}

.wishas-card.light-card {
    box-shadow:
      inset 0 1px 1px rgba(0, 0, 0, 0.1),
      0 -4px 15px rgba(0, 0, 0, 0.1);
}

.card-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  pointer-events: none; /* Let clicks pass to parent .wishas-card */
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.chip {
  width: 32px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.light-card .chip {
   background: rgba(0, 0, 0, 0.05);
   border: 1px solid rgba(0, 0, 0, 0.1);
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  text-align: left;
}

.label {
  font-size: 8px;
  opacity: 0.7;
  text-transform: uppercase;
  margin-bottom: 2px;
  display: block;
}

.value {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

/* MIDDLE (NOMOR REKENING DI TENGAH KARTU) */
.card-middle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 5px;
}

.card-number-wrapper {
  text-align: left;
}

.hidden-stars {
  font-size: 16px; /* Dibesarkan layaknya kartu asli */
  letter-spacing: 3px;
}

.card-number {
  display: none;
  font-size: 16px; /* Dibesarkan */
  letter-spacing: 2px;
  font-family: monospace;
}

/* TOMBOL AKSI & QRIS IMAGE ANIMASI MUNCUL */
.card-action-btn {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.qris-img {
  opacity: 0;
  max-height: 0;
  transform: scale(0.5);
  transition: all 0.4s ease;
}

.btn-wishas-action {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: inherit;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
  transition: transform 0.1s ease;
}

.btn-wishas-action:active {
  transform: scale(0.9); /* Animasi tekan tombol statis */
}

.light-card .btn-wishas-action {
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.2);
}

.light-card .label {
  color: #8c979d;
}

/* Pocket Overlay */
.pocket {
  position: absolute;
  bottom: 0;
  width: 280px;
  height: 160px;
  z-index: 100; /* Diubah dari 40 ke 100 untuk menutupi tumpukan kartu yang jumlahnya bisa banyak */
  filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.15));
  pointer-events: none; /* Extremely important so clicks go to .wallet and .wishas-card */
}

.pocket-svg {
  width: 100%;
  height: 100%;
  /* Efek bayangan spesifik untuk memberikan kedalaman (rongga realistis)
     antara saku depan dan kartu di belakangnya. Shadow ini dilempar ke arah atas (-15px) */
  filter: drop-shadow(0 -15px 20px rgba(0, 0, 0, 0.4));
}

.pocket-content {
  position: absolute;
  top: 55px;
  width: 100%;
  text-align: center;
  z-index: 110; /* Menyesuaikan dengan saku yang ditinggikan nilainya */
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.pocket-instruction {
  color: var(--heading-text-color); /* Warnanya dicerahkan sesuai warna utama tema */
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px dashed var(--heading-text-color); /* Border putus-putus mempertegas fungsi klik */
  padding: 6px 16px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 6px;
  animation: pulseInstruction 2.5s infinite ease-in-out;
}

@keyframes pulseInstruction {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; border-color: rgba(255,255,255, 0.8); }
  100% { transform: scale(1); opacity: 0.8; }
}

.balance-real {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, 0px);
}

/* ============================================== */
/* INTERACTION LOGIC (2-STEP TAP) */
/* ============================================== */

/* PEEKING STATE (Langkah 1: Dompet diketuk) */
.wallet.is-peeking {
  transform: scale(1.25) translateY(-5px); /* Mempertahankan skala 1.25 sekaligus mengangkat dompet 5px */
}

.wallet.is-peeking .wishas-card {
  /* JS sets --peek-y and --peek-rot based on loop index */
  transform: translateY(var(--peek-y)) rotate(var(--peek-rot));
}

/* SELECTED STATE (Langkah 2: Kartu ditarik keluar penuh) */
.wishas-card.is-selected {
  /* Shoot out card completely */
  transform: translateY(-110px) scale(1.05) rotate(0) !important;
  z-index: 200 !important; /* Ditinggikan agar begitu tersentuh, kartunya langsung melompat menimpa (keluar) saku dompet  */
}

.wishas-card.is-selected .hidden-stars {
  display: none;
}

.wishas-card.is-selected .card-number {
  display: block;
}

.wishas-card.is-selected .card-action-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0.2s; /* Tombol ini baru muncul dengan efek melompat naik (slide-up) setelah kartunya tercabut keluar */
}

.wishas-card.is-selected .qris-img {
  opacity: 1;
  max-height: 200px;
  transform: scale(1);
  margin-top: 10px;
}

/* Tooltip Copy Feedback */
.copy-feedback {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--overlay-black-dark);
    color: var(--ticket-text-bright);
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}

.wishas-card.copied-flash .copy-feedback {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

/* ============================================== */
/* MODAL STYLE (QRIS Popup) */
/* ============================================== */
.qris-modal-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: var(--overlay-black-dark);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: all 0.3s;
}

.qris-modal-overlay.active { opacity: 1; visibility: visible; }

.qris-modal-content {
    background: var(--ticket-text-bright);
    width: 90%; max-width: 320px;
    padding: 2rem; border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-dark);
    transform: scale(0.8); transition: transform 0.3s;
}

.qris-modal-overlay.active .qris-modal-content { transform: scale(1); }

.qris-header h3 {
    font-family: var(--sacramento); font-size: 2rem;
    color: var(--heading-text-color); margin: 0;
}

.qris-header p {
    font-size: 0.9rem; font-weight: 600;
    color: var(--main-text-color); margin-bottom: 1rem;
}

.qris-image-wrapper {
    background: var(--ticket-text-bright); padding: 10px;
    border: 2px dashed var(--heading-text-color);
    border-radius: 12px; margin-bottom: 1rem; display: inline-block;
}

.qris-image-wrapper img { width: 100%; max-width: 200px; display: block; }

.qris-actions { display: flex; flex-direction: column; gap: 10px; }

.qris-btn {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    width: 100%; padding: 10px; border-radius: 50px;
    font-weight: 600; text-decoration: none; border: none; cursor: pointer;
    font-size: 0.9rem; transition: all 0.3s ease;
}

.qris-btn.download { background: var(--heading-text-color); color: var(--ticket-text-bright); }
.qris-btn.download:hover { background: var(--button-primary-bg); }
.qris-btn.close { background: var(--input-bg-color); color: var(--main-text-color); border: 1px solid var(--border-color); }
.qris-btn.close:hover { background: var(--welcome-button-hover-bg); opacity: 0.8; }
