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

body, h1, h2, h3, h4, h5, h6, p, ul, ol, li, figure, blockquote, dl, dd {
  margin: 0;
  padding: 0;
}

/* Body base styles */
body {
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  padding: 20px;
  background-color: #f4f7fc;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Fluid typography - scales on smaller screens */
html {
  font-size: 100%; /* 16px base */
}

@media (max-width: 768px) {
  html {
    font-size: 90%; /* ~14.4px */
  }
}

@media (max-width: 480px) {
  html {
    font-size: 85%; /* ~13.6px */
  }
}

/* Images - fluid and not overflow */
img, picture, video, canvas, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Tables - responsive with horizontal scroll */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

table, th, td {
  border: 1px solid #ddd;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 1rem;
}

@media (max-width: 600px) {
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
  }

  th, td {
    white-space: nowrap;
  }
}

/* Buttons and inputs scale nicely */
button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  background-color: #fff;
  color: #333;
  transition: background-color 0.3s ease, transform 0.3s ease;
  cursor: pointer;
}

button:hover, input:hover, select:hover, textarea:hover {
  background-color: #eee;
}

@media (max-width: 480px) {
  button, input, select, textarea {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
  }
}

/* Prevent overlapping and allow wrapping for text */
p, span, div, li, a {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Containers and wrappers to prevent overflow */
.container, .wrapper, main, section, article {
  max-width: 100%;
  width: 100%;
  padding: 0 15px;
  margin: 0 auto;
}

/* Reduce hover scale on small devices */
@media (max-width: 480px) {
  *:hover {
    transform: none !important;
    box-shadow: none !important;
  }
}

/* Wrap all tables in a scrollable container */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Optional: prevent table content from wrapping */
.table-responsive table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  white-space: nowrap;
}

/* Allow horizontal scroll if needed */
.table-responsive th, 
.table-responsive td {
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}
