/**
 * Fediya Team — Navigation v2 (sidebar drawer + mobile tabbar)
 * Loaded after team-shell.css / team-pro-max.css
 */

html[data-app="team"] {
  --nav-w: 232px;
  --tabbar-h: 56px;
}

/* ── Shell layout ── */
.team-shell--v2 {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  min-height: 100svh;
}

.team-shell--v2 .team-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

/* ── Drawer (desktop = sidebar) ── */
.team-shell--v2 .team-drawer {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 100svh;
  width: var(--nav-w);
  display: flex;
  flex-direction: column;
  background: var(--team-surface);
  border-inline-start: 1px solid var(--team-glass-border);
  box-shadow: -2px 0 16px rgba(15, 26, 18, 0.03);
}

.team-drawer-backdrop {
  display: none;
}

.team-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 10px;
  flex-shrink: 0;
}

.team-drawer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.team-drawer__logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.team-drawer__brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.team-drawer__brand-text strong {
  font-family: var(--font-display, "Fediya Display", sans-serif);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-drawer__brand-text small {
  font-size: 0.6875rem;
  color: var(--team-text-muted);
  margin-top: 2px;
}

.team-drawer__close {
  display: none;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: var(--team-surface-2);
  color: var(--team-text);
  cursor: pointer;
  flex-shrink: 0;
}

.team-drawer__search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 10px 8px;
  padding: 0 10px;
  min-height: 34px;
  border: 1px solid var(--team-glass-border);
  border-radius: 8px;
  background: var(--team-surface-2);
  color: var(--team-text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  text-align: start;
  flex-shrink: 0;
  transition: border-color var(--duration-fast), background var(--duration-fast);
}

.team-drawer__search:hover {
  background: var(--team-surface);
  border-color: color-mix(in srgb, var(--team-accent) 25%, var(--team-glass-border));
}

.team-drawer__search span {
  flex: 1;
  min-width: 0;
}

.team-drawer__search kbd {
  font-family: inherit;
  font-size: 0.625rem;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--team-glass-border);
  background: var(--team-surface);
  color: var(--team-text-muted);
}

.team-drawer__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px 12px;
  scrollbar-width: thin;
}

.team-drawer__group {
  margin-bottom: 4px;
}

.team-drawer__label {
  margin: 10px 8px 4px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--team-text-muted);
}

.team-drawer__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--team-text);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: start;
  transition: background var(--duration-fast);
}

.team-drawer__toggle:hover {
  background: var(--team-surface-2);
}

.team-drawer__group.is-active > .team-drawer__toggle {
  color: var(--team-accent-deep);
}

.team-drawer__toggle-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--team-surface-2);
  color: var(--team-accent-deep);
  flex-shrink: 0;
}

.team-drawer__toggle-text {
  flex: 1;
  min-width: 0;
}

.team-drawer__toggle-chevron {
  display: inline-flex;
  opacity: 0.45;
  transition: transform var(--duration-normal) var(--ease-out);
}

.team-drawer__group.is-open .team-drawer__toggle-chevron {
  transform: rotate(-90deg);
  opacity: 0.8;
}

.team-drawer__group:not(.is-open):not(.team-drawer__group--flat) .team-drawer__links {
  display: none;
}

.team-drawer__links {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 4px 4px;
  margin-inline-start: 8px;
  border-inline-start: 1px solid color-mix(in srgb, var(--team-accent) 15%, var(--team-glass-border));
}

.team-drawer__group--flat .team-drawer__links {
  margin-inline-start: 0;
  border-inline-start: none;
  padding-inline-start: 0;
}

.team-drawer__link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--team-text);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--duration-fast), color var(--duration-fast);
}

.team-drawer__link:hover {
  background: var(--team-surface-2);
  color: var(--team-accent-deep);
}

.team-drawer__link.is-active {
  background: color-mix(in srgb, var(--team-accent) 12%, var(--team-surface-2));
  color: var(--team-accent-deep);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--team-accent);
}

.team-drawer__link-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.75;
}

.team-drawer__link.is-active .team-drawer__link-icon {
  opacity: 1;
}

.team-drawer__link-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-drawer__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--team-glass-border);
  flex-shrink: 0;
  background: color-mix(in srgb, var(--team-surface-2) 50%, var(--team-surface));
}

.team-drawer__user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.team-drawer__avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--team-accent-deep), var(--team-accent));
  flex-shrink: 0;
}

.team-drawer__user-meta {
  min-width: 0;
}

