/* GreenChat update notice — compact, quiet and shared by PWA/native optional updates.
   Loaded as a same-origin static stylesheet so the production CSP stays free of inline styles. */

.gc-pwa-update.gc-update-notice {
  width: min(calc(100vw - 24px), 430px);
  max-width: none;
  bottom: calc(12px + var(--gc-safe-bottom));
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 36px;
  align-items: center;
  gap: 10px;
  padding: 9px 9px 9px 10px;
  overflow: hidden;
  border: 1px solid var(--gc-border);
  border-radius: 18px;
  background: var(--gc-bg-elevated);
  background: linear-gradient(110deg, color-mix(in srgb, var(--gc-accent) 7%, var(--gc-bg-elevated)), var(--gc-bg-elevated) 48%);
  box-shadow: 0 12px 36px rgba(10, 35, 24, 0.14), 0 2px 8px rgba(10, 35, 24, 0.08);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  animation: gc-update-notice-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  isolation: isolate;
}

/* Native optional updates carry one extra action ("What's new") compared with the PWA notice.
   Give every control an explicit cell so the dismiss button cannot auto-flow onto a second row. */
.gc-pwa-update.gc-update-notice.gc-update-banner {
  grid-template-columns: 36px minmax(0, 1fr) auto auto 36px;
}

.gc-pwa-update.gc-update-notice::before {
  content: "↻";
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--gc-accent-strong);
  background: var(--gc-hover);
  background: color-mix(in srgb, var(--gc-accent) 12%, var(--gc-bg-elevated));
  font-size: 20px;
  font-weight: 650;
  line-height: 1;
}

.gc-pwa-update.gc-update-notice .gc-pwa-update-text {
  min-width: 0;
  overflow: hidden;
  color: var(--gc-fg);
  font-size: var(--gc-fs-13);
  font-weight: 620;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gc-pwa-update.gc-update-notice .gc-btn-accent {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 11px;
  box-shadow: none;
  font-size: var(--gc-fs-13);
  font-weight: 650;
  white-space: nowrap;
}

.gc-pwa-update.gc-update-notice .gc-update-notice-dismiss {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--gc-fg-muted);
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.gc-pwa-update.gc-update-notice .gc-update-notice-dismiss::before,
.gc-pwa-update.gc-update-notice .gc-update-notice-dismiss::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 1.6px;
  border-radius: 999px;
  background: currentColor;
}

.gc-pwa-update.gc-update-notice .gc-update-notice-dismiss::before {
  transform: rotate(45deg);
}

.gc-pwa-update.gc-update-notice .gc-update-notice-dismiss::after {
  transform: rotate(-45deg);
}

.gc-pwa-update.gc-update-notice .gc-update-notice-dismiss:hover {
  background: var(--gc-hover);
  color: var(--gc-fg);
}

.gc-pwa-update.gc-update-notice .gc-update-notice-dismiss:active {
  transform: scale(0.94);
}

.gc-pwa-update.gc-update-notice .gc-update-notice-dismiss:focus-visible {
  outline: 2px solid var(--gc-accent);
  outline-offset: 2px;
}

[data-theme="dark"] .gc-pwa-update.gc-update-notice {
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.34), 0 2px 10px rgba(0, 0, 0, 0.22);
}

