/* Üst çubuk: marka, sekmeler, tema düğmesi. */

.app-header {
  position: sticky;
  z-index: 50;
  top: 0;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  transition: background var(--fast), border-color var(--fast);
}

/* Üst çubuk, ana içerikle (720px) aynı görsel eksende durur; 1080'e yayılınca
   logo ve tema düğmesi içerikten kopuk görünüyordu. */
.header-inner {
  display: grid;
  max-width: 720px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin: 0 auto;
}

/* Marka solda, tema düğmesi sağda; sekmeler iki yan sütunun genişliğinden
   bağımsız olarak sayfanın tam ortasında durur. */
.header-inner .brand {
  justify-self: start;
}

.header-inner .header-tabs {
  justify-self: center;
}

.header-inner .theme-toggle {
  justify-self: end;
}

.brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.35rem 0 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}

.brand-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.header-tabs {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-surface-soft);
}

.nav-tab {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 1rem;
  border: 0;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  background: transparent;
  font-size: 0.86rem;
  font-weight: 650;
  white-space: nowrap;
  transition: background var(--fast), color var(--fast);
}

.nav-tab svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab[aria-pressed="true"] {
  color: var(--primary);
  background: var(--bg-surface);
  font-weight: 750;
  box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .nav-tab[aria-pressed="true"] {
  color: var(--on-accent);
  background: var(--primary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-tab[aria-pressed="true"] {
    color: var(--on-accent);
    background: var(--primary);
  }
}

.theme-toggle {
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  background: var(--bg-surface-soft);
  transition: background var(--fast), border-color var(--fast);
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.theme-toggle[aria-pressed="true"] .icon-sun {
  display: block;
}

.theme-toggle[aria-pressed="true"] .icon-moon {
  display: none;
}

/* ---- Dar ekran: üst çubuk nefes alır, sekmeler daralır, tema düğmesi kenara yapışmaz ---- */

@media (max-width: 520px) {
  .brand-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* Yan boşluk .shell ile aynı (1rem): çubuğun kenarları içerik kartlarıyla birebir hizalanır. */
  .app-header {
    padding: 0.5rem 1rem;
  }

  /* Yan sütunlar eşit (44px'lik marka simgesi ve tema düğmesi), sekmeler tam ortada. */
  .header-inner {
    grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
    gap: 0.5rem;
  }

  .brand {
    padding-right: 0;
  }

  .header-tabs {
    min-width: 0;
    flex: 0 1 auto;
    gap: 0.2rem;
    padding: 0.2rem;
  }

  .nav-tab {
    padding-inline: 0.6rem;
    gap: 0.3rem;
    font-size: 0.78rem;
  }

  .nav-tab svg {
    width: 14px;
    height: 14px;
  }
}
