/* =============================================
   FRONTIER MITSUBISHI — HEADER STYLES
   ============================================= */

/* Custom element defaults to display:inline — must be block for sticky/layout to work */
site-header { display: block; }

/* --- Top Bar --- */
.header-top {
  background: var(--charcoal);
  color: rgba(255,255,255,0.75);
  font-size: 12.5px;
  height: var(--header-top-height);
  display: flex;
  align-items: center;
}
.header-top .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.header-top-left {
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-top-left span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-top-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-top-right a {
  color: rgba(255,255,255,0.7);
  transition: color var(--transition);
  font-size: 12.5px;
}
.header-top-right a:hover { color: var(--white); }
.header-top-search {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.header-search-toggle {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.28);
  color: rgba(255,255,255,0.78);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.header-search-toggle:hover {
  color: var(--white);
  border-color: rgba(255,255,255,0.56);
  background: rgba(255,255,255,0.08);
}
.header-search-form {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  align-items: center;
  gap: 8px;
  width: 320px;
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 8px;
  box-shadow: var(--shadow);
  z-index: 1200;
}
.header-top-search.open .header-search-form {
  display: flex;
}
.header-search-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
}
.header-search-form input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(228, 0, 43, 0.16);
}
.header-search-form button {
  border: 0;
  background: var(--red);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.header-search-form button:hover {
  background: var(--red-dark);
}
.btn-header-cta {
  background: var(--red);
  color: var(--white) !important;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.03em;
  transition: background var(--transition) !important;
}
.btn-header-cta:hover { background: var(--red-dark) !important; }

/* --- Main Nav --- */
.header-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: box-shadow var(--transition), background var(--transition);
}
.header-nav.scrolled {
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}
.header-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  gap: 32px;
}

/* --- Logo --- */
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-mark {
  flex-shrink: 0;
}
.logo-mark img {
  height: 40px;
  width: auto;
  display: block;
}
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.logo-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.logo-brand {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--red);
  text-transform: uppercase;
}

/* --- Nav Menu --- */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: flex-end;
}
.nav-item { position: relative; }
.nav-mobile-search {
  display: none;
}
.nav-mobile-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-mobile-search-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--white);
}
.nav-mobile-search-form input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(228, 0, 43, 0.16);
}
.nav-mobile-search-form button {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--red);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-mobile-search-form button:hover {
  background: var(--red-dark);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.nav-link .chevron {
  width: 10px;
  height: 7px;
  transition: transform var(--transition);
  flex-shrink: 0;
  opacity: 0.6;
}
.nav-item.active > .nav-link,
.nav-link:hover { color: var(--red); background: rgba(228, 0, 43, 0.05); }
.nav-item.active > .nav-link { color: var(--red); }

@media (hover: none), (pointer: coarse) {
  .nav-link:hover {
    color: var(--text-primary);
    background: transparent;
  }
  .dropdown-link:hover {
    background: transparent;
    color: inherit;
  }
  .dropdown-link.plain:hover {
    color: var(--text-body);
  }
}

/* --- Dropdown --- */
.has-dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 0;
  width: max-content;
  max-width: calc(100vw - 48px);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 56px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 100;
  padding-top: 8px;
}
.has-dropdown:hover .dropdown-menu,
.has-dropdown.dropdown-open .dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
  padding-top: 8px;
}
.has-dropdown:hover > .nav-link .chevron {
  transform: rotate(180deg);
}
.dropdown-inner {
  display: flex;
  gap: 0;
  padding: 24px;
}
.dropdown-column {
  flex: 0 0 auto;
  padding: 0 16px;
  border-right: 1px solid var(--border);
}
.dropdown-column:last-of-type { border-right: none; }
.dropdown-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--light-gray);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bg-light);
}
.dropdown-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 6px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
}
.dropdown-link:hover { background: rgba(228, 0, 43, 0.05); }
.dropdown-link-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}
.dropdown-link strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.dropdown-link small {
  display: block;
  font-size: 12px;
  color: var(--text-light);
}
.dropdown-link.plain {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-body);
  padding: 7px 8px;
  align-items: center;
}
.dropdown-link.plain:hover { color: var(--red); }
.dropdown-cta {
  padding-left: 20px;
  display: flex;
  align-items: center;
}
.dropdown-cta-card {
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 20px 18px;
  text-align: center;
  min-width: 160px;
}
.dropdown-cta-card p {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* --- Mobile Toggle --- */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
  -webkit-appearance: none;
  background: transparent;
}
.nav-toggle .icon-close { display: none; }
.nav-toggle.open .icon-menu  { display: none; }
.nav-toggle.open .icon-close { display: block; }

/* --- Mobile Responsive --- */
@media (max-width: 1024px) {
  .header-top { display: none; }
  .nav-toggle { display: flex; }
  .nav-mobile-search {
    display: block;
    padding: 4px 0 12px;
  }
  .nav-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    overflow-y: auto;
    padding: 16px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 999;
  }
  .nav-menu.open { transform: none; }
  .nav-link {
    padding: 14px 16px;
    font-size: 16px;
    justify-content: space-between;
    border-radius: var(--radius);
    border-bottom: 1px solid var(--bg-light);
  }
  .dropdown-menu {
    position: static;
    transform: none;
    left: auto;
    min-width: unset;
    width: 100%;
    max-width: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    opacity: 1;
    pointer-events: all;
    display: none;
    background: var(--bg-light);
    border-radius: var(--radius);
    margin: 4px 0 8px;
  }
  .has-dropdown.dropdown-open .dropdown-menu { display: block; }
  /* Prevent desktop hover transform from firing on touch and breaking layout */
  .has-dropdown:hover .dropdown-menu { transform: none; }
  .dropdown-inner { flex-direction: column; padding: 12px; gap: 12px; }
  .dropdown-inner,
  .dropdown-column,
  .dropdown-link {
    width: 100%;
  }
  .dropdown-column { border-right: none; border-bottom: 1px solid var(--border); padding: 0 0 12px; }
  .dropdown-column:last-of-type { border-bottom: none; }
  .dropdown-cta { display: none; }
  .has-dropdown > .nav-link .chevron { opacity: 1; }
  .has-dropdown.dropdown-open > .nav-link .chevron { transform: rotate(180deg); }
}
@media (max-width: 480px) {
  .header-nav .container { padding: 0 16px; }
}
