/* Glam Financial Manager - White & Soft Lavender Mobile-Optimized Theme */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,700;1,500&family=Prompt:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600&display=swap');

:root {
  --bg-primary: #FAF8FF;
  --bg-secondary: #F3EDFD;
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: rgba(216, 180, 254, 0.4);
  
  --lavender-50: #FBF8FF;
  --lavender-100: #F3EDFD;
  --lavender-200: #E7D8FC;
  --lavender-300: #D8B4FE;
  --lavender-500: #A855F7;
  --lavender-600: #9333EA;
  --lavender-700: #7E22CE;
  
  --gold-accent: #D4AF37;
  --gold-glow: rgba(212, 175, 55, 0.25);
  --pink-accent: #F472B6;
  --emerald-accent: #10B981;
  --red-accent: #EF4444;
  
  --text-dark: #2E1065;
  --text-muted: #6B7280;
  --text-light: #8B5CF6;
  
  --shadow-glam: 0 8px 24px -4px rgba(147, 51, 234, 0.08), 0 2px 6px rgba(0, 0, 0, 0.02);
  --shadow-glow: 0 0 25px rgba(216, 180, 254, 0.45);
  --radius-card: 20px;
  --radius-sm: 14px;
}

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

body {
  font-family: 'Prompt', 'Sarabun', sans-serif;
  background: linear-gradient(135deg, #FAF8FF 0%, #F5EEFD 45%, #F0E6FF 100%);
  color: var(--text-dark);
  min-height: 100vh;
  padding-bottom: 95px; /* space for bottom navigation bar */
}

.glam-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 14px;
}

/* Glassmorphism Card */
.glam-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-glam);
  padding: 20px;
  margin-bottom: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Sacred Header Banner */
.sacred-header-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(246, 240, 253, 0.94) 100%);
  border: 1.5px solid rgba(216, 180, 254, 0.6);
  border-radius: 24px;
  box-shadow: var(--shadow-glow), 0 8px 28px rgba(147, 51, 234, 0.1);
  margin-bottom: 18px;
  overflow: hidden;
  position: relative;
}

.sacred-header-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
}

.ganesha-frame {
  position: relative;
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, #D4AF37, #E9D5FF, #9333EA, #D4AF37);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4), 0 6px 16px rgba(147, 51, 234, 0.2);
  animation: auraGlow 4s infinite alternate ease-in-out;
}

@keyframes auraGlow {
  0% { box-shadow: 0 0 16px rgba(212, 175, 55, 0.35), 0 6px 14px rgba(147, 51, 234, 0.18); }
  100% { box-shadow: 0 0 28px rgba(212, 175, 55, 0.6), 0 8px 22px rgba(168, 85, 247, 0.3); }
}

.ganesha-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
}

.header-text-block {
  flex: 1;
  min-width: 0;
}

.greeting-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F3EDFD;
  border: 1px solid var(--lavender-300);
  color: var(--lavender-700);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 6px;
}

.header-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #3B0764;
  line-height: 1.3;
  margin-bottom: 4px;
}

.header-title .glam-highlight {
  background: linear-gradient(120deg, #7E22CE 0%, #C084FC 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: 'Playfair Display', serif;
}

.header-blessing {
  font-size: 0.9rem;
  font-weight: 600;
  color: #B45309;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mantra-box {
  background: rgba(255, 255, 255, 0.9);
  border-left: 3px solid var(--gold-accent);
  padding: 8px 12px;
  border-radius: 0 10px 10px 0;
  font-size: 0.82rem;
  color: #4C1D95;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.mantra-text {
  font-style: italic;
  font-weight: 500;
}

.bless-btn {
  background: linear-gradient(135deg, #D4AF37 0%, #B45309 100%);
  color: #FFFFFF;
  border: none;
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(212, 175, 55, 0.3);
  transition: transform 0.15s ease;
  white-space: nowrap;
}

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

/* Month Switcher Toolbar */
.toolbar-month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.month-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  padding: 6px 14px;
  border-radius: 24px;
  border: 1px solid var(--lavender-300);
  box-shadow: 0 2px 6px rgba(147, 51, 234, 0.05);
  font-size: 0.9rem;
}

.month-select {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-dark);
  background: transparent;
  cursor: pointer;
  max-width: 170px;
}

