/**
 * TBB Topbar Styles
 * Uses CSS variables for colors, fonts, border, shadow (set via Customizer)
 */

/* Optional: Hide Elementor header when using TBB Topbar */
/* .elementor-location-header { display: none !important; } */

/* ============================================
   Base Topbar
   ============================================ */

.tbb-topbar {
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 0.75rem 1.5rem;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.tbb-topbar__inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* Sticky (default) */
.tbb-topbar:not(.tbb-topbar--static) {
  position: fixed;
}

/* Static - normal flow */
.tbb-topbar.tbb-topbar--static {
  position: relative;
}

/* ============================================
   Light Mode (front page / home) - Transparent header
   ============================================ */

.tbb-topbar--light {
  background: transparent;
  color: #ffffff;
}

.tbb-topbar--light.tbb-topbar--scrolled {
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
}

.tbb-topbar--light .tbb-topbar__logo-link,
.tbb-topbar--light .tbb-topbar__menu a,
.tbb-topbar--light .tbb-topbar__cta {
  color: #ffffff;
}

.tbb-topbar--light .tbb-topbar__menu a:hover,
.tbb-topbar--light .tbb-topbar__cta:hover {
  color: rgba(255, 255, 255, 0.85);
}

.tbb-topbar--light .tbb-topbar__cta {
  border-color: #ffffff;
}

.tbb-topbar--light .tbb-topbar__cta:hover {
  background: rgba(255, 255, 255, 0.15);
}

.tbb-topbar--light .tbb-topbar__hamburger-line {
  background-color: #ffffff;
}

/* ============================================
   Dark Mode (all other pages)
   ============================================ */

.tbb-topbar--dark {
  background: rgba(255, 255, 255, 0.98);
  color: #1a1a1a;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.tbb-topbar--dark .tbb-topbar__logo-link,
.tbb-topbar--dark .tbb-topbar__menu a,
.tbb-topbar--dark .tbb-topbar__cta {
  color: #1a1a1a;
}

.tbb-topbar--dark .tbb-topbar__menu a:hover,
.tbb-topbar--dark .tbb-topbar__cta:hover {
  color: #333333;
}

.tbb-topbar--dark .tbb-topbar__cta {
  border-color: #1a1a1a;
}

.tbb-topbar--dark .tbb-topbar__cta:hover {
  background: rgba(0, 0, 0, 0.06);
}

.tbb-topbar--dark .tbb-topbar__hamburger-line {
  background-color: #1a1a1a;
}

/* Customizer overrides (colors, fonts, border, shadow - vars set in inline CSS) */
.tbb-topbar {
  background: var(--tbb-bg);
}

.tbb-topbar .tbb-topbar__logo-link,
.tbb-topbar .tbb-topbar__menu a,
.tbb-topbar .tbb-topbar__cta {
  color: var(--tbb-text);
}

.tbb-topbar .tbb-topbar__menu a:hover,
.tbb-topbar .tbb-topbar__cta:hover {
  color: var(--tbb-hover);
}

.tbb-topbar .tbb-topbar__menu,
.tbb-topbar .tbb-topbar__menu a,
.tbb-topbar .tbb-topbar__cta {
  font-family: var(--tbb-font), sans-serif;
  font-size: var(--tbb-font-size, 15px);
  font-weight: var(--tbb-font-weight, 500);
}

.tbb-topbar {
  border-bottom: var(--tbb-border);
  box-shadow: var(--tbb-shadow);
}

/* ============================================
   Logo
   ============================================ */

.tbb-topbar__logo {
  flex-shrink: 0;
}

.tbb-topbar__logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  transition: opacity 0.2s ease;
}

.tbb-topbar__logo-link:hover {
  opacity: 0.9;
}

.tbb-topbar__logo-img {
  max-height: 36px;
  width: auto;
  display: block;
}

.tbb-topbar__logo-text {
  white-space: nowrap;
}

/* ============================================
   Navigation & Menu
   ============================================ */

.tbb-topbar__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 2rem;
}

.tbb-topbar__menu-wrap {
  display: flex;
  justify-content: center;
}

.tbb-topbar__menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tbb-topbar__menu li {
  margin: 0;
}

.tbb-topbar__menu > li {
  position: relative;
}

