/* Shared styles for the FlowBoard top navigation (flow-nav.js).
   Loaded on every app page so the glass-nav looks identical whether or not a
   page also happens to load home.css / mobile-i18n.css. Values mirror the
   original home.css nav so the polished home look now applies everywhere. */

.glass-nav {
  position: sticky;
  top: 14px;
  z-index: 50;
  width: 100%;
  max-width: 100%;
  margin: 0 auto 24px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 14px 38px rgba(18, 31, 31, 0.09);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.glass-nav .nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.glass-nav .page-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 0;
  border-radius: 12px 12px 0 0;
  background: transparent;
  color: var(--muted, #5c6b84);
  font-weight: 800;
  font-size: 0.98rem;
  transition: color 0.2s ease, background 0.2s ease;
  text-decoration: none;
  cursor: pointer;
}

.glass-nav .page-nav-link::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 3px;
  height: 3px;
  border-radius: 3px;
  background: transparent;
  transition: background 0.2s ease;
}

.glass-nav .page-nav-link:hover {
  background: rgba(15, 124, 114, 0.06);
  color: var(--ink, #111);
}

.glass-nav .page-nav-link.active {
  color: var(--accent-dark, #09524d);
  background: rgba(15, 124, 114, 0.08);
}

.glass-nav .page-nav-link.active::after {
  background: linear-gradient(135deg, var(--accent, #0f7c72), var(--accent-dark, #09524d));
}

.glass-nav .nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.glass-nav .language-toggle {
  min-width: 72px;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--fb-radius-pill,999px);
  color: #ffffff;
  background: linear-gradient(135deg, #6757d8, #0f7c72);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(103, 87, 216, 0.22);
}

.glass-nav .theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--fb-radius-pill,999px);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink, #111);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.glass-nav .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.75);
}

html[dir="rtl"] .glass-nav .page-nav-link {
  flex-direction: row-reverse;
}

:root[data-theme="dark"] .glass-nav {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(14, 23, 21, 0.72);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.34);
}

:root[data-theme="dark"] .glass-nav .page-nav-link:hover,
:root[data-theme="dark"] .glass-nav .theme-toggle {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

:root[data-theme="dark"] .glass-nav .page-nav-link.active {
  color: #7fe0d5;
  background: rgba(127, 224, 213, 0.1);
}

@media (max-width: 700px) {
  .glass-nav {
    align-items: stretch;
    gap: 12px;
  }
  /* min-width:0 lets the panel shrink to the viewport instead of growing to
     its content's min-content width (which overflowed and clipped RTL text). */
  .app-shell > .task-panel,
  .task-panel {
    min-width: 0;
    max-width: 100%;
  }
  .glass-nav .nav-links {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .glass-nav .nav-links::-webkit-scrollbar {
    display: none;
  }
  .glass-nav .page-nav-link {
    white-space: normal;
    justify-content: center;
    border-radius: 12px;
  }
}

@media (max-width: 430px) {
  .glass-nav .page-nav-link svg {
    width: 16px;
    height: 16px;
  }
}

/* ---- Slide-out menu (holds the action controls) --------------------------- */

.glass-nav .nav-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent, #0f7c72), var(--accent-dark, #09524d));
  box-shadow: 0 10px 24px rgba(15, 124, 114, 0.22);
  cursor: pointer;
}

.glass-nav .nav-menu-btn:hover {
  filter: brightness(1.05);
}

.nav-slide {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  pointer-events: none;
}

.nav-slide.open {
  pointer-events: auto;
}

.nav-slide-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 16, 0.45);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.nav-slide.open .nav-slide-backdrop {
  opacity: 1;
}

.nav-slide-panel {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  height: 100%;
  width: min(360px, 86vw);
  padding: 64px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  background: #ffffff;
  box-shadow: -14px 0 44px rgba(16, 24, 40, 0.18);
  transform: translateX(100%);
  transition: transform 0.28s ease;
}

html[dir="rtl"] .nav-slide-panel {
  transform: translateX(-100%);
  box-shadow: 14px 0 44px rgba(16, 24, 40, 0.18);
}

.nav-slide.open .nav-slide-panel {
  transform: translateX(0);
}

.nav-slide-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink, #111);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.nav-slide-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* The action controls (Storage, Invite, Email report, user, Log out, language,
   theme) are injected into .nav-actions; stack them vertically in the drawer.
   The drawer is relocated to <body>, so these selectors are not scoped to
   .glass-nav. */
.nav-slide .nav-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.nav-slide .nav-actions > *,
.nav-slide .nav-actions .auth-nav {
  width: 100%;
  margin: 0;
}

.nav-slide .nav-actions .auth-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.nav-slide .nav-actions button,
.nav-slide .nav-actions a,
.nav-slide .nav-actions .auth-nav button,
.nav-slide .nav-actions .auth-nav a {
  width: 100%;
  min-height: 46px;
  justify-content: center;
  text-align: center;
}

.nav-slide .nav-actions .auth-user {
  justify-content: center;
  text-align: center;
}

/* Language + theme toggles inside the drawer (nav-actions moved to <body>, so
   the .glass-nav toggle rules no longer reach them). */
.nav-slide .nav-actions .language-toggle {
  border: 0;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(135deg, #6757d8, #0f7c72);
  font-weight: 900;
}

.nav-slide .nav-actions .theme-toggle {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink, #111);
}

.theme-toggle .ti {
  width: 20px;
  height: 20px;
}

.theme-toggle .ti-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .ti-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .ti-sun {
  display: inline-block;
}

/* Beat the global design-system rule that forces dark text on buttons. */
:root[data-theme="dark"] .nav-slide .nav-actions .theme-toggle {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #eef6f4 !important;
}

:root[data-theme="dark"] .nav-slide .nav-actions .language-toggle {
  color: #ffffff !important;
}

body.nav-slide-lock {
  overflow: hidden;
}

:root[data-theme="dark"] .nav-slide-panel {
  background: #0e1715;
  color: var(--ink);
}

:root[data-theme="dark"] .nav-slide-close {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

:root[data-theme="dark"] .nav-slide-close:hover {
  background: rgba(255, 255, 255, 0.16);
}
