/* Digital Bahi Khata Custom Styles */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* Mobile viewport and touch optimizations */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  -webkit-tap-highlight-color: transparent;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
  -webkit-tap-highlight-color: transparent;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* iOS Safe Area Inset Helpers */
.safe-area-top, .safe-area-header {
  padding-top: calc(0.75rem + constant(safe-area-inset-top, 0px));
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
}

.safe-area-bottom {
  padding-bottom: constant(safe-area-inset-bottom, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-bottom-nav {
  padding-bottom: constant(safe-area-inset-bottom, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  min-height: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.fab-bottom-position {
  bottom: calc(5.25rem + constant(safe-area-inset-bottom, 0px));
  bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
}

.pt-safe-top {
  padding-top: max(14px, calc(0.75rem + env(safe-area-inset-top, 0px)));
}

.pb-safe-bottom {
  padding-bottom: max(14px, calc(0.75rem + env(safe-area-inset-bottom, 0px)));
}

/* Bottom navigation bar padding */
.pb-bottom-nav {
  padding-bottom: calc(5.25rem + var(--safe-bottom));
}

/* Custom sleek scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.7);
}

/* Toast container animations */
@keyframes toastSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-20px);
    opacity: 0;
  }
}

.toast-animate-in {
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-animate-out {
  animation: toastSlideOut 0.2s ease-in forwards;
}

/* Modal styles */
.modal-backdrop {
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

/* Touch active feedback */
.touch-press:active {
  transform: scale(0.97);
  transition: transform 0.1s ease-in-out;
}

/* ==================== GLOBAL TOP PROGRESS BAR ==================== */
#global-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(90deg, #0284c7, #38bdf8, #6366f1, #0284c7);
  background-size: 200% 100%;
  animation: loadingBarGradient 1.5s linear infinite;
  z-index: 999999;
  transition: width 0.2s cubic-bezier(0.1, 0.7, 0.1, 1), opacity 0.25s ease-out;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.9), 0 0 6px rgba(56, 189, 248, 0.8);
  pointer-events: none;
}

@keyframes loadingBarGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ==================== GLOBAL SPINNER OVERLAY ==================== */
#global-spinner-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease-in-out;
}

#global-spinner-overlay.hidden {
  display: none !important;
  pointer-events: none !important;
}

/* ==================== APP LAUNCH SPLASH SCREEN ==================== */
#app-splash-screen {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #0284c7 0%, #1e3a8a 50%, #0f172a 100%);
  color: #ffffff;
  transition: opacity 0.3s ease-out;
}

#app-splash-screen.hidden,
#app-splash-screen.dismissed {
  display: none !important;
  pointer-events: none !important;
}

.splash-logo-pulse {
  animation: splashPulse 1.8s ease-in-out infinite;
}

@keyframes splashPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 20px rgba(255, 255, 255, 0);
  }
}

