:root {
  --primary: #2563eb;
  --bg: #f3f4f6;
  --text: #1f2937;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

/* Auth */
.screen {
  display: none;
  height: 100%;
  width: 100%;
  flex-direction: column;
}
.screen.active {
  display: flex;
}
.center-box {
  margin: auto;
  text-align: center;
  padding: 20px;
}
.btn-google {
  background: #db4437;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 16px;
}

/* Layout */
#appScreen {
  height: 100%;
  display: flex;
  flex-direction: column;
}

header {
  background: var(--primary);
  color: white;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
}
.header-actions {
  display: flex;
  gap: 15px;
}
.logo {
  font-weight: bold;
  font-size: 1.2rem;
}
.icon-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
}

#contentArea {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 15px;
  padding-bottom: 100px;
}

/* Tab Logic */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}
.tab-content.active {
  display: block;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Wallet UI */
.date-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
}
#monthPicker {
  border: none;
  background: white;
  padding: 8px 15px;
  border-radius: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.btn-year {
  border: none;
  background: white;
  color: var(--primary);
  padding: 8px 15px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.wallet-card {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: white;
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.wallet-card h1 {
  font-size: 2.2rem;
  margin: 0 0 20px 0;
  font-weight: 700;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.15);
  padding: 10px 15px;
  border-radius: 12px;
}
.vertical-line {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, 0.3);
}
.arrow-up {
  color: #86efac;
  font-size: 0.8rem;
}
.arrow-down {
  color: #fca5a5;
  font-size: 0.8rem;
}
.val {
  font-weight: bold;
  font-size: 1rem;
}

/* Budget Bar */
.budget-health {
  background: white;
  padding: 15px;
  border-radius: 15px;
  margin-bottom: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.health-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 8px;
  font-weight: bold;
  color: #555;
}
.progress-bg {
  height: 10px;
  background: #eee;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 5px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.5s ease;
  border-radius: 10px;
}
.budget-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 5px;
  border-top: 1px dashed #eee;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: #666;
}
.dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-indicator.green {
  background: #10b981;
}
.dot-indicator.orange {
  background: #f59e0b;
}
.dot-indicator.red {
  background: #ef4444;
}

/* Actions */
.quick-actions {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
}
.quick-actions > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.circle-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}
.circle-btn:active {
  transform: scale(0.9);
}
.circle-btn.inc {
  background: #10b981;
}
.circle-btn.exp {
  background: #ef4444;
}
.circle-btn.sub {
  background: #f59e0b;
}
.quick-actions span {
  font-size: 0.8rem;
  color: #555;
  font-weight: bold;
}

/* Lists */
.section-title {
  font-size: 1rem;
  color: #777;
  margin: 0 0 10px 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.horizontal-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.sub-card {
  min-width: 120px;
  background: white;
  padding: 12px;
  border-radius: 12px;
  border-left: 4px solid #f59e0b;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.trans-item {
  display: flex;
  align-items: center;
  background: white;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.t-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-right: 12px;
  flex-shrink: 0;
}
.t-icon.income {
  background: #d1fae5;
  color: #059669;
}
.t-icon.expense {
  background: #fee2e2;
  color: #dc2626;
}
.t-info {
  flex: 1;
}
.t-title {
  font-weight: bold;
  color: #333;
  margin-bottom: 3px;
  display: block;
}
.t-date {
  font-size: 0.75rem;
  color: #888;
}
.t-amount {
  font-weight: bold;
  font-size: 1rem;
}
.t-amount.income {
  color: #10b981;
}
.t-amount.expense {
  color: #ef4444;
}

/* 1. Container (အဓိက ဘောင်) */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 15px;
  margin: 0 auto; /* အလယ်တည့်တည့်ပို့မယ် */
}

/* 2. Grid Menu (Guides, Near Me, Care တို့အတွက်) */
.grid-menu {
  display: grid;
  gap: 15px;
  width: 100%;
  grid-template-columns: repeat(2, 1fr);
}

#tab-wallet {
  width: 100%;
}

