/* ==========================================================================
   VÍ HEO ĐẤT NFC - ULTRA-MINIMAL NFC UI
   Chạm Thẻ Vào iPhone ➔ Mở Thẳng Ví Với 3 Thông Số Tinh Gọn
   ========================================================================== */

:root {
  --primary-pink: #f43f5e;
  --primary-rose: #e11d48;
  --kid-green: #10b981;
  --kid-green-dark: #059669;
  --kid-orange: #f59e0b;
  --kid-orange-dark: #d97706;
  --kid-blue: #3b82f6;

  --bg-gradient: linear-gradient(145deg, #fff1f2 0%, #f0fdf4 45%, #eff6ff 100%);
  
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --font-display: 'Comfortaa', cursive, sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-pill: 9999px;

  --shadow-card: 0 12px 28px -6px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 18px 36px -6px rgba(0, 0, 0, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--slate-800);
  min-height: 100vh;
  padding: 16px;
  display: flex;
  justify-content: center;
}

.app-wrapper {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* SCREEN MANAGEMENT */
.view-screen {
  display: none !important;
  flex-direction: column;
  gap: 16px;
}

.view-screen.active {
  display: flex !important;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   1. NFC PROMPT SCREEN (MÀN HÌNH CHỜ QUẸT THẺ)
   ========================================================================== */

.prompt-container {
  gap: 16px;
}

.top-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px;
}

.brand-mini {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--slate-900);
}

.btn-text-link {
  background: white;
  border: 1px solid var(--slate-200);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--slate-700);
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.nfc-scan-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow-card);
  border: 2px solid var(--slate-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}

.nfc-radar-rings {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nfc-center-icon {
  font-size: 3.5rem;
  z-index: 2;
  animation: bounceSlow 2s infinite ease-in-out;
}

@keyframes bounceSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--primary-pink);
  opacity: 0.3;
  animation: pulseRing 2.5s infinite linear;
}

.ring-1 { width: 90px; height: 90px; animation-delay: 0s; }
.ring-2 { width: 120px; height: 120px; animation-delay: 1.25s; }

@keyframes pulseRing {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

.prompt-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--slate-900);
}

.prompt-desc {
  font-size: 0.95rem;
  color: var(--slate-600);
  line-height: 1.4;
  max-width: 380px;
}

.nfc-tip-box {
  background: #fef2f2;
  border: 1px dashed var(--primary-pink);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: #991b1b;
  text-align: left;
  line-height: 1.5;
  width: 100%;
}

.nfc-tip-box code {
  background: rgba(244, 63, 94, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-block;
  margin-top: 4px;
}

/* ADMIN PIN DRAWER */
.admin-login-drawer {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  border: 2px solid var(--slate-100);
  animation: fadeIn 0.2s ease;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.drawer-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-close-drawer {
  background: var(--slate-100);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 800;
}

/* ==========================================================================
   2. GIAO DIỆN CHÍNH CỦA BÉ (3 THÔNG SỐ SIÊU TINH GỌN)
   ========================================================================== */

.kid-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-card);
  border: 1.5px solid var(--slate-100);
}

.kid-badge-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-emoji {
  font-size: 2rem;
  width: 44px;
  height: 44px;
  background: #ffe4e6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kid-badge-user h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.2;
}

.kid-badge-user small {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--slate-500);
  font-weight: 700;
}

