/* Artigos salvos — cabeçalho, painel e aviso local. */
.header-saved-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.header-saved-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.5rem 0.68rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  color: #aebacc;
  background: rgba(15, 23, 42, 0.48);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.header-saved-btn:hover,
.header-saved-btn:focus-visible,
.header-saved-btn.saved {
  color: #99f6e4;
  border-color: rgba(45, 212, 191, 0.42);
  background: rgba(20, 184, 166, 0.1);
  outline: none;
}

.header-saved-btn.saved svg {
  fill: currentColor;
}

.header-saved-btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.saved-count {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 0.28rem;
  border-radius: 999px;
  color: #032f2a;
  background: #5eead4;
  font-size: 0.65rem;
  font-weight: 900;
}

.saved-count[hidden] {
  display: none;
}

.saved-drawer-shell[hidden] {
  display: none !important;
}

.saved-drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 2000000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.saved-drawer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(2, 6, 12, 0.7);
  backdrop-filter: blur(7px);
  opacity: 0;
  cursor: default;
  transition: opacity 0.22s ease;
}

.saved-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(440px, 100%);
  height: 100%;
  padding: max(1.1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  overflow-y: auto;
  color: #e5edf5;
  background:
    radial-gradient(circle at top right, rgba(45, 212, 191, 0.09), transparent 24rem),
    #080e16;
  border-left: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: -28px 0 80px rgba(0, 0, 0, 0.42);
  transform: translateX(102%);
  transition: transform 0.24s ease;
}

.saved-drawer-shell.open .saved-drawer-backdrop {
  opacity: 1;
}

.saved-drawer-shell.open .saved-drawer {
  transform: translateX(0);
}

body.saved-drawer-open {
  overflow: hidden;
}

.saved-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.saved-drawer-header span {
  color: #5eead4;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.saved-drawer-header h2 {
  margin: 0.1rem 0 0;
  color: #f8fafc;
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.saved-drawer-close {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 13px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.7);
  font-size: 1.45rem;
  cursor: pointer;
}

.saved-storage-note {
  margin: 0 0 1rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid rgba(251, 191, 36, 0.18);
  border-radius: 13px;
  color: #c7ad76;
  background: rgba(251, 191, 36, 0.055);
  font-size: 0.75rem;
  line-height: 1.45;
}

.saved-drawer-list {
  display: grid;
  gap: 0.7rem;
}

.saved-item {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.64);
}

.saved-item-link {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  min-height: 96px;
  color: inherit;
  text-decoration: none;
}

.saved-item-link img,
.saved-item-placeholder {
  width: 104px;
  height: 100%;
  min-height: 96px;
  object-fit: cover;
  background: linear-gradient(145deg, rgba(45, 212, 191, 0.16), #0b121c);
}

.saved-item-copy {
  display: flex;
  min-width: 0;
  padding: 0.72rem 2.6rem 0.72rem 0.75rem;
  flex-direction: column;
  justify-content: center;
}

.saved-item-copy small {
  overflow: hidden;
  color: #5eead4;
  font-size: 0.63rem;
  font-weight: 850;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.saved-item-copy strong {
  display: -webkit-box;
  margin-top: 0.2rem;
  overflow: hidden;
  color: #f1f5f9;
  font-size: 0.87rem;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.saved-item-copy em {
  margin-top: 0.35rem;
  color: #94a3b8;
  font-size: 0.68rem;
  font-style: normal;
}

.saved-item-remove {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  color: #94a3b8;
  background: rgba(2, 8, 15, 0.72);
  font-size: 1rem;
  cursor: pointer;
}

.saved-item-remove:hover {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.34);
}

.saved-empty {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 2rem;
  color: #94a3b8;
  text-align: center;
}

.saved-empty > span {
  color: #5eead4;
  font-size: 2.3rem;
}

.saved-empty strong {
  color: #e2e8f0;
}

.saved-empty p {
  max-width: 260px;
  font-size: 0.82rem;
}

.saved-articles-toast {
  position: fixed;
  z-index: 2100000;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: min(390px, calc(100% - 24px));
  padding: 0.85rem;
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: 16px;
  color: #e8f3f4;
  background: rgba(6, 15, 22, 0.97);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.48);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.saved-articles-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.saved-toast-icon {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #032f2a;
  background: #5eead4;
  font-weight: 900;
}

.saved-articles-toast strong,
.saved-articles-toast small {
  display: block;
}

.saved-articles-toast strong {
  font-size: 0.84rem;
}

.saved-articles-toast small {
  margin-top: 0.22rem;
  color: #9aa9b8;
  font-size: 0.72rem;
  line-height: 1.4;
}

@media (max-width: 920px) {
  .header-saved-btn span:not(.saved-count) {
    display: none;
  }

  .header-saved-btn {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }
}

@media (max-width: 620px) {
  .header-saved-actions {
    gap: 0.25rem;
  }

  .header-saved-btn {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .saved-count {
    position: absolute;
    top: -5px;
    right: -5px;
  }

  .saved-drawer {
    top: auto;
    bottom: 0;
    width: 100%;
    height: min(82vh, 720px);
    padding-inline: 0.8rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    border-left: 0;
    border-radius: 24px 24px 0 0;
    transform: translateY(102%);
  }

  .saved-drawer-shell.open .saved-drawer {
    transform: translateY(0);
  }

  .saved-item-link {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .saved-item-link img,
  .saved-item-placeholder {
    width: 90px;
  }

  .saved-articles-toast {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .saved-drawer,
  .saved-drawer-backdrop,
  .saved-articles-toast {
    transition: none;
  }
}

/* Cabeçalho unificado: logo à esquerda, navegação no centro e ações à direita. */
@media (min-width: 861px) {
  .header-inner {
    display: grid !important;
    grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
    align-items: center;
    column-gap: 1.5rem;
  }

  .header-inner > .logo {
    justify-self: start;
  }

  .header-inner > .top-nav {
    justify-self: center;
    white-space: nowrap;
  }

  .header-inner > .header-saved-actions {
    justify-self: end;
    margin-left: 0;
  }

  .header-inner > .mobile-menu-btn {
    display: none;
  }
}

@media (min-width: 861px) and (max-width: 1120px) {
  .header-inner {
    grid-template-columns: minmax(145px, 1fr) auto minmax(145px, 1fr);
    column-gap: 0.8rem;
  }

  .header-inner > .top-nav {
    gap: 14px;
  }

  .header-inner > .top-nav a {
    font-size: 0.82rem;
  }
}

@media (max-width: 860px) {
  .header-inner {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.45rem;
    padding-inline: 16px;
  }

  .header-inner > .logo {
    grid-column: 1;
    justify-self: start;
  }

  .header-inner > .top-nav {
    grid-column: 1 / -1;
  }

  .header-inner > .header-saved-actions {
    grid-column: 3;
    justify-self: end;
    margin-left: 0;
  }

  .header-inner > .mobile-menu-btn {
    grid-column: 4;
    justify-self: end;
  }
}

@media (max-width: 520px) {
  .header-inner > .logo > span:last-child {
    display: inline;
    font-size: 0.82rem;
    letter-spacing: -0.045em;
  }

  .header-inner {
    gap: 0.28rem;
    padding-inline: 10px;
  }

  .header-inner > .logo {
    gap: 6px;
  }

  .header-inner > .logo .logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .header-inner > .logo .logo-icon svg {
    width: 22px;
    height: 22px;
  }

  .header-saved-actions {
    gap: 0.16rem;
  }

  .header-saved-btn {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .header-saved-btn svg {
    width: 17px;
    height: 17px;
  }

  .header-inner > .mobile-menu-btn {
    padding: 0.2rem;
    font-size: 1.35rem;
  }
}

/* Header móvel mais confortável em todas as páginas. */
@media (max-width: 860px) {
  body { padding-top: 82px; }
  .header-inner { height: 82px; padding-inline: 14px; }
  .header-inner > .top-nav { top: 82px; }
  .header-inner > .logo { gap: 8px; }
  .header-inner > .logo > span:last-child { font-size: 0.9rem; }
  .header-inner > .logo .logo-icon { width: 40px; height: 40px; border-radius: 12px; }
  .header-inner > .logo .logo-icon svg { width: 24px; height: 24px; }
  .header-saved-btn,
  .auth-account-button { width: 40px; min-width: 40px; min-height: 40px; }
  .header-inner > .mobile-menu-btn { min-width: 38px; min-height: 40px; font-size: 1.5rem; }
}

@media (max-width: 380px) {
  .header-inner { padding-inline: 8px; }
  .header-inner > .logo > span:last-child { font-size: 0.8rem; }
  .header-inner > .logo .logo-icon { width: 37px; height: 37px; }
  .header-saved-btn,
  .auth-account-button { width: 37px; min-width: 37px; min-height: 37px; }
}

/* Vidro premium no drawer e nos avisos de itens salvos. */
.saved-drawer {
  isolation: isolate;
  background:
    radial-gradient(circle at 14% 0%,rgba(45,212,191,.18),transparent 27%),
    radial-gradient(circle at 100% 72%,rgba(37,99,235,.11),transparent 32%),
    rgba(5,13,22,var(--glass-opacity));
  border-color: rgba(255,255,255,var(--glass-border));
  box-shadow: -24px 0 80px rgba(0,0,0,.5),inset 1px 0 rgba(255,255,255,.1);
}

.saved-drawer-backdrop {
  background: rgba(1,5,10,.7);
  -webkit-backdrop-filter: blur(var(--glass-soft-blur));
  backdrop-filter: blur(var(--glass-soft-blur));
}

.saved-item-link,
.saved-storage-note {
  border-color: rgba(255,255,255,var(--glass-border));
  background: linear-gradient(145deg,rgba(255,255,255,.07),rgba(15,23,42,.24));
  box-shadow: inset 0 1px rgba(255,255,255,.05);
}

.saved-articles-toast {
  border: 1px solid rgba(255,255,255,var(--glass-border));
  background: radial-gradient(circle at 0 0,rgba(45,212,191,.2),transparent 42%),rgba(5,14,23,var(--glass-opacity));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  box-shadow: 0 22px 65px rgba(0,0,0,.48),inset 0 1px rgba(255,255,255,.11);
}

html[data-glass-level="0"] .saved-drawer-backdrop,
html[data-glass-level="0"] .saved-articles-toast {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

html[data-glass-level="0"] .saved-drawer,
html[data-glass-level="0"] .saved-articles-toast,
html[data-glass-level="0"] .saved-item-link,
html[data-glass-level="0"] .saved-storage-note {
  background-color: #08111b;
  background-image: none;
}
