/* Footer styles */
.footer {
  background-color: #232f3e;
  color: white;
  padding: 10px 0 5px;
  margin-top: auto;
  width: 100%;
  position: relative;
  left: 0;
  right: 0;
  z-index: 1000; /* Higher z-index to ensure it covers the sidebar */
  /* Additional styles to ensure footer covers sidebar */
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
  clear: both;
  /* Make sure the footer extends over the sidebar */
  position: relative;
}

.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Make about us section text shorter */
.footer-section p {
  text-overflow: ellipsis;
  font-size: 15px;
  line-height: 1.2;
  margin-bottom: 3px;
  margin-top: 0;
}

.footer-section {
  flex: 1;
  min-width: 150px;
  margin-bottom: 4px;
  padding: 0 8px;
}

/* Make About Us section narrower */
.footer-section.about-us {
  flex: 0 0 29%;
}

/* Make Quick Links wider */
.footer-section.quick-links {
  flex: 0 0 31%;
}

/* Make other sections take remaining space equally */
.footer-section:not(:first-child):not(.quick-links) {
  flex: 0 0 20%;
}

.footer h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0; /* Remove default margin */
  column-count: 2;
  column-gap: 8px;
}

.footer-links li {
  margin-bottom: 2px;
}

.footer-links a {
  color: #ddd;
  text-decoration: none;
  font-size: 15px;
  display: block;
  margin-bottom: 0;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer .contact-info {
  line-height: 1.2;
  font-size: 15px;
}

.footer .contact-info p {
  margin-bottom: 2px;
  margin-top: 0;
}

.social-icons {
  display: flex;
  gap: 15px; /* Increased gap between icons */
  margin-top: 10px;
  justify-content: flex-start;
  align-items: center;
}

.social-icons a {
  color: white;
  background-color: rgba(255, 255, 255, 0.2);
  width: 32px; /* Fixed width for all icons */
  height: 32px; /* Fixed height for all icons */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.social-icons img {
  width: 18px; /* Consistent size for icon images */
  height: 18px;
  filter: brightness(1.2);
  object-fit: contain;
}

.social-icons a:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.footer-bottom {
  text-align: center;
  padding-top: 4px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 15px;
  color: #aaa;
}

/* Add order classes for mobile reordering */
.footer-section.about-us {
  order: 1;
}

.footer-section.quick-links {
  order: 2;
}

.footer-section.contact-us {
  order: 3;
}

.footer-section.get-in-touch {
  order: 4;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .footer-section {
    flex: 0 0 50%;
    padding: 0 5px;
  }

  .get-in-touch {
    flex: 0 0 100%;
  }

  .footer {
    padding: 8px 0 3px;
  }
}

@media (max-width: 480px) {
  .footer-section {
    flex: 0 0 100%;
    margin-bottom: 3px;
    padding: 0 8px;
  }

  .footer {
    padding: 8px 0 3px;
  }

  .footer-container {
    padding: 0 8px;
  }

  .footer h3 {
    font-size: 15px;
    margin-bottom: 3px;
  }
  .footer-section p,
  .footer .contact-info,
  .footer-links a {
    font-size: 15px;
    line-height: 1.2;
  }
}

@media screen and (orientation: portrait) {
  .footer {
    left: 0;
    padding: 10px 0;
  }

  .footer-container {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0 10px; /* Remove left padding since sidebar isn't visible in portrait */
  }

  .footer-section {
    flex: 0 0 50%;
    margin-bottom: 5px;
  }
}

@media (min-width: 768px) {
  .footer {
    width: 100%;
    position: relative;
    left: 0;
  }

  body.has-sidebar .departments-sidebar {
    z-index: 1;
  }
}

@media screen and (orientation: landscape) and (max-height: 500px) {
  .footer {
    padding: 5px 0;
  }

  .footer-container {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-left: 220px; /* Keep sidebar padding in landscape mode */
  }

  .footer-section {
    flex: 0 0 200px;
    min-width: 400px;
  }

  .footer h3 {
    font-size: 15px;
    margin-bottom: 3px;
  }
  .footer .contact-info,
  .footer-links a {
    font-size: 15px;
  }

  .footer-section p {
    font-size: 15px;
    line-height: 1.2;
  }

  .footer-bottom {
    padding-top: 3px;
    margin-top: 3px;
  }
}

@media screen and (orientation: portrait), screen and (orientation: landscape) {
  .footer {
    left: 0;
    padding: 10px 0;
    width: 100vw;
    min-width: 0;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .footer-container {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0 10px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
  }
  .footer-section {
    flex: 0 0 25%;
    min-width: 180px;
    margin-bottom: 5px;
    box-sizing: border-box;
  }
}

@media (max-width: 900px) {
  .footer-section {
    flex: 0 0 50%;
    min-width: 150px;
  }

  .footer-section:first-child {
    flex: 0 0 100%;
  }

  .get-in-touch {
    flex: 0 0 100%;
  }
}

@media (max-width: 600px) {
  .footer-section {
    flex: 0 0 100%;
    min-width: 120px;
    margin-bottom: 3px;
    padding: 0 8px;
  }

  .footer-section:first-child {
    flex: 0 0 100%;
  }

  .footer {
    padding: 8px 0 3px;
  }

  .footer-container {
    display: flex;
    flex-direction: column;
    padding: 0 8px;
    max-width: 100vw;
  }

  /* Give the about us section more width and make it first */
  .footer-section.about-us {
    flex: 0 0 100%;
    order: 1;
  }

  /* Make Quick Links second */
  .footer-section.quick-links {
    order: 2;
  }

  /* Make Contact Us third */
  .footer-section.contact-us {
    order: 3;
  }

  /* Make Get in Touch last */
  .footer-section.get-in-touch {
    order: 4;
  }
}