.month-nav-arrow {
  background: #F3EDFD;
  border: 1px solid var(--lavender-300);
  color: var(--lavender-700);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.month-nav-arrow:active {
  transform: scale(0.92);
  background: var(--lavender-300);
  color: #4C1D95;
}

/* Segmented Top Nav (Desktop / Tablet) */
.segmented-nav {
  display: flex;
  gap: 6px;
  background: rgba(243, 237, 253, 0.8);
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--lavender-300);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  flex: 1;
  min-width: 90px;
  padding: 9px 12px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--lavender-700);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-tab-btn.active {
  background: #FFFFFF;
  color: #4C1D95;
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.15);
}

/* Bottom Navigation Bar for Mobile */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--lavender-300);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 999;
  box-shadow: 0 -4px 20px rgba(147, 51, 234, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  background: transparent;
  border: none;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  padding: 4px;
}

.bottom-tab-icon {
  font-size: 1.35rem;
  transition: transform 0.2s;
}

.bottom-tab-label {
  font-size: 0.72rem;
  font-weight: 600;
}

.bottom-tab-item.active {
  color: #7E22CE;
}

.bottom-tab-item.active .bottom-tab-icon {
  transform: translateY(-2px) scale(1.1);
}

.bottom-tab-item.active .bottom-tab-label {
  color: #7E22CE;
  font-weight: 700;
}

/* Tab Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-panel.active {
  display: block;
}

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

/* Stat Cards Grid */
.stat-grid-mobile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.stat-grid-mobile .stat-card.full-width {
  grid-column: span 2;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid rgba(216, 180, 254, 0.4);
  border-radius: var(--radius-sm);
  padding: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-glam);
}

.stat-card.accent-purple { border-top: 3px solid var(--lavender-500); }
.stat-card.accent-pink { border-top: 3px solid var(--pink-accent); }
.stat-card.accent-gold { border-top: 3px solid var(--gold-accent); }
.stat-card.accent-emerald { border-top: 3px solid var(--emerald-accent); }

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

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-icon {
  font-size: 1.2rem;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Food & Living Budget Highlight */
.food-budget-highlight {
  background: linear-gradient(135deg, #FFFFFF 0%, #FAF5FF 100%);
  border: 1.5px solid var(--lavender-300);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.08);
  margin-bottom: 18px;
}

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

.food-badge-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.food-icon-large {
  font-size: 2rem;
  background: #F3EDFD;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  box-shadow: 0 3px 10px rgba(147, 51, 234, 0.1);
  flex-shrink: 0;
}

.food-title-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #4C1D95;
}

.food-title-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-edit-food-budget {
  background: linear-gradient(135deg, var(--lavender-600) 0%, var(--lavender-700) 100%);
  color: #FFFFFF;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(126, 34, 206, 0.25);
  transition: transform 0.15s;
  white-space: nowrap;
}

.btn-edit-food-budget:active {
  transform: scale(0.96);
}

.food-summary-badges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.food-summary-pill {
  background: #FFFFFF;
  border: 1px solid var(--lavender-200);
  border-radius: 12px;
  padding: 8px 10px;
  text-align: center;
}

.pill-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.pill-value {
  font-size: 0.95rem;
  font-weight: 700;
}

.progress-bar-wrap {
  background: #E9D5FF;
  border-radius: 10px;
  height: 14px;
  overflow: hidden;
  margin: 10px 0 6px 0;
}

.progress-bar-fill {
  background: linear-gradient(90deg, #A855F7, #EC4899);
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6B7280;
}

/* Section Title */
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #3B0764;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -8px;
  margin-bottom: 16px;
}

/* Quick Actions Strip */
.quick-action-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.quick-action-btn {
  background: #FFFFFF;
  border: 1px solid var(--lavender-300);
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.05);
  transition: transform 0.15s;
}

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

.quick-action-icon {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.quick-action-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: #4C1D95;
}