.menu-item {
  padding: 20px 10px;
  border-radius: 15px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 140px;
  transition: transform 0.2s;
}
.menu-item:active {
  transform: scale(0.95);
}
.g-icon {
  font-size: 45px;
  margin-bottom: 10px;
  line-height: 1;
}
.g-title {
  font-size: 14px;
  font-weight: bold;
  line-height: 1.4;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  display: flex;
  border-top: 1px solid #ddd;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
  height: 60px;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #6b7280;
  cursor: pointer;
}
.nav-item.active {
  color: var(--primary);
}
.nav-item i {
  font-size: 1.2rem;
  margin-bottom: 2px;
}
.nav-item span {
  font-size: 0.7rem;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-box {
  background: white;
  padding: 20px;
  border-radius: 10px;
  width: 85%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box.full-screen {
  width: 100%;
  height: 100%;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.guide-body {
  flex: 1;
  overflow-y: auto;
  line-height: 1.6;
  padding: 10px;
}

/* Tooltip */
.tooltip-btn {
  position: relative;
}
.tooltip-btn:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 100;
  opacity: 0.9;
  margin-bottom: 8px;
  pointer-events: none;
}

/* Inputs */
input,
select {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 16px;
}
button.primary {
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  width: 100%;
  font-size: 16px;
  cursor: pointer;
}

/* --- MODAL BUTTONS REDESIGN --- */

/* Modal အတွင်းရှိ ခလုတ်များကို စီမည့်ပုံစံ */
.modal-box .row {
  display: flex;
  flex-direction: column-reverse; /* Cancel ကို အောက်၊ Save ကို အပေါ် ပို့မည် */
  gap: 12px; /* ခလုတ်နှစ်ခုကြား နေရာခွာမည် */
  margin-top: 25px;
}

/* Save Button (အပြာရောင်) */
.modal-box button.primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3); /* အရိပ်ထည့်မည် */
  cursor: pointer;
  transition: transform 0.1s;
}

.modal-box button.primary:active {
  transform: scale(0.98); /* နှိပ်ရင် ကျုံ့သွားမယ် */
}

/* Cancel Button (မီးခိုးရောင်) */
.modal-box button:not(.primary) {
  width: 100%;
  padding: 14px;
  background: #f3f4f6; /* နောက်ခံ မီးခိုးနု */
  color: #6b7280; /* စာလုံး မီးခိုးရင့် */
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.modal-box button:not(.primary):active {
  background: #e5e7eb;
}

/* Tablet / iPad (မျက်နှာပြင် အလယ်အလတ်) */
@media (min-width: 600px) {
  .game-container {
    max-width: 90%; /* ဘေးဘောင် နည်းနည်းချန်မယ် */
  }
  .grid-menu {
    grid-template-columns: repeat(3, 1fr); /* ၃ တိုင် ဖြစ်သွားမယ် */
  }
}

/* Desktop / Laptop (မျက်နှာပြင် အကျယ်ကြီး) */
@media (min-width: 1024px) {
  .game-container {
    max-width: 1100px; /* Desktop မှာ ၁၁၀၀ px ထက် မကျယ်စေရ */
  }

  .grid-menu {
    grid-template-columns: repeat(
      4,
      1fr
    ); /* ၄ တိုင် သပ်သပ်ရပ်ရပ် ဖြစ်သွားမယ် */
    gap: 20px;
  }

  /* Wallet Tab ကိုတော့ Desktop မှာ အရမ်းကားမနေအောင် ထိန်းမယ် */
  #tab-wallet {
    /* max-width: 1200px;  */
    /* Wallet ကိုတော့ ဖုန်းဆိုဒ်နီးပါးပဲ ပြမယ် */
    margin: 0 auto; /* အလယ်ပို့မယ် */
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05); /* သပ်ရပ်အောင် အရိပ်ထည့်မယ် */
  }
}

/* --- MENU ITEM HOVER EFFECT (Desktop အတွက်) --- */
@media (hover: hover) {
  .menu-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
  }
  .map-btn:hover {
    background-color: #f0f9ff;
    border-color: var(--primary);
  }
}

/* --- INSTALL TOOLTIP STYLES --- */
.install-box {
  position: relative; /* Tooltip တည်နေရာအတွက် */
  display: inline-block;
}

/* ပုံမှန်အချိန်မှာ ဖျောက်ထားမည် */
.install-tip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: 100%; /* ခလုတ်ရဲ့ အောက်တည့်တည့် */
  right: 0; /* ညာဘက်ကပ် */
  background-color: #333;
  color: #fff;
  width: 220px;
  padding: 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s, visibility 0.3s;
  margin-top: 10px; /* ခလုတ်နဲ့ နည်းနည်းခွာမယ် */
}

