/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN - Mobile First Approach
   ═══════════════════════════════════════════════════════════════ */

/* Base - Mobile First (320px+) */
* {
  box-sizing: border-box;
}

/* Viewport meta tag should be in HTML, but ensure proper scaling */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* Flexible images and media */
img, video, iframe {
  max-width: 100%;
  height: auto;
}

/* Container responsive */
.container, #page {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 10px !important;
  margin: 0 auto !important;
}

#content {
  width: 100% !important;
  padding: 15px !important;
}

/* ═══════════════════════════════════════════════════════════════
   NAVIGATION - Responsive Menu
   ═══════════════════════════════════════════════════════════════ */

#mainmenu {
  width: 100% !important;
}

#mainmenu ul {
  display: flex;
  flex-wrap: wrap;
  padding: 0 !important;
  margin: 0 !important;
}

#mainmenu ul li {
  flex: 0 1 auto;
  white-space: nowrap;
}

#mainmenu ul li a {
  padding: 8px 10px !important;
  font-size: 11pt !important;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   TABLES - Responsive Tables
   ═══════════════════════════════════════════════════════════════ */

/* Make tables scrollable on small screens */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100% !important;
  border-collapse: collapse;
}

table th, table td {
  padding: 8px !important;
  font-size: 11pt !important;
  white-space: nowrap;
}

/* Grid view tables */
.grid-view {
  width: 100%;
  overflow-x: auto;
}

.grid-view table {
  min-width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   FORMS - Responsive Forms
   ═══════════════════════════════════════════════════════════════ */

.form, form {
  width: 100%;
}

input[type=text],
input[type=password],
input[type=email],
input[type=number],
textarea,
select {
  width: 100% !important;
  max-width: 100% !important;
  font-size: 12pt !important;
  padding: 10px !important;
  margin-bottom: 10px;
}

input[type=submit],
button,
.button {
  width: auto;
  min-width: 120px;
  padding: 10px 20px !important;
  font-size: 12pt !important;
}

/* Search forms */
.search-form {
  width: 100%;
  padding: 15px !important;
}

/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY - Responsive Text
   ═══════════════════════════════════════════════════════════════ */

h1 {
  font-size: 2em !important;
  margin: 0.5em 0;
}

h2 {
  font-size: 1.6em !important;
  margin: 0.5em 0;
}

h3 {
  font-size: 1.3em !important;
}

p {
  font-size: 12pt !important;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE DEVICES (Portrait phones, < 576px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 575px) {
  body {
    font-size: 11pt !important;
  }

  #content {
    padding: 10px !important;
  }

  /* Stack navigation vertically */
  #mainmenu ul {
    flex-direction: column;
  }

  #mainmenu ul li {
    width: 100%;
    border-bottom: 1px solid #1a3a5c;
  }

  #mainmenu ul li a {
    padding: 12px 15px !important;
    font-size: 12pt !important;
  }

  /* Tables - show as cards on mobile */
  table th, table td {
    font-size: 10pt !important;
    padding: 5px !important;
  }

  /* Headings smaller on mobile */
  h1 {
    font-size: 1.5em !important;
  }

  h2 {
    font-size: 1.3em !important;
  }

  /* Buttons full width on mobile */
  input[type=submit],
  button,
  .button {
    width: 100%;
    margin-bottom: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   TABLETS (Landscape phones, tablets, 576px - 991px)
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 576px) and (max-width: 991px) {
  .container, #page {
    width: 95% !important;
    padding: 0 15px !important;
  }

  #content {
    padding: 20px !important;
  }

  #mainmenu ul li a {
    padding: 10px 12px !important;
    font-size: 11pt !important;
  }

  table th, table td {
    font-size: 11pt !important;
    padding: 6px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   SMALL DESKTOPS (992px - 1199px)
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 992px) and (max-width: 1199px) {
  .container, #page {
    width: 95% !important;
    padding: 0 20px !important;
  }

  #content {
    padding: 25px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   LARGE DESKTOPS (1200px - 1599px)
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 1200px) and (max-width: 1599px) {
  .container, #page {
    width: 95% !important;
    padding: 0 30px !important;
  }

  #content {
    padding: 30px 40px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   EXTRA LARGE DESKTOPS (1600px+)
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 1600px) {
  .container, #page {
    width: 95% !important;
    max-width: 1800px !important;
    padding: 0 40px !important;
  }

  #content {
    padding: 40px 50px !important;
  }

  table th, table td {
    font-size: 12pt !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════ */

@media print {
  #mainmenu,
  #header,
  #footer,
  .button,
  input[type=submit] {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  table {
    page-break-inside: avoid;
  }
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════ */

/* Hide on mobile */
@media (max-width: 575px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Hide on tablet */
@media (min-width: 576px) and (max-width: 991px) {
  .hide-tablet {
    display: none !important;
  }
}

/* Hide on desktop */
@media (min-width: 992px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Show only on mobile */
.show-mobile {
  display: none !important;
}

@media (max-width: 575px) {
  .show-mobile {
    display: block !important;
  }
}
