/* Shell layout: header, nav, theme toggle, and footer */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--accent);
  text-transform: uppercase;
}

.logo span { color: var(--text-muted); }

nav { display: flex; gap: 4px; }

nav button {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
}

nav .nav-link {
  display: inline-block;
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
  text-decoration: none;
}

nav button:hover { color: var(--text); border-color: var(--border); }
nav button.active { background: var(--accent); color: #000; border-color: var(--accent); }
nav .nav-link:hover { color: var(--text); border-color: var(--border); }
nav .nav-link.active { background: var(--accent); color: #000; border-color: var(--accent); }

.theme-toggle {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 90%, #ffffff 10%), var(--surface2));
  border: 1px solid color-mix(in srgb, var(--border) 78%, #ffffff 22%);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.22s ease;
  flex-shrink: 0;
  box-shadow: inset 0 1px 6px rgba(255,255,255,0.08), 0 5px 14px rgba(0,0,0,0.25);
  position: relative;
}

.theme-toggle::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  right: 8px;
  bottom: 8px;
  background: var(--accent3);
  opacity: 0.55;
  transition: all 0.22s ease;
}

.theme-toggle-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent2) 28%, var(--surface));
  color: #fff;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 2px 7px rgba(0,0,0,0.3);
  transform: translateX(0) rotate(0deg);
  transition: transform 0.22s ease, background-color 0.22s ease, color 0.22s ease;
}

.theme-toggle.is-light {
  border-color: color-mix(in srgb, var(--accent2) 45%, var(--border));
  background: linear-gradient(180deg, #edf5ff, #dfeeff);
}

.theme-toggle.is-light .theme-toggle-icon {
  background: #5b8cff;
  color: #040b1f;
  transform: translateX(-1px) rotate(-8deg);
}

.theme-toggle.is-light::after {
  background: #3dbb72;
  opacity: 0.9;
}

.theme-toggle.is-dark {
  border-color: #49517a;
  background: linear-gradient(180deg, #3f4568, #2d3356);
}

.theme-toggle.is-dark .theme-toggle-icon {
  background: #2a3150;
  color: #e8edff;
  transform: translateX(1px) rotate(8deg);
}

.theme-toggle.is-dark::after {
  background: #8ea0ff;
  opacity: 0.9;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 6px rgba(255,255,255,0.08), 0 7px 16px rgba(0,0,0,0.3);
}

.theme-toggle:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 75%, #ffffff 25%);
  outline-offset: 2px;
}

/* Slider variant used by shared toggle component */
.theme-toggle.slider {
  width: 58px;
  height: 32px;
  padding: 3px;
  border-radius: 999px;
  justify-content: flex-start;
  background: linear-gradient(180deg, #3f4568, #2d3356);
  border-color: #49517a;
  box-shadow: inset 0 1px 4px rgba(255,255,255,0.1), 0 3px 10px rgba(0,0,0,0.22);
}

.theme-toggle.slider::after {
  display: none;
}

.theme-toggle.slider .theme-toggle-icon {
  width: 26px;
  height: 26px;
  font-size: 12px;
  transform: translateX(0) rotate(0deg);
  transition: transform 0.22s ease, background-color 0.22s ease, color 0.22s ease;
  background: #2a3150;
  color: #e8edff;
}

.theme-toggle.slider.is-dark {
  background: linear-gradient(180deg, #3f4568, #2d3356);
  border-color: #49517a;
}

.theme-toggle.slider.is-dark .theme-toggle-icon {
  transform: translateX(0) rotate(0deg);
  background: #2a3150;
  color: #e8edff;
}

.theme-toggle.slider.is-light {
  background: linear-gradient(180deg, #edf5ff, #dfeeff);
  border-color: color-mix(in srgb, var(--accent2) 45%, var(--border));
}

.theme-toggle.slider.is-light .theme-toggle-icon {
  transform: translateX(26px) rotate(0deg);
  background: #5b8cff;
  color: #040b1f;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.user-greeting {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1;
  white-space: nowrap;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.current-username {
  font-size: 16px;
  line-height: 1;
  white-space: nowrap;
}

.current-username::first-letter {
  text-transform: uppercase;
}

.logout-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.logout-icon {
  font-size: 18px;
  line-height: 1;
  transform: translateY(-1px);
}

.logout-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface2);
  transform: translateY(-1px);
}

.app-footer {
  width: 100%;
  text-align: center;
  padding: 14px 16px 20px;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.2px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.app-footer-version,
.app-footer-madeby {
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.app-footer-separator {
  margin: 0 8px;
  opacity: 0.7;
}

[data-theme="light"] header {
  border-bottom-color: var(--border);
  box-shadow: 0 1px 0 var(--border);
}

[data-theme="light"] nav button.active {
  background: var(--accent);
  color: #f6fbff;
  border-color: var(--accent);
}

[data-theme="light"] nav .nav-link.active {
  background: var(--accent);
  color: #f6fbff;
  border-color: var(--accent);
}

@media (max-width: 640px) {
  header { padding: 14px 16px; }
  nav button, nav .nav-link { padding: 6px 10px; font-size: 13px; }
}