/* ==========================================================================
   Modern CSS Reset — AlleProfit
   Based on Andy Bell's modern CSS reset + best practices
   ========================================================================== */

/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Remove default margin and padding */
* {
  margin: 0;
  padding: 0;
}

/* Prevent font-size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Remove default margin, set core body defaults */
body {
  min-height: 100vh;
  line-height: var(--leading-normal, 1.5);
  font-family: var(--font, system-ui, sans-serif);
  font-size: var(--text-base, 1rem);
  color: var(--color-text, #0f172a);
  background-color: var(--color-bg, #f8fafc);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Prevent horizontal overflow on main content on mobile */
@media (max-width: 767px) {
  .main-content,
  #app-content {
    max-width: 100vw;
    overflow-x: hidden;
  }
  /* Allow tables to scroll horizontally within their wrapper */
  .table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Remove list styles on ul, ol with a list role (which implies default styling removal) */
ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* Set core heading defaults */
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
  line-height: var(--leading-tight, 1.2);
  font-weight: var(--weight-bold, 700);
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

/* Default link resets */
a {
  color: inherit;
  text-decoration: none;
}

/* Make images easier to work with */
img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

/* Remove all animations for people who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Remove button default styles */
button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Table reset */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Remove fieldset styles */
fieldset {
  border: none;
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary, #ff5a00);
  outline-offset: 2px;
  border-radius: var(--radius-sm, 4px);
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Selection styles */
::selection {
  background-color: var(--color-primary-light, #fff4eb);
  color: var(--color-primary, #ff5a00);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background-color: var(--color-text-muted, #94a3b8);
  border-radius: var(--radius-full, 9999px);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-text-secondary, #64748b);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-text-muted, #94a3b8) transparent;
}