/* Payslip Drop Area */
.payslip-dropzone {
  border: 2px dashed var(--lavender-300);
  background: rgba(243, 237, 253, 0.4);
  border-radius: 16px;
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 14px;
}

.payslip-dropzone:active, .payslip-dropzone.dragover {
  border-color: var(--lavender-600);
  background: rgba(243, 237, 253, 0.85);
}

.dropzone-icon {
  font-size: 2rem;
  margin-bottom: 6px;
}

.dropzone-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #4C1D95;
  margin-bottom: 2px;
}

.dropzone-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sample-payslip-btn {
  background: linear-gradient(135deg, #F3EDFD 0%, #E9D5FF 100%);
  color: var(--lavender-700);
  border: 1px solid var(--lavender-300);
  padding: 7px 14px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  transition: all 0.15s;
}

.sample-payslip-btn:active {
  transform: scale(0.96);
}

/* Forms & Inputs */
.glam-input-group {
  margin-bottom: 12px;
}

.glam-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #4C1D95;
  margin-bottom: 4px;
}

.glam-input, .glam-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--lavender-300);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-dark);
  background: #FFFFFF;
  -webkit-appearance: none;
  transition: border-color 0.2s;
}

.glam-input:focus, .glam-select:focus {
  border-color: var(--lavender-600);
  outline: none;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.btn-glam-primary {
  background: linear-gradient(135deg, #9333EA 0%, #7E22CE 100%);
  color: #FFFFFF;
  border: none;
  padding: 11px 20px;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 14px rgba(147, 51, 234, 0.22);
  transition: transform 0.15s;
}

.btn-glam-primary:active {
  transform: scale(0.97);
}

/* Fixed Costs List */
.fixed-cost-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #FAF8FF;
  border: 1px solid rgba(216, 180, 254, 0.35);
  border-radius: 12px;
  margin-bottom: 8px;
}

.fixed-cost-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fixed-cost-amount {
  font-weight: 700;
  font-size: 0.92rem;
  color: #3B0764;
}

/* Tables */
.glam-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.glam-table th {
  text-align: left;
  padding: 8px 10px;
  background: #F3EDFD;
  color: #4C1D95;
  font-weight: 600;
  border-bottom: 2px solid var(--lavender-200);
}

.glam-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #F3EDFD;
}

.glam-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 16px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-food { background: #FEF3C7; color: #B45309; }
.badge-transport { background: #DBEAFE; color: #1E40AF; }
.badge-shopping { background: #FCE7F3; color: #9D174D; }
.badge-salary { background: #DCFCE7; color: #166534; }
.badge-extra { background: #F3E8FF; color: #6B21A8; }

/* Code / JSON Box */
.json-preview-card {
  background: #1E1B4B;
  color: #E0E7FF;
  border-radius: 12px;
  padding: 14px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  line-height: 1.35;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 10px;
}

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

.glam-modal {
  background: #FFFFFF;
  border-radius: 22px;
  padding: 22px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--lavender-300);
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Toast */
.glam-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -100px);
  background: #2E1065;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 1200;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  max-width: 90%;
  text-align: center;
  pointer-events: none;
}

.glam-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* Sparkle */
.sparkle-effect {
  position: fixed;
  pointer-events: none;
  animation: sparkleAnim 1s ease-out forwards;
  z-index: 9999;
}

@keyframes sparkleAnim {
  0% { transform: scale(0) rotate(0deg); opacity: 1; }
  100% { transform: scale(1.6) rotate(180deg); opacity: 0; }
}

/* Mobile Media Queries */
@media (max-width: 600px) {
  .header-inner {
    padding: 14px 16px;
    gap: 14px;
  }
  .ganesha-frame {
    width: 75px;
    height: 75px;
  }
  .header-title {
    font-size: 1.15rem;
  }
  .header-blessing {
    font-size: 0.8rem;
  }
  .mantra-box {
    font-size: 0.78rem;
  }
  .glam-card {
    padding: 16px;
  }
  .stat-value {
    font-size: 1.2rem;
  }
}

/* Live Realtime Sync Indicator */
@keyframes pulseDot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(1.35);
  }
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  display: inline-block;
  animation: pulseDot 2s infinite ease-in-out;
}
