/* ============================================
   FGS · Rede Agrometeorolóxica · Compoñentes compartidos
   Topbar, footer e controis comúns ás 3 páxinas (index, estación, proxecto).
   Require tokens.css cargado antes e data-theme="dark" no <html>.
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--gs-font-corpo);
  background: var(--gs-bg);
  color: var(--gs-texto);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── TOPBAR ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--gs-bg-topbar) 97%, transparent);
  border-bottom: 1px solid var(--gs-borde);
  backdrop-filter: blur(10px);
  padding: .85rem clamp(1rem, 4vw, 1.75rem);
  display: flex; align-items: center; gap: 1.1rem;
}
.topbar-brand { display: flex; align-items: center; flex-shrink: 0; }
.topbar-logo { height: 40px; width: auto; display: block; }
.topbar-sep  { width: 1px; height: 26px; background: var(--gs-texto-12); flex-shrink: 0; }
.topbar-sub  { font-family: var(--gs-font-titulos); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--gs-texto-40); }
.topbar-nav  { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }
.topbar-nav a { font-family: var(--gs-font-titulos); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--gs-texto-40); text-decoration: none; transition: color var(--gs-transicion-rapida); }
.topbar-nav a:hover, .topbar-nav a.active { color: var(--gs-acento); }
.topbar-nav a.ext { color: color-mix(in srgb, var(--gs-acento) 55%, transparent); }
.topbar-right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }

@media (max-width: 760px) {
  .topbar-nav { display: none; }
}

@media (max-width: 560px) {
  .topbar:has(.topbar-right) { flex-wrap: wrap; row-gap: .5rem; padding-block: .6rem; }
  .topbar:has(.topbar-right) .topbar-sub { display: none; }
  .topbar-right { width: 100%; justify-content: flex-end; }
  .sel-estacion { max-width: 40vw; }
  .status-txt { display: none; }
}

/* ── Controis de estación (selector / estado / actualizar) ── */
.status-pill { display: flex; align-items: center; gap: .3rem; font-size: .62rem; color: var(--gs-texto-40); }
.status-dot  { width: 6px; height: 6px; border-radius: 50%; background: var(--gs-acento); animation: gs-pulse 2.5s infinite; }
.status-dot.err { background: var(--gs-erro-d); animation: none; }
@keyframes gs-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.btn-sm {
  font-family: var(--gs-font-corpo); font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: .32em .85em; border-radius: 5px; border: 1px solid var(--gs-texto-12);
  background: color-mix(in srgb, var(--gs-texto) 7%, transparent); color: var(--gs-texto-60);
  cursor: pointer; text-decoration: none; transition: background var(--gs-transicion-rapida); white-space: nowrap;
}
.btn-sm:hover { background: color-mix(in srgb, var(--gs-texto) 13%, transparent); }
.btn-sm-ico { display: none; }
@media (max-width: 560px) {
  .btn-sm { padding: .4em .55em; }
  .btn-sm-txt { display: none; }
  .btn-sm-ico { display: inline; font-size: .9rem; }
}

.sel-estacion {
  font-family: var(--gs-font-corpo); font-size: .66rem; font-weight: 700; color: var(--gs-texto);
  background-color: var(--gs-bg-elevated); border: 1px solid var(--gs-texto-12); border-radius: 5px;
  padding: .34em 1.7em .34em .7em; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 3.5L5 6.5L8 3.5' stroke='%236B8F47' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right .55em center;
  transition: border-color var(--gs-transicion-rapida);
}
.sel-estacion:hover, .sel-estacion:focus { border-color: var(--gs-acento-forte); outline: none; }

/* ── FOOTER ── */
.footer {
  border-top: 1px solid var(--gs-texto-12);
  padding: 1.1rem clamp(1rem, 4vw, 1.75rem);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}
.footer-l { font-size: .62rem; color: var(--gs-texto-28); }
.footer-l a { color: var(--gs-acento); text-decoration: none; }
.footer-l a:hover { color: var(--gs-acento-forte); }

@media (max-width: 760px) {
  .footer { flex-direction: column; text-align: center; }
}
