/* =========================================================
   COMPONENT — Mobile control bar (templates/layout/mobile-bar.php)
   Fixed bottom tab bar on phones (< 768px): Home · Tours · Categories · Login.
   Reference: assets/source/oldwebsitepage/mobile controll bar.png
   ========================================================= */

.mobile-bar,
.mobile-sheet { display: none; }

@media (max-width: 767.98px) {
  :root { --mobile-bar-h: 64px; }

  /* Keep page content (footer bottom) clear of the bar */
  body.has-mobile-bar { padding-bottom: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom, 0px)); }

  .mobile-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: block;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--color-navy-deep);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .18);
  }
  .mobile-bar__list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: var(--mobile-bar-h);
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .mobile-bar__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: rgba(255, 255, 255, .85);
    font-family: inherit;
    font-size: 12px;
    line-height: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color .2s ease;
  }
  .mobile-bar__item:hover,
  .mobile-bar__item.is-active,
  .mobile-bar__item[aria-expanded="true"] { color: var(--color-gold); }
  /* Small gold line above the active tab */
  .mobile-bar__item.is-active::before,
  .mobile-bar__item[aria-expanded="true"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 28px;
    height: 3px;
    margin-left: -14px;
    border-radius: 0 0 3px 3px;
    background: var(--color-gold);
  }
  .mobile-bar__item:focus-visible { outline: 2px solid var(--color-gold); outline-offset: -4px; border-radius: 10px; }

  /* Categories sheet (opens above the bar) */
  .mobile-sheet {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom, 0px) + 8px);
    z-index: 1039;
    display: block;
    max-height: calc(100dvh - var(--mobile-bar-h) - 110px);
    overflow-y: auto;
    padding: 16px;
    border-radius: 20px;
    background: var(--color-white);
    box-shadow: 0 -10px 40px rgba(8, 26, 40, .3);
  }
  .mobile-sheet[hidden] { display: none; }
  .mobile-sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .mobile-sheet__title { margin: 0; font-size: 18px; line-height: 24px; font-weight: 700; color: var(--color-navy); }
  .mobile-sheet__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--color-light);
    color: var(--color-navy);
    cursor: pointer;
  }
  .mobile-sheet__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .mobile-sheet__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
    border-radius: 12px;
    color: var(--color-navy);
    font-size: 12px;
    line-height: 15px;
    font-weight: 600;
    text-align: center;
  }
  .mobile-sheet__link:hover { background: var(--color-light); color: var(--color-primary); }
  .mobile-sheet__link img { width: 56px; height: 56px; object-fit: cover; border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-bar__item { transition: none; }
}
