/* ===============================================================
   Personal Finance Dashboard - Custom Stylesheet
   Tailwind CSS is loaded via CDN; this file provides fine-tuned
   typography, custom scrollbars, animations, and accessibility rules.
   =============================================================== */

@layer base {
  html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #0f172a;
    background-color: #f8fafc;
  }
}

/* Custom Scrollbar for Transactions Feed */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Modal Backdrop Blur */
.modal-backdrop {
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Subtle transitions and active states */
.btn-press {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-press:active:not(:disabled) {
  transform: scale(0.98);
}

/* Smooth enter animations for rows and cards */
@keyframes rowFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rowFadeOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(8px);
  }
}

.animate-row-enter {
  animation: rowFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-row-exit {
  animation: rowFadeOut 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes modalIn {
  0% {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.animate-modal-enter {
  animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Touch Device Support: Keep action icons visible on touch devices */
@media (hover: none) and (pointer: coarse) {
  .touch-visible {
    opacity: 1 !important;
    visibility: visible !important;
  }
}

/* Accessibility: Respect Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Safe Area Insets Support for mobile devices */
body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

header {
  padding-top: env(safe-area-inset-top, 0px);
}

/* iOS Safari: Prevent automatic viewport zoom on input focus */
@media screen and (max-width: 768px) {
  input,
  select,
  textarea,
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="search"],
  input[type="email"],
  input[type="password"] {
    font-size: 16px !important;
  }
}

