/* tab bar  */
.page-header {
  width: 100%;
  display: flex;
  position: relative;
  flex-wrap: nowrap;
  overflow: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
  height: 40px;
  min-height: 40px;
  background: #fff;
  border-radius: 6px 6px 0 0;
  border-bottom: 1px solid #f0f0f0dd;
}

.page-header .tab {
  border: none;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.2px;
  padding: 4px 12px;
  border-bottom: 2px solid transparent;
  background-color: var(--secondBackground);
  color: var(--onSecondBackground);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 6px 6px 0px 0px;
  flex: 0 0 auto;
  transition: all 0.6s ease;
}

.page-header .tab.active {
  color: #000000;
  border-bottom: 2px solid #0300ae;
  background-color: #0300ae12;
}

.page-header .tab-close {
  background-color: var(--onTertiary);
  margin-left: 8px;
  border-radius: 50%;
  display: flex;
  width: 0.9rem;
  height: 0.9rem;
  justify-content: center;
  align-items: center;
}

.page-header .tab-close svg {
  width: 0.7rem;
  height: 0.7rem;
  fill: #000000;
  margin: auto;
}

.page-header .tab-close:hover {
  background-color: #0300ae12;
}

.page-header .tab-close:hover svg {
  fill: #0300ae;
  height: 12px;
  width: 12px;
}

/* Sticky close all button - positioned at the end */
.page-header-close-all {
  flex: 0 0 auto;
  position: sticky;
  right: 0;
  z-index: 2;
  margin-left: auto;
  height: 100%;
  border: none;
  border-left: 0.5px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #666666;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.page-header-close-all:hover {
  background: rgba(239, 68, 68, 0.09);
  color: #c0392b;
}

.page-header-close-all:active {
  transform: scale(0.96);
}

.page-header-close-all svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.page-header-close-all:hover svg {
  transform: scale(1.15);
}

/* overflow tabs dropdown */

.page-header-tabs {
  display: flex;
  flex-wrap: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.page-header .tab.tab-hidden {
  visibility: hidden;
  pointer-events: none;
}
/* ============ OVERFLOW BUTTON ============ */
.page-header-overflow {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  margin-left: 4px;
  border-left: 1px solid rgba(0, 0, 0, 0.06);
}

.page-header-overflow-btn {
  height: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
  font-size: 14px;
  /* font-weight: 600; */
  letter-spacing: 0.2px;
  color: #4b4b57;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  /* gap: 4px; */
  transition: all 0.18s ease;
}

.page-header-overflow-btn svg {
  height: 14px;
  width: 14px;
}

.page-header-overflow-btn:hover,
.page-header-overflow-btn.active {
  background: rgba(3, 0, 174, 0.08);
  border-color: rgba(3, 0, 174, 0.15);
  color: #0300ae;
}

/* .page-header-overflow-btn:active {
  transform: scale(0.97);
} */

/* ============ DROPDOWN MENU ============ */
.page-header-overflow-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  max-height: 250px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  box-shadow:
    0 4px 12px rgba(15, 15, 35, 0.06),
    0 12px 32px rgba(15, 15, 35, 0.12);

  z-index: 50;
  padding: 6px;

  animation: overflowMenuIn 0.16s ease-out;
  transform-origin: top right;
}

@keyframes overflowMenuIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Custom scrollbar */
.page-header-overflow-menu::-webkit-scrollbar {
  width: 6px;
}
.page-header-overflow-menu::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
.page-header-overflow-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* ============ MENU ITEMS ============ */
.page-header-overflow-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: #2b2b35;
  transition:
    background 0.15s ease,
    color 0.15s ease;
  position: relative;
}

.page-header-overflow-item + .page-header-overflow-item {
  margin-top: 1px;
}

.page-header-overflow-item:hover {
  background: #f4f4f7;
}

.page-header-overflow-item.active {
  background: linear-gradient(
    180deg,
    rgba(3, 0, 174, 0.1),
    rgba(3, 0, 174, 0.06)
  );
  color: #0300ae;
  font-weight: 600;
}

/* Item label (button) */
.page-header-overflow-item-label {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Close (×) icon */
.page-header-overflow-item .tab-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: #8a8a96;
  transition: all 0.15s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.page-header-overflow-item .tab-close-btn svg {
  height: 14px;
  width: 14px;
}

.page-header-overflow-item:hover .tab-close-btn,
.page-header-overflow-item.active .tab-close-btn {
  opacity: 1;
}

.page-header-overflow-item .tab-close-btn:hover {
  background: rgba(3, 0, 174, 0.12);
  color: #0300ae;
}