@keyframes gc-update-notice-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@media (max-width: 359px) {
  .gc-pwa-update.gc-update-notice {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 8px;
    padding: 8px;
  }

  .gc-pwa-update.gc-update-notice::before,
  .gc-pwa-update.gc-update-notice .gc-update-notice-dismiss {
    width: 34px;
    height: 34px;
  }

  .gc-pwa-update.gc-update-notice .gc-btn-accent {
    grid-column: 2 / 4;
    justify-self: start;
  }

  .gc-pwa-update.gc-update-notice .gc-update-notice-dismiss {
    grid-column: 3;
    grid-row: 1;
  }

  .gc-pwa-update.gc-update-notice.gc-update-banner {
    grid-template-columns: 34px minmax(0, 1fr) auto 34px;
  }

  .gc-pwa-update.gc-update-notice.gc-update-banner::before {
    grid-column: 1;
    grid-row: 1;
  }

  .gc-pwa-update.gc-update-notice.gc-update-banner .gc-pwa-update-text {
    grid-column: 2 / 4;
    grid-row: 1;
  }

  .gc-pwa-update.gc-update-notice.gc-update-banner .gc-update-showcase-open {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }

  .gc-pwa-update.gc-update-notice.gc-update-banner .gc-btn-accent {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
  }

  .gc-pwa-update.gc-update-notice.gc-update-banner .gc-update-notice-dismiss {
    grid-column: 4;
    grid-row: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gc-pwa-update.gc-update-notice {
    animation: none;
  }

  .gc-pwa-update.gc-update-notice .gc-update-notice-dismiss {
    transition: none;
  }
}

/* Expanded update sheet: the compact notice becomes the full update surface instead of spawning a
   second unrelated modal. The origin rectangle is captured by update_banner_impl.ts, so the reveal
   visually grows from the exact update control the person touched. */
.gc-pwa-update.gc-update-notice .gc-pwa-update-text[role="button"] { cursor: pointer; }
.gc-update-notice-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gc-update-notice-notes {
  grid-column: 1 / -1;
  min-width: 0;
  max-width: 680px;
  color: var(--gc-fg-muted);
  text-align: left;
}
.gc-update-notice-notes-label {
  display: block;
  margin-bottom: 8px;
  color: var(--gc-fg);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.gc-update-notice-notes p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}
.gc-pwa-update.gc-update-notice.is-expanded {
  inset: 0;
  left: 0;
  bottom: 0;
  z-index: 10045;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  grid-template-columns: minmax(0, 720px);
  grid-template-rows: auto auto auto auto;
  justify-content: center;
  align-content: center;
  gap: 20px;
  padding: max(42px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(42px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  transform: none;
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--gc-accent) 18%, transparent), transparent 34%),
    linear-gradient(145deg, color-mix(in srgb, var(--gc-accent) 7%, var(--gc-bg-elevated)), var(--gc-bg-elevated) 58%);
  box-shadow: none;
  animation: gc-update-notice-expand 420ms cubic-bezier(.18,.82,.22,1) both;
}
.gc-pwa-update.gc-update-notice.is-expanded::before {
  grid-column: 1;
  justify-self: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  font-size: 38px;
}
.gc-pwa-update.gc-update-notice.is-expanded .gc-pwa-update-text {
  grid-column: 1;
  justify-self: stretch;
  text-align: center;
  overflow: visible;
  font-size: clamp(24px, 5vw, 42px);
  line-height: 1.1;
}
.gc-pwa-update.gc-update-notice.is-expanded .gc-update-notice-title {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  text-wrap: balance;
}
.gc-pwa-update.gc-update-notice.is-expanded .gc-update-notice-notes {
  grid-column: 1;
  justify-self: stretch;
  max-height: min(34vh, 320px);
  overflow: auto;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--gc-accent) 18%, var(--gc-border));
  border-radius: 18px;
  background: color-mix(in srgb, var(--gc-bg-elevated) 88%, transparent);
}
.gc-pwa-update.gc-update-notice.is-expanded .gc-update-banner-btn {
  grid-column: 1;
  justify-self: center;
  min-width: min(320px, 100%);
  min-height: 50px;
  border-radius: 16px;
  font-size: 15px;
}
.gc-pwa-update.gc-update-notice.is-expanded .gc-update-notice-dismiss {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 1;
}
@keyframes gc-update-notice-expand {
  from {
    opacity: .82;
    clip-path: inset(
      var(--gc-update-from-top, 85vh)
      calc(100vw - var(--gc-update-from-left, 50vw) - var(--gc-update-from-width, 430px))
      calc(100vh - var(--gc-update-from-top, 85vh) - var(--gc-update-from-height, 60px))
      var(--gc-update-from-left, 50vw)
      round 18px
    );
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0 round 0);
  }
}
@media (max-width: 560px) {
  .gc-pwa-update.gc-update-notice.is-expanded {
    gap: 18px;
    padding-inline: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .gc-pwa-update.gc-update-notice.is-expanded { animation: none; }
}
