/* ===== Base ===== */

.scc-main-nav {
  position: relative;
  width: 100%;
  font-size: 15px;
  line-height: 1.4;
}

.scc-main-menu,
.scc-main-menu .sub-menu {
  margin: 0;
  padding: 0;
  list-style: none;
}

.scc-main-menu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.scc-main-menu > li {
  position: relative;
  font-size: 15px;
}

/* ===== Top level links ===== */

.scc-main-menu > li > a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 14px;
  background: #f3f4f6;
  color: #1f2937;
  text-decoration: none;
  font: inherit;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.scc-main-menu > li > a:hover {
  background: #e5e7eb;
  color: #111827;
  text-decoration: none;
}

.scc-main-menu > li > a:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px #005fcc;
}

/* ===== Items with children ===== */

.scc-main-menu .menu-item-has-children {
  position: relative;
}

.scc-main-menu .menu-item-has-children > a {
  position: relative;
  display: flex;
  align-items: center;
}

/* Верхній рівень: місце під стрілку */
.scc-main-menu > .menu-item-has-children > a {
  padding-right: 38px;
}

/* Вкладений рівень */
.scc-main-menu .sub-menu .menu-item-has-children > a {
  width: 100%;
  min-height: 40px;
  background: transparent;
  color: #1f2937;
  text-decoration: none;
  font: inherit;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.scc-main-menu .sub-menu .menu-item-has-children > a:hover {
  background: #f3f4f6;
  color: #111827;
  text-decoration: none;
}

.scc-main-menu .sub-menu .menu-item-has-children > a:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px #005fcc;
}

/* ===== Chevron via CSS ===== */

/* Верхній рівень: вниз */
.scc-main-menu > .menu-item-has-children > a::after {
  content: '\f078';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  font-size: 12px;
  line-height: 1;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.22s ease;
  pointer-events: none;
}

/* Верхній рівень у відкритому стані: вгору */
.scc-main-menu > .menu-item-has-children.is-open > a::after {
  transform: translateY(-50%) rotate(180deg);
}

/* Вкладений рівень: вправо */
.scc-main-menu .sub-menu .menu-item-has-children > a::after {
  content: '\f054';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  font-size: 12px;
  line-height: 1;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.22s ease;
  pointer-events: none;
}

/* Вкладений рівень у відкритому стані: вниз */
.scc-main-menu .sub-menu .menu-item-has-children.is-open > a::after {
  transform: translateY(-50%) rotate(90deg);
}

/* ===== Dropdown menus ===== */

.scc-main-menu .sub-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 290px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
  z-index: 1000;
  display: none;
}

/* Submenu 2 */
.scc-main-menu .sub-menu .menu-item-has-children > .sub-menu {
  top: 0;
  left: calc(100% + 8px);
  min-width: 250px;
}

/* Мовне меню вправо */
.scc-main-menu > li.qtranxs-lang-menu > .sub-menu,
.scc-main-menu > li.scc-language-menu > .sub-menu {
  left: auto;
  right: 0;
}

/* ===== Items inside dropdown ===== */

.scc-main-menu .sub-menu li {
  position: relative;
  font-size: 15px;
}

.scc-main-menu .sub-menu li > a {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 18px;
  background: transparent;
  color: #1f2937;
  text-decoration: none;
  font: inherit;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.scc-main-menu .sub-menu li > a:hover {
  background: #f3f4f6;
  color: #111827;
  text-decoration: none;
}

.scc-main-menu .sub-menu li > a:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px #005fcc;
}

.scc-main-menu .sub-menu li + li {
  margin-top: 2px;
}

.scc-main-menu .sub-menu > li:first-child > a {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  padding-top: 12px;
}

.scc-main-menu .sub-menu > li:last-child > a {
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  padding-bottom: 12px;
}

/* ===== Optional special top items ===== */

.scc-main-menu > li.scc-search-item > a {
  width: 42px;
  min-width: 42px;
  justify-content: center;
  padding: 10px;
  background: #eceff3;
  color: #6b7280;
}

.scc-main-menu > li.scc-search-item > a:hover {
  background: #dfe4ea;
  color: #374151;
}

/* ===== Hide old theme toggle ===== */

.scc-main-nav .sub-toggle,
.scc-main-nav .scc-sub-toggle {
  display: none !important;
}

/* ===== Active states ===== */

.scc-main-menu .current-menu-item > a,
.scc-main-menu .current-menu-ancestor > a,
.scc-main-menu .current-menu-parent > a {
  background: #e8f0fe;
  color: #0b57d0;
}

/* ===== Box model cleanup ===== */

.scc-main-menu a {
  box-sizing: border-box;
}

/* ===== Reduced motion ===== */

@media (prefers-reduced-motion: reduce) {
  .scc-main-menu > li > a,
  .scc-main-menu .sub-menu li > a,
  .scc-main-menu > .menu-item-has-children > a::after,
  .scc-main-menu .sub-menu .menu-item-has-children > a::after {
    transition: none;
  }
}

/* ===== Responsive ===== */

@media (max-width: 991.98px) {
  .scc-main-menu .sub-menu {
    min-width: 240px;
  }

  .scc-main-menu .sub-menu .menu-item-has-children > .sub-menu {
    min-width: 220px;
  }
}

@media (max-width: 767.98px) {
  .scc-main-menu {
    display: block;
  }

  .scc-main-menu > li + li {
    margin-top: 8px;
  }

  .scc-main-menu > li > a {
    display: flex;
    width: 100%;
  }

  .scc-main-menu > .menu-item-has-children > a,
  .scc-main-menu .sub-menu .menu-item-has-children > a {
    padding-right: 38px;
  }

  .scc-main-menu .sub-menu {
    position: static;
    min-width: 100%;
    margin-top: 8px;
    box-shadow: none;
    border: 1px solid #e5e7eb;
    display: none;
  }

  .scc-main-menu .sub-menu .menu-item-has-children > .sub-menu {
    left: auto;
    margin-left: 12px;
    margin-top: 6px;
  }
}