.tbb-topbar__menu a {
  display: block;
  padding: 0.5rem 0.875rem;
  text-decoration: none;
  font-size: var(--tbb-font-size, 0.9375rem);
  font-weight: var(--tbb-font-weight, 500);
  letter-spacing: 0.01em;
  border-radius: 6px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.tbb-topbar__menu a:hover {
  background: rgba(128, 128, 128, 0.1);
}

/* Active page indicator - underline */
.tbb-topbar__menu .current-menu-item > a {
  font-weight: 600;
}

.tbb-topbar--active-underline .tbb-topbar__menu .current-menu-item > a {
  box-shadow: inset 0 -2px 0 currentColor;
}

.tbb-topbar .tbb-topbar__menu .current-menu-item > a {
  color: var(--tbb-active-color, var(--tbb-active));
}

/* Active page indicator - highlight */
.tbb-topbar--active-highlight .tbb-topbar__menu .current-menu-item > a {
  background: rgba(128, 128, 128, 0.15);
}

.tbb-topbar--active-highlight .tbb-topbar__menu .current-menu-item > a:hover {
  background: rgba(128, 128, 128, 0.2);
}

/* ============================================
   Dropdown / Submenu
   ============================================ */

.tbb-topbar__menu .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  padding: 0.5rem 0;
  margin: 0;
  list-style: none;
  background: var(--tbb-dropdown-bg, #ffffff);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;

  z-index: 100;
}

.tbb-topbar__menu > li:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tbb-topbar__menu .sub-menu li {
  margin: 0;
}

.tbb-topbar__menu .sub-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--tbb-dropdown-text, #1a1a1a) !important;
  background: transparent;
  border-radius: 4px;
  white-space: nowrap;
}

.tbb-topbar__menu .sub-menu a:hover {
  background: var(--tbb-dropdown-hover, #f5f5f5) !important;
}

/* Right CTA Link */
.tbb-topbar__right {
  flex-shrink: 0;
}

.tbb-topbar__cta {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  font-size: var(--tbb-font-size, 0.9375rem);
  font-weight: 600;
  text-decoration: none;
  border: 2px solid currentColor;
  border-radius: 8px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ============================================
   Hamburger (Mobile)
   ============================================ */

.tbb-topbar__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  gap: 5px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.tbb-topbar__hamburger:hover {
  background: rgba(128, 128, 128, 0.1);
}

.tbb-topbar__hamburger-line {
  width: 22px;
  height: 2px;
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.tbb-topbar__hamburger[aria-expanded="true"] .tbb-topbar__hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.tbb-topbar__hamburger[aria-expanded="true"] .tbb-topbar__hamburger-line:nth-child(2) {
  opacity: 0;
}

.tbb-topbar__hamburger[aria-expanded="true"] .tbb-topbar__hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile overlay (backdrop) - visible when menu open */
.tbb-topbar__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 9998;
}

/* Breakpoint controlled by JS + inline CSS - default 991px */
@media (max-width: 991px) {
  body.tbb-topbar-menu-open .tbb-topbar__overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
}

@media (min-width: 992px) {
  .tbb-topbar__overlay {
    display: none !important;
  }
}

/* Prevent body scroll when mobile menu is open */
@media (max-width: 991px) {
  body.tbb-topbar-menu-open {
    overflow: hidden;
  }
}

/* ============================================
   Mobile Responsive (default breakpoint 991px)
   ============================================ */

@media (max-width: 991px) {
  .tbb-topbar__hamburger {
    display: flex;
    order: 2;
  }

  /* Hide dropdown on mobile - show in slide panel */
  .tbb-topbar__menu .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    padding-left: 1rem;
    margin-top: 0.25rem;
  }

  .tbb-topbar__menu > li:hover > .sub-menu {
    transform: none;
  }

  .tbb-topbar__nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    z-index: 10000;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 5rem 1.5rem 2rem;
    gap: 0;
    background: #ffffff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }

  .tbb-topbar--light .tbb-topbar__nav {
    background: #1a1a1a;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
  }

  .tbb-topbar__nav.tbb-topbar__nav--open {
    transform: translateX(0);
  }

  .tbb-topbar--light .tbb-topbar__nav .tbb-topbar__menu a,
  .tbb-topbar--light .tbb-topbar__nav .tbb-topbar__cta {
    color: #ffffff;
  }

  .tbb-topbar--light .tbb-topbar__nav .tbb-topbar__cta {
    border-color: #ffffff;
  }

  .tbb-topbar__menu-wrap {
    flex: 1;
    justify-content: flex-start;
  }

  .tbb-topbar__menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }

  .tbb-topbar__menu a {
    padding: 0.875rem 1rem;
    font-size: 1rem;
  }

  .tbb-topbar__right {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  .tbb-topbar--light .tbb-topbar__right {
    border-top-color: rgba(255, 255, 255, 0.2);
  }

  .tbb-topbar__cta {
    display: block;
    text-align: center;
    padding: 0.75rem 1.25rem;
  }
}

@media (max-width: 480px) {
  .tbb-topbar {
    padding: 0.625rem 1rem;
  }

  .tbb-topbar__logo-text {
    font-size: 1.1rem;
  }
}

/* Body padding to prevent content from hiding under fixed topbar */
body.tbb-topbar-active {
  padding-top: 60px;
}

@media (max-width: 991px) {
  body.tbb-topbar-active {
    padding-top: 56px;
  }
}

/* Homepage: no body padding so hero can extend under transparent header */
body.tbb-topbar-active.tbb-topbar-transparent {
  padding-top: 0;
}

@media (max-width: 991px) {
  body.tbb-topbar-active.tbb-topbar-transparent {
    padding-top: 0;
  }
}
