/* ═══════════════════════════════════════════════════════════════════
   HABITERA WEB — Web-only chrome (the "Download for Windows" top banner)

   The whole app is offset from the top by the CSS var --titlebar-h (used by
   the topbar, sidebar, content and login wall). desktop.js zeroes it in
   browser-mode; we override it with !important while the banner is present so
   the entire app shifts down by exactly the banner height — no layout surgery
   on the main stylesheet, and the banner never overlaps app chrome.
═══════════════════════════════════════════════════════════════════ */

:root { --web-dl-h: 40px; }

/* When the banner is shown, reclaim its height as the global top offset. */
html.web-has-download-banner { --titlebar-h: var(--web-dl-h) !important; }

#webDownloadBar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--web-dl-h);
  display: none;                 /* shown only in browser-mode (see below) */
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  z-index: 240;                  /* above topbar/sidebar; below modals */
  box-sizing: border-box;
  color: #efeaff;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  background: linear-gradient(90deg, #140a2e 0%, #1b0f3a 50%, #140a2e 100%);
  border-bottom: 1px solid rgba(168, 85, 247, 0.35);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  -webkit-user-select: none; user-select: none;
}

/* Only render the banner in the browser build, never in the Electron app. */
html.browser-mode #webDownloadBar { display: flex; }
html.desktop-mode #webDownloadBar { display: none !important; }

#webDownloadBar .wdl-brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; letter-spacing: .2px; white-space: nowrap;
}
#webDownloadBar .wdl-brand .wdl-logo {
  width: 18px; height: 18px; border-radius: 5px; display: block;
  box-shadow: 0 0 10px rgba(168, 85, 247, .6);
}
#webDownloadBar .wdl-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  opacity: .92;
}
#webDownloadBar .wdl-text b { color: #c9a8ff; font-weight: 700; }
#webDownloadBar #webDownloadVer { opacity: .6; font-weight: 600; margin-left: 4px; }

#webDownloadBar #webDownloadLink {
  display: inline-flex; align-items: center; gap: 7px;
  flex: 0 0 auto;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  box-shadow: 0 3px 14px rgba(168, 85, 247, .55);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
#webDownloadBar #webDownloadLink:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(236, 72, 153, .6);
  filter: brightness(1.06);
}
#webDownloadBar #webDownloadLink svg { width: 14px; height: 14px; display: block; }

#webDownloadBar #webDownloadClose {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; cursor: pointer;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, .55);
  font-size: 18px; line-height: 1;
  transition: background .12s ease, color .12s ease;
}
#webDownloadBar #webDownloadClose:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* Tighten on small screens so the button always fits. */
@media (max-width: 560px) {
  #webDownloadBar .wdl-text { display: none; }
}

/* Phones with a notch/status bar: the banner grows by the safe-area inset so
   its content sits below the clock, and the whole app shifts down with it
   (the --titlebar-h override below keeps topbar/content in sync). */
@media (max-width: 640px) {
  #webDownloadBar {
    height: calc(var(--web-dl-h) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
  }
  html.web-has-download-banner {
    --titlebar-h: calc(var(--web-dl-h) + env(safe-area-inset-top, 0px)) !important;
  }
  /* The topbar's own safe-area padding is not needed when the banner already
     absorbs the inset above it. */
  html.web-has-download-banner .tp {
    padding-top: 0;
    height: 54px;
  }
  /* …and the content offset must not count the inset twice (it is already
     inside --titlebar-h while the banner is up). */
  html.web-has-download-banner .content {
    padding-top: calc(var(--titlebar-h, 0px) + 66px);
  }
}
