/* Custom Styles for Balaji Consultants Data Management System */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

code, pre, .font-mono {
  font-family: var(--font-mono);
}

/* Prevent unwanted browser autofill background & styling */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px white inset !important;
  -webkit-text-fill-color: #0f172a !important;
  transition: background-color 5000s ease-in-out 0s;
}

.dark input:-webkit-autofill,
.dark input:-webkit-autofill:hover, 
.dark input:-webkit-autofill:focus, 
.dark input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #1e293b inset !important;
  -webkit-text-fill-color: #f8fafc !important;
}

/* Touch & Scroll Smoothness */
* {
  -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Hide scrollbars for swipeable tab bars on mobile */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Transitions */
.transition-all-smooth {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Responsive Table Styling */
.table-compact th, .table-compact td {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.table-responsive-wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Animation utilities */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 1; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 1; transform: translateX(-100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseSubtle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

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

.animate-slide-in-right {
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-in-left {
  animation: slideInLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.pulse-subtle {
  animation: pulseSubtle 2s infinite ease-in-out;
}

/* Glassmorphism helpers */
.glass-panel {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dark .glass-panel {
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Safe area insets for modern mobile devices (iOS / Android) */
.safe-area-top {
  padding-top: max(env(safe-area-inset-top), 0px);
}

.safe-area-bottom {
  padding-bottom: max(env(safe-area-inset-bottom), 0.75rem);
}

.safe-area-bottom-bar {
  padding-bottom: max(env(safe-area-inset-bottom), 0.5rem);
}

/* Mobile Touch & Form Responsiveness */
@media (max-width: 640px) {
  /* Prevent horizontal scroll leakage on body */
  html, body {
    overflow-x: hidden;
    position: relative;
    width: 100%;
  }

  /* Ergonomic Touch Targets */
  button, select, input, a {
    touch-action: manipulation;
  }

  /* Mobile Typography & Card Spacing */
  h1 {
    font-size: 1.25rem !important;
    line-height: 1.6rem !important;
  }

  /* Table Horizontal Scrolling on Mobile */
  .table-responsive-wrapper {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    border-radius: 1rem;
  }

  /* Mobile Bottom Sheet Modal Behavior */
  .mobile-modal-sheet {
    margin-top: auto !important;
    margin-bottom: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    max-height: 90vh !important;
  }

  /* Mobile Nav active indicators */
  .mobile-bottom-nav-item.active {
    color: #059669 !important;
    font-weight: 700;
  }
  
  .dark .mobile-bottom-nav-item.active {
    color: #34d399 !important;
  }

  /* Horizontal swipe indicator badge */
  .table-swipe-hint {
    display: flex !important;
  }
}

@media (min-width: 641px) {
  .table-swipe-hint {
    display: none !important;
  }
}

/* Print Styles */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  aside, header, #mobile-bottom-nav, #toast-container, .no-print, button:not(.print-allow) {
    display: none !important;
  }
  main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .shadow-sm, .shadow-md, .shadow-lg, .shadow-xl {
    box-shadow: none !important;
  }
  .border {
    border-color: #e2e8f0 !important;
  }
}

/* Universal Search Bar Styling */
.universal-search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 1rem;
  line-height: 1;
  color: #059669;
  z-index: 10;
}

.dark .universal-search-icon {
  color: #34d399;
}

.universal-search-input {
  width: 100% !important;
  padding-left: 2.75rem !important;
  padding-right: 2.4rem !important;
  padding-top: 0.625rem !important;
  padding-bottom: 0.625rem !important;
}

.universal-search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
}