.btn-exit {
  background: #fee2e2;
  color: #991b1b;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}

/* 1. THẺ SỐ DƯ HIỆN TẠI */
.piggy-balance-card {
  background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 16px 32px rgba(225, 29, 72, 0.28);
  position: relative;
  overflow: hidden;
}

.piggy-coin-icon {
  font-size: 3.2rem;
  margin-bottom: 6px;
}

.balance-subtext {
  font-size: 0.95rem;
  font-weight: 700;
  opacity: 0.92;
  display: block;
  margin-bottom: 6px;
}

.balance-huge-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.balance-huge-value span:first-child {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: white;
  text-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

.currency-symbol {
  font-size: 1.3rem;
  font-weight: 900;
  color: #fef08a;
}

.balance-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

/* 2 & 3. HAI NÚT YÊU CẦU NẠP & RÚT */
.kid-dual-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.action-card-btn {
  background: white;
  border: 2.5px solid var(--slate-100);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.action-card-btn:active {
  transform: scale(0.96);
}

.action-card-btn.btn-action-deposit {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.action-card-btn.btn-action-withdraw {
  border-color: #fed7aa;
  background: #fffbeb;
}

.action-bubble {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.action-bubble.bg-green { background: #d1fae5; }
.action-bubble.bg-orange { background: #ffedd5; }

.action-texts h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--slate-900);
  margin-bottom: 2px;
}

.action-texts p {
  font-size: 0.78rem;
  color: var(--slate-600);
  font-weight: 700;
  line-height: 1.3;
}

.action-chevron {
  font-size: 1rem;
  color: var(--slate-400);
  font-weight: 800;
}

/* RECENT STATUS BOX */
.kid-recent-status-box {
  background: white;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-card);
  border: 1.5px solid var(--slate-100);
}

.status-box-header {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--slate-700);
  margin-bottom: 10px;
}

.status-box-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-status-msg {
  font-size: 0.82rem;
  color: var(--slate-500);
  text-align: center;
  padding: 6px;
}

.recent-req-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--slate-50);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  border: 1px solid var(--slate-200);
  gap: 10px;
}

.recent-req-left strong {
  display: block;
  color: var(--slate-900);
}

.recent-req-left small {
  color: var(--slate-500);
  font-size: 0.75rem;
}

.tag-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.tag-badge.pending { background: #fef3c7; color: #92400e; }
.tag-badge.approved { background: #d1fae5; color: #065f46; }
.tag-badge.rejected { background: #fee2e2; color: #991b1b; }

/* ==========================================================================
   3. GIAO DIỆN PHỤ HUYNH / ADMIN
   ========================================================================== */

.session-header-bar {
  background: white;
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  border: 2px solid var(--slate-100);
}

.session-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-avatar.admin {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  background: #ede9fe;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.session-details h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--slate-900);
}

.session-details span {
  font-size: 0.75rem;
  color: var(--slate-500);
  font-weight: 700;
}

.btn-logout {
  background: #fee2e2;
  color: #991b1b;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}

.admin-nav-bar {
  display: flex;
  background: white;
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  box-shadow: var(--shadow-card);
}

.admin-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--slate-600);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.admin-tab-btn.active {
  background: var(--slate-900);
  color: white;
}

.badge-count {
  background: var(--primary-pink);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

.admin-sub-panel { display: none; }
.admin-sub-panel.active { display: block; }

.panel-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--slate-200);
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--slate-200);
  flex-wrap: wrap;
  gap: 8px;
}

.header-titles h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--slate-900);
}

.header-titles p {
  font-size: 0.8rem;
  color: var(--slate-600);
}

.btn-refresh {
  background: var(--slate-100);
  border: 1px solid var(--slate-300);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

/* REQUESTS LIST */
.requests-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.request-card {
  border: 2px solid #fcd34d;
  background: #fffbeb;
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.request-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.req-avatar {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.req-details h4 {
  font-size: 1rem;
  color: var(--slate-900);
}

.req-badge-type {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-right: 6px;
}

.req-badge-type.add { background: #d1fae5; color: #065f46; }
.req-badge-type.subtract { background: #fee2e2; color: #991b1b; }

.req-note {
  font-size: 0.82rem;
  color: var(--slate-700);
  margin-top: 2px;
}

.request-card-actions {
  display: flex;
  gap: 8px;
}

.btn-approve {
  background: var(--kid-green);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-reject {
  background: #fee2e2;
  color: #991b1b;
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
}

/* FORMS & MODALS */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-field label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--slate-700);
}

.input-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--slate-300);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--slate-50);
}

.input-control.font-large {
  font-size: 1.3rem;
  font-weight: 800;
  font-family: var(--font-display);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
  .kid-dual-actions { grid-template-columns: 1fr; }
}

.segmented-action-group {
  display: flex;
  background: var(--slate-100);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.segmented-action-group input { display: none; }

.seg-btn {
  flex: 1;
  text-align: center;
  padding: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--slate-600);
}

.segmented-action-group input#admin-act-add:checked + .seg-btn {
  background: #d1fae5;
  color: #065f46;
}

.segmented-action-group input#admin-act-sub:checked + .seg-btn {
  background: #fee2e2;
  color: #991b1b;
}

.quick-chips-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.chip-btn {
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--slate-700);
  cursor: pointer;
}

.btn-primary-action {
  background: var(--slate-900);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.btn-primary-action.green { background: var(--kid-green); }
.btn-primary-action.orange { background: var(--kid-orange-dark); }
.btn-secondary {
  background: var(--slate-100);
  color: var(--slate-700);
  border: 1px solid var(--slate-300);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
}

/* DATA TABLE */
.table-container { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th, .data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--slate-200);
}
.data-table th { background: var(--slate-50); font-weight: 800; }

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  position: relative;
}

.modal-header.green-theme { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.modal-header.orange-theme { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }

.modal-icon { font-size: 1.8rem; }
.modal-header h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; }
.modal-header p { font-size: 0.78rem; opacity: 0.9; }

.modal-close-btn {
  position: absolute;
  top: 14px; right: 14px;
  background: rgba(255, 255, 255, 0.2);
  border: none; color: white;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 800;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quick-reason-pills {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px;
}
.reason-pill {
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem; font-weight: 700;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* TOASTS */
.toast-container {
  position: fixed;
  bottom: 20px; right: 20px; left: 20px;
  max-width: 380px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--slate-900);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem; font-weight: 700;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  pointer-events: auto;
}

.empty-state { text-align: center; padding: 30px; color: var(--slate-600); }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 8px; }
.hidden { display: none !important; }