/* မျှားခေါင်းလေး (အပေါ်ထောင်) */
.install-tip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  right: 15px; /* ခလုတ်နဲ့ တည့်အောင် ချိန် */
  border-width: 8px;
  border-style: solid;
  border-color: transparent transparent #333 transparent;
}

/* Hover လုပ်ရင် ပေါ်လာမည် */
.install-box:hover .install-tip {
  visibility: visible;
  opacity: 1;
}

/* Mobile မှာ နှိပ်ရင် ပျောက်မသွားအောင် (Optional) */
.install-box:active .install-tip {
  visibility: visible;
  opacity: 1;
}

/* Mobile မှာ နှိပ်ရင် ပေါ်မည့် Class (JS ကနေ ထည့်ပေးမှာပါ) */
.install-tip.show-mobile {
  visibility: visible !important;
  opacity: 1 !important;
  top: 120%; /* လက်နဲ့မကွယ်အောင် နည်းနည်းအောက်ချ */
}

/* --- MODAL CLOSE BUTTON (X) FIX --- */

/* Modal Header ထဲက Button ကို သီးသန့် ပြင်မယ် */
.modal-header button {
  width: 35px !important; /* အကျယ် အသေပေးမယ် (မရှည်တော့ဘူး) */
  height: 35px !important; /* အမြင့် အသေပေးမယ် (အဝိုင်းဖြစ်ဖို့) */
  background-color: #f3f4f6; /* နောက်ခံ မီးခိုးနု */
  color: #ef4444; /* (x) ကို အနီရောင် ထားမယ် */
  border: none;
  border-radius: 50%; /* အဝိုင်းပုံစံ */
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;

  /* စာလုံးကို အလယ်တည့်တည့်ပို့မယ် */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

/* Mouse တင်ရင် အရောင်ပြောင်းမယ် */
.modal-header button:hover {
  background-color: #ef4444;
  color: white;
  transform: scale(1.1);
}

/* --- HEADER USER PROFILE --- */
.header-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2); /* အကြည်ရောင် နောက်ခံ */
  padding: 5px 12px 5px 5px;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.3s;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.header-profile:hover {
  background: rgba(255, 255, 255, 0.35);
}

.header-profile img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
}

.header-profile span {
  color: white;
  font-weight: bold;
  font-size: 14px;
  max-width: 100px; /* နာမည်ရှည်ရင် နေရာမစားအောင် */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile Responsive: ဖုန်းသေးရင် နာမည်ဖျောက်ပြီး ပုံပဲပြမယ် */
@media (max-width: 400px) {
  .header-profile span {
    display: none;
  }
  .header-profile {
    padding: 5px; /* စာမပါတော့ ပိုကျဉ်းမယ် */
    border-radius: 50%;
  }
  .header-profile i {
    display: none; /* Icon ပါ ဖျောက်မယ် */
  }
}

/* --- APP FOOTER --- */
.app-footer {
  text-align: center;
  padding: 20px;
  color: #9ca3af;
  font-size: 0.85rem;
  margin-top: 20px;
  border-top: 1px solid #e5e7eb;
  width: 100%;
}

/* --- PRICING UI --- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.price-card {
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 15px 10px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  background: white;
}

.price-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
  border-color: #2563eb;
}

.price-card h3 {
  margin: 0 0 5px 0;
  font-size: 1rem;
  color: #555;
}
.price {
  font-size: 1.3rem;
  font-weight: bold;
  color: #2563eb;
  margin-bottom: 5px;
}

/* Badges */
.price-card.popular {
  border: 2px solid #2563eb;
  background: #f0f9ff;
}
.badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #2563eb;
  color: white;
  padding: 2px 8px;
  font-size: 0.7rem;
  border-radius: 20px;
  font-weight: bold;
}

.price-card.premium {
  background: linear-gradient(135deg, #1e1e2f 0%, #2d2d44 100%);
  border: none;
  color: white;
}
.price-card.premium h3,
.price-card.premium small {
  color: #ccc;
}
.price-card.premium .price {
  color: #ffd700;
}