/* =========================
   MOBILE NAV (CLEAN + FIXED)
   Keeps your burger/menu behavior the same
========================= */

/* Stop sideways scrolling / weird “zoom drag” on iPhone */
html, body {
  overflow-x: hidden;
  width: 100%;
}

/* Make media elements never overflow the viewport */
img, video, svg {
  max-width: 100%;
  height: auto;
}

/* Base: menu off-screen */
.nav-menu { right: -100% !important; }
.nav-menu.active { right: 0 !important; }

/* Hide burger by default (desktop) */
.mobile-toggle { display: none !important; }

@media (max-width: 768px) {

  /* Header spacing (don’t fight .container globally) */
  .main-header .container{
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .main-nav{
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 90px;
    gap: 12px;
  }

  /* ===== BURGER BUTTON (move LEFT safely) ===== */
  .mobile-toggle {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;

    /* tap area */
    padding: 10px 10px !important;

    /* move it LEFT without breaking layout */
    transform: translateX(-12px);

    z-index: 1002;
    flex-shrink: 0;
  }

  .toggle-bar {
    display: block;
    width: 28px;
    height: 2px;
    background: #0a0c12;
    transition: all 0.3s ease;
    border-radius: 2px;
  }

  /* Burger animation */
  .mobile-toggle.active .toggle-bar:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
    background: #c7b27c;
  }
  .mobile-toggle.active .toggle-bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
  }
  .mobile-toggle.active .toggle-bar:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
    background: #c7b27c;
  }

  /* ===== MOBILE MENU PANEL ===== */
  .nav-menu {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    left: auto !important;

    width: 85% !important;
    max-width: 380px !important;
    height: 100vh !important;

    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    display: flex !important;
    flex-direction: column !important;

    /* this controls why links looked “too low” */
    padding: 72px 25px 40px !important;

    gap: 8px !important;
    transition: right 0.3s ease !important;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15) !important;
    z-index: 1000 !important;
    overflow-y: auto !important;
  }

  .nav-menu.active { right: 0 !important; }

  /* Close button */
  .menu-close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(199, 178, 124, 0.1);
    border: 1px solid rgba(199, 178, 124, 0.3);
    color: #c7b27c;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1001;
  }

  /* Links */
  .nav-link {
    font-size: 1.2rem;
    padding: 16px 20px;
    margin: 2px 0;
    color: #0a0c12;
    border-radius: 12px;
    transition: all 0.2s ease;
    text-align: left;
    border: 1px solid transparent;
    font-weight: 500;
  }

  .nav-link:hover,
  .nav-link.active {
    background: rgba(199, 178, 124, 0.1);
    border-color: rgba(199, 178, 124, 0.3);
    color: #c7b27c;
    transform: translateX(5px);
  }

  .nav-link::after { display: none; }

  /* CTA */
  .nav-cta {
    margin-top: 20px;
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
    text-align: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #c7b27c 0%, #d4c29d 100%);
    color: #0a0c12;
    font-weight: 700;
    border: none;
    box-shadow: 0 10px 20px rgba(199, 178, 124, 0.3);
  }

  /* ===== LOGO (keep your sizing) ===== */
  .nav-logo {
    display: flex;
    align-items: center;
    height: auto;
    padding: 0;
    max-width: calc(100vw - 120px); /* prevents overflow pushing page sideways */
    overflow: hidden;
  }

  .logo-icon {
    height: 75px !important;
    max-height: none !important;
    width: auto;
    flex-shrink: 0;
  }

  .logo-wordmark {
    height: 200px !important;
    max-height: none !important;
    width: auto;
    margin-left: -48px !important;
    margin-top: 23px !important;
  }

  /* Prevent body scroll when menu open */
  body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }

  /* ===== SLIM MOBILE TOP BAR (your current setup) ===== */
  .top-navbar { padding: 2px 0 !important; }

  .top-nav-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px !important;
    padding: 4px 0 !important;
  }

  .insurance-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }

  .insurance-badge {
    font-size: 0.65rem !important;
    padding: 4px 8px !important;
    white-space: nowrap;
  }

  .change-location {
    font-size: 0.65rem !important;
    white-space: nowrap;
  }

  .underwritten,
  .location span:not(.change-location) {
    display: none !important;
  }

  .top-nav-utils {
    display: flex;
    justify-content: center;
    gap: 12px;
  }

  .phone,
  .hours {
    font-size: 0.65rem !important;
    white-space: nowrap;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .nav-menu {
    width: 90% !important;
    padding: 68px 20px 30px !important;
  }

  .logo-icon { height: 60px !important; }
  .logo-wordmark { height: 170px !important; }
}

/* Hide any duplicate close icons inside the menu (keeps only .menu-close-btn) */
.nav-menu .menu-close-btn ~ button,
.nav-menu .menu-close-btn ~ .close,
.nav-menu .menu-close-btn ~ .nav-close,
.nav-menu .menu-close-btn ~ .x,
.nav-menu .menu-close-btn ~ .close-btn {
  display: none !important;
}

/* ✅ Kill injected close button (even if cached somewhere) */
.menu-close-btn { display: none !important; }

/* ✅ Fix weird sideways scroll / "screen moves around" on real iPhone */
html, body {
  overflow-x: hidden !important;
  width: 100%;
}

/* ✅ Better menu top spacing (less empty space, links start higher) */
@media (max-width: 768px) {
  .nav-menu {
    padding: 72px 22px 28px !important; /* was causing too much top gap */
  }

  .nav-menu .nav-link:first-child {
    margin-top: 0 !important;
  }
}

