/* Global styles for AlphaCore Web Application */
:root {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Roboto",
    "Oxygen",
    "Ubuntu",
    "Cantarell",
    "Fira Sans",
    "Droid Sans",
    "Helvetica Neue",
    sans-serif;
  line-height: 1.5;
  font-weight: 400;

  color-scheme: light;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background-color: #f9fafb;
  /* Improved text rendering on mobile */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent horizontal scrolling on mobile */
  overflow-x: hidden;
}

#root {
  min-height: 100vh;
  width: 100%;
  /* Ensure proper stacking context */
  position: relative;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for accessibility */
*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Responsive utilities */
.container-mobile {
  padding: 0 16px;
}

.container-tablet {
  padding: 0 24px;
}

.container-desktop {
  padding: 0 32px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Touch-friendly interactive elements */
@media (max-width: 899px) {
  .touch-target,
  button,
  a,
  .MuiIconButton-root,
  .MuiButton-root,
  [role="button"] {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  /* Exception for inline text links */
  a:not([role="button"]):not(.MuiButton-root) {
    min-height: unset !important;
    min-width: unset !important;
  }
}

/* Improved responsive grid */
.responsive-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .responsive-grid {
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

@media (min-width: 900px) {
  .responsive-grid {
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  }
}

/* Better mobile scrolling */
.mobile-scroll {
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

/* Responsive text truncation */
.text-truncate-mobile {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 600px) {
  .text-truncate-mobile {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-border: #000000;
  }
}

/* Reduced motion support */
@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;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }

  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
