/* ==========================================================================
   EXIP SYSTEM — Core Premium Stylesheet
   Design Philosophy: Minimal, Glassmorphism, Tactile Micro-animations, Mobile First
   CRITICAL CONSTRAINT: Absolutely ZERO letter-spacing rules are present.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme Variables & Reset
   -------------------------------------------------------------------------- */
:root {
  --bg-app: #070b13;
  --bg-gradient: linear-gradient(135deg, #070b13 0%, #0d1527 100%);
  --card-bg: rgba(13, 20, 37, 0.7);
  --card-border: rgba(255, 255, 255, 0.06);
  --card-hover-border: rgba(99, 102, 241, 0.25);
  
  --text-main: #f3f4f6;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --input-bg: rgba(7, 11, 19, 0.6);
  --input-border: rgba(255, 255, 255, 0.08);
  
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-income: #10b981;
  --color-expense: #f43f5e;
  --color-accent: #a855f7;
  
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.08);
  --scroll-thumb: rgba(255, 255, 255, 0.12);
}

/* Light Theme Variables */
body.light-theme {
  --bg-app: #f4f6fa;
  --bg-gradient: linear-gradient(135deg, #f4f6fa 0%, #e2e8f0 100%);
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(0, 0, 0, 0.05);
  --card-hover-border: rgba(99, 102, 241, 0.35);
  
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-border: rgba(0, 0, 0, 0.1);
  
  --color-primary: #4f46e5;
  --color-primary-hover: #3730a3;
  --color-income: #059669;
  --color-expense: #e11d48;
  --color-accent: #9333ea;
  
  --shadow-glow: 0 10px 30px rgba(99, 102, 241, 0.04), 0 4px 15px -4px rgba(0, 0, 0, 0.05);
  --scroll-thumb: rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------------------------
   2. Body & Shell Overrides
   -------------------------------------------------------------------------- */
html {
  font-size: 18px; /* Increased from default 16px to scale up all rem units */
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  transition: background 0.4s ease, color 0.4s ease;
  min-height: 100vh;
}

/* Max width container for Mobile First */
.app-container {
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
  background: rgba(7, 11, 19, 0.3);
}

body.light-theme .app-container {
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.03);
  background: rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   3. Glassmorphic UI Elements
   -------------------------------------------------------------------------- */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme .glass-card {
  box-shadow: 0 8px 32px 0 rgba(99, 102, 241, 0.03);
}

.glass-card-interactive:hover {
  border-color: var(--card-hover-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.glass-card-interactive:active {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   4. Tactile Glass Form Fields
   -------------------------------------------------------------------------- */
.glass-input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-main);
  border-radius: 14px;
  outline: none;
  transition: all 0.25s ease;
}

.glass-input:focus {
  border-color: var(--color-primary);
  background: var(--input-bg);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.glass-input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.glass-input option {
  background: var(--bg-app);
  color: var(--text-main);
}

body.light-theme .glass-input option {
  background: #ffffff;
}

/* --------------------------------------------------------------------------
   5. Dynamic Keypad & Circular Lock Elements
   -------------------------------------------------------------------------- */
.passcode-dot {
  width: 14px;
  height: 14px;
  border-radius: 9999px;
  border: 2px solid var(--text-secondary);
  background: transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.passcode-dot.filled {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.keypad-btn {
  width: 72px;
  height: 72px;
  border-radius: 9999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.keypad-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

.keypad-btn:active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--color-primary);
  transform: scale(0.95);
}

body.light-theme .keypad-btn {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

body.light-theme .keypad-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .keypad-btn:active {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--color-primary);
}

/* Shaking animation on wrong passcode entry */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.shake-error {
  animation: shake 0.4s ease-in-out;
}

/* --------------------------------------------------------------------------
   6. Custom Scrollbars
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.4);
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* --------------------------------------------------------------------------
   7. Calendar Grid & Visual States
   -------------------------------------------------------------------------- */
.calendar-day-cell {
  aspect-ratio: 1;
  max-height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.calendar-day-cell:hover {
  background: rgba(255, 255, 255, 0.05);
}

body.light-theme .calendar-day-cell:hover {
  background: rgba(0, 0, 0, 0.04);
}

.calendar-day-cell.today {
  border: 2px solid var(--color-primary);
}

.calendar-day-cell.selected {
  background: var(--color-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.calendar-day-cell.has-expense::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 5px;
  height: 5px;
  background: var(--color-expense);
  border-radius: 9999px;
}

.calendar-day-cell.selected.has-expense::after {
  background: #ffffff;
}

/* --------------------------------------------------------------------------
   8. Animation Triggers
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.animate-scale-in {
  animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.progress-shimmer {
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.15) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* Collapsible slide-down effect */
.collapse-transition {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.collapse-transition.open {
  max-height: 1000px;
}

/* ==========================================================================
   GLOBAL HIGH-CONTRAST LIGHT THEME STYLE OVERRIDES
   ========================================================================== */
body.light-theme {
  color: var(--text-main) !important;
}

/* Force rich high-contrast dark fonts on Tailwind text-slate elements in Light Theme */
.light-theme .text-slate-100,
.light-theme .text-slate-300,
.light-theme .text-slate-400,
.light-theme .text-slate-500,
.light-theme .text-slate-600 {
  color: #475569 !important;
}

/* Make headers and titles pitch black in Light Theme */
.light-theme h1,
.light-theme h2,
.light-theme h3,
.light-theme h4 {
  color: #0f172a !important;
}

/* Calendar Days - High Contrast Slate */
.light-theme .calendar-day-cell {
  color: #1e293b !important;
}

/* Selected Day number should remain solid white for high-contrast visibility */
.light-theme .calendar-day-cell.selected {
  color: #ffffff !important;
  background-color: #4f46e5 !important;
}

/* Dashboard Net Balance Card - Handled dynamically via premium Tailwind light-theme: gradient classes in EJS templates */

/* Sub-card rows inside Dashboard in Light Theme */
.light-theme .bg-emerald-500\/5,
.light-theme .bg-rose-500\/5 {
  background-color: rgba(99, 102, 241, 0.04) !important;
  border-color: rgba(99, 102, 241, 0.1) !important;
}

/* Financial Active Elements - Bright Vivid Overrides for White Backdrops */
.light-theme .text-emerald-400 {
  color: #059669 !important; /* Rich Green */
}

.light-theme .text-rose-400 {
  color: #e11d48 !important; /* Rich Rose Red */
}

.light-theme .text-indigo-400 {
  color: #4f46e5 !important; /* Rich Indigo */
}

.light-theme .text-purple-400 {
  color: #9333ea !important; /* Rich Purple */
}

.light-theme .text-amber-400 {
  color: #d97706 !important; /* Rich Amber */
}

/* Bottom Nav bar active elements inside Light Theme */
.light-theme #bottom-nav {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

.light-theme #bottom-nav .text-white {
  color: #4f46e5 !important; /* Active Tab */
}

.light-theme #bottom-nav .text-slate-500 {
  color: #64748b !important; /* Inactive Tab */
}

/* General Icons and Buttons in Light Theme */
.light-theme i.fa-solid {
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   Solid Toast Emulator
   -------------------------------------------------------------------------- */
.solid-toast-container {
  position: fixed;
  top: 16px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 99999;
  gap: 8px;
}
.solid-toast {
  background: #fff;
  color: #363636;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1), 0 3px 3px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  animation: solidToastIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
  will-change: transform;
  pointer-events: auto;
}
.solid-toast.exiting {
  animation: solidToastOut 0.4s forwards cubic-bezier(0.06, 0.71, 0.55, 1);
}
.solid-toast-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: white;
  font-size: 10px;
}
.solid-toast-icon.success { background: #61d345; }
.solid-toast-icon.error { background: #ff4b4b; }
@keyframes solidToastIn {
  0% { transform: translateY(-40px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes solidToastOut {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0; }
}

/* --------------------------------------------------------------------------
   Native Select Styling (Premium look for native selects)
   -------------------------------------------------------------------------- */
select.glass-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px !important;
  cursor: pointer;
}
select.glass-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}
select.glass-input option {
  background: var(--bg-card);
  color: var(--text-main);
  padding: 8px 12px;
}
body.light-theme select.glass-input option {
  background: #ffffff;
  color: #1e293b;
}