.team-drawer__user-meta strong {
  display: block;
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-drawer__user-meta span {
  display: block;
  font-size: 0.6875rem;
  color: var(--team-text-muted);
}

.team-drawer__logout {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--team-surface-2);
  color: var(--team-text-muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: background var(--duration-fast), color var(--duration-fast);
}

.team-drawer__logout:hover {
  background: color-mix(in srgb, var(--status-danger, #c0392b) 10%, var(--team-surface-2));
  color: var(--status-danger, #c0392b);
}

/* ── Topbar v2 ── */
.team-topbar--v2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--team-glass-border);
  background: color-mix(in srgb, var(--team-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.team-topbar--v2 .team-topbar__start {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.team-topbar__menu {
  display: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--team-glass-border);
  border-radius: 8px;
  background: var(--team-surface-2);
  color: var(--team-text);
  cursor: pointer;
}

.team-topbar--v2 .team-topbar__logo {
  display: none;
}

.team-topbar--v2 .team-topbar__title {
  margin: 0;
  font-family: var(--font-display, "Fediya Display", sans-serif);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: var(--tracking-tight, -0.02em);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(50vw, 280px);
}

.team-topbar--v2 .team-topbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.team-topbar__btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--team-glass-border);
  border-radius: 8px;
  background: var(--team-surface-2);
  color: var(--team-text);
  cursor: pointer;
  text-decoration: none;
}

.team-topbar__btn:hover {
  background: var(--team-surface-hover);
}

.team-topbar__badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 0.625rem;
  font-weight: 700;
  color: #fff;
  background: var(--status-danger, #c0392b);
  display: grid;
  place-items: center;
}

.team-topbar__cta {
  display: none;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--team-accent-deep), var(--team-accent));
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.team-topbar__cta:hover {
  color: #fff;
  filter: brightness(1.05);
}

html[data-team-theme="dark"] .team-theme-icon--dark,
html[data-team-theme="light"] .team-theme-icon--light {
  display: none;
}

/* ── Mobile tabbar ── */
.team-tabbar {
  display: none;
}

/* ── Desktop: hide old mobile-only elements ── */
.team-shell--v2 .team-mobile-nav {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════
   Mobile & tablet
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .team-shell--v2 {
    grid-template-columns: 1fr;
  }

  .team-shell--v2 .team-drawer {
    position: fixed;
    inset-inline-end: 0;
    top: 0;
    width: min(100vw, 300px);
    max-width: 100%;
    height: 100svh;
    height: 100dvh;
    transform: translateX(100%);
    transition: transform var(--duration-normal) var(--ease-out);
    box-shadow: none;
  }

  [dir="rtl"] .team-shell--v2 .team-drawer {
    transform: translateX(100%);
  }

  .team-shell--v2.is-sidebar-open .team-drawer {
    transform: translateX(0);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.18);
  }

  .team-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(8, 12, 10, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-normal);
  }

  .team-shell--v2.is-sidebar-open .team-drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .team-drawer__close {
    display: grid;
    place-items: center;
  }

  .team-topbar__menu {
    display: grid;
    place-items: center;
  }

  .team-topbar--v2 .team-topbar__logo {
    display: block;
    line-height: 0;
  }

  .team-topbar__logo-img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .team-shell--v2 .team-content {
    padding-bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
  }

  .team-tabbar {
    display: flex;
    align-items: stretch;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 40;
    min-height: var(--tabbar-h);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    gap: 2px;
    background: color-mix(in srgb, var(--team-surface) 96%, transparent);
    border-top: 1px solid var(--team-glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 -4px 20px rgba(15, 26, 18, 0.06);
  }

  .team-tabbar__item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    padding: 4px 2px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--team-text-muted);
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color var(--duration-fast), background var(--duration-fast);
    -webkit-tap-highlight-color: transparent;
  }

  .team-tabbar__icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
  }

  .team-tabbar__label {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .team-tabbar__item.is-active {
    color: var(--team-accent-deep);
    font-weight: 600;
  }

  .team-tabbar__item.is-active .team-tabbar__icon {
    color: var(--team-accent-deep);
  }

  .team-tabbar__item--more.is-active {
    color: var(--team-text-muted);
    font-weight: 500;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .team-topbar__cta {
    display: inline-flex;
  }
}

@media (max-width: 600px) {
  .team-topbar--v2 .team-topbar__title {
    max-width: 38vw;
    font-size: 0.875rem;
  }

  .team-topbar__btn--theme {
    display: none;
  }

  .team-shell--v2 .team-drawer {
    width: 100vw;
  }

  .team-drawer__link {
    min-height: 44px;
    padding: 8px 12px;
  }

  .team-drawer__toggle {
    min-height: 44px;
    padding: 10px 12px;
  }
}

@media (min-width: 901px) {
  .team-drawer__close {
    display: none !important;
  }
}
