/* Mobile Responsive Fixes for ECOA Website - AGGRESSIVE OVERRIDES */

@media (max-width: 768px) {
  * {
    box-sizing: border-box;
  }

  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  #root {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Header Aggressive Fixes */
  header {
    padding: 0.5rem 1rem !important;
    height: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  header > * {
    width: 100% !important;
    max-width: 100vw !important;
  }

  header .container,
  header > div {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100vw !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  /* Logo Resize */
  header img {
    height: 35px !important;
    width: auto !important;
    max-width: 120px !important;
  }

  /* Hide All Desktop Navigation */
  header nav,
  header [class*="nav"],
  header [class*="menu"],
  header .flex.items-center.gap-8,
  header .flex.items-center.gap-6,
  header .flex.items-center.gap-4,
  .hidden.md\\:flex,
  nav {
    display: none !important;
  }

  /* Hamburger Button Styles */
  .mobile-menu-toggle {
    display: block !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
    z-index: 100 !important;
    width: 30px !important;
    height: 30px !important;
    flex-shrink: 0 !important;
  }

  .mobile-menu-toggle span {
    display: block !important;
    width: 25px !important;
    height: 2.5px !important;
    background-color: #000 !important;
    margin: 5px 0 !important;
    transition: all 0.3s ease !important;
  }

  .mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(10px, 10px) !important;
  }

  .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0 !important;
  }

  .mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px) !important;
  }

  /* Mobile Menu Overlay */
  .mobile-nav-overlay {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    width: 100% !important;
    height: 100vh !important;
    background: #ffffff !important;
    z-index: 99 !important;
    transition: right 0.3s ease !important;
    padding: 6rem 2rem 2rem 2rem !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
  }

  .mobile-nav-overlay.active {
    right: 0 !important;
  }

  .mobile-nav-overlay a,
  .mobile-nav-overlay button {
    font-size: 1.25rem !important;
    font-weight: 500 !important;
    color: #333 !important;
    text-decoration: none !important;
    padding: 1rem !important;
    border: none !important;
    background: none !important;
    cursor: pointer !important;
    text-align: left !important;
    width: 100% !important;
  }

  .mobile-nav-overlay button {
    background: #059669 !important;
    color: white !important;
    border-radius: 0.5rem !important;
    margin-top: 2rem !important;
  }

  /* Hero Section */
  .grid.grid-cols-2,
  .grid-cols-2 {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    padding: 2rem 1rem !important;
  }

  h1 {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
    text-align: center !important;
    word-break: break-word !important;
  }

  .text-xl {
    font-size: 1rem !important;
    text-align: center !important;
    margin-bottom: 2rem !important;
  }

  /* Buttons */
  .flex.gap-4,
  .flex.gap-6 {
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
  }

  button,
  a.inline-flex,
  [class*="button"] {
    width: 100% !important;
    max-width: 320px !important;
    margin: 0.5rem auto !important;
    justify-content: center !important;
  }

  /* Feature Icons */
  .flex.gap-12 {
    flex-direction: column !important;
    gap: 2rem !important;
    align-items: center !important;
  }

  /* Floating Cards */
  .absolute {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin: 1rem auto !important;
    width: 90% !important;
    max-width: 280px !important;
  }

  /* Grid Layouts */
  .grid.grid-cols-3,
  .grid-cols-3 {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .grid.grid-cols-4,
  .grid-cols-4 {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* Sections */
  section {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .py-24 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  /* Forms */
  form .grid.grid-cols-2,
  form .grid-cols-2 {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  input,
  textarea,
  select {
    width: 100% !important;
  }

  /* Images */
  img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Footer Fix - Ensure proper ordering */
  footer {
    order: 9999 !important;
  }

  section[data-loc*="TeamSection"] {
    order: 9998 !important;
  }
}

/* Footer and Section Ordering - Apply to all screen sizes */
#root {
  display: flex !important;
  flex-direction: column !important;
}

#root > div {
  display: flex !important;
  flex-direction: column !important;
}

footer {
  order: 9999 !important;
}

section[data-loc*="TeamSection"] {
  order: 9998 !important;
}

/* Extra small devices */
@media (max-width: 480px) {
  header img {
    height: 32px !important;
    max-width: 100px !important;
  }

  h1 {
    font-size: 1.5rem !important;
  }

  button,
  a.inline-flex {
    max-width: 100% !important;
    padding: 0.75rem !important;
  }
}
