:root {
  --sign-primary: #1e293b;
  --sign-banner-bg: rgba(30, 41, 59, 0.9);
  --sign-text: #ffffff;
  --sign-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --sign-free: rgba(5, 150, 105, 0.9);
  --sign-busy: rgba(30, 41, 59, 0.9);
  --sign-warning: rgba(217, 119, 6, 0.9);
  --sign-urgent: rgba(220, 38, 38, 0.9);
  --sign-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--sign-font);
  height: 100vh;
  overflow: hidden;
  color: var(--sign-text);
}

/* iOS PWA standalone (Add to Home Screen) overlays the status bar / home
   indicator on top of the page. Safe-area padding lives on each display
   page wrapper (not body) because iOS Safari can fail to compute child
   height: 100% reliably when its parent uses padding + 100vh. With the
   padding on the wrapper itself (border-box), height stays at 100vh and
   the inner flex layout - including the scrolling main element - works
   the same on iPad PWA as on desktop. env() resolves to 0 on platforms
   without insets, so desktop layout is unchanged. */

/* Setup, login, config pages need to scroll when content is taller than the viewport.
   Display pages (in-room/door/lobby) keep the locked-down `overflow: hidden` from above. */
body.signage-root.app-page,
body.signage-root.config-page {
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
}

.signage-root.app-page {
  background-color: #f0f2f5;
  color: #333;
}

.signage-bootstrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f0f2f5;
  color: #333;
}

.bootstrap-message {
  font-size: 1.1rem;
  opacity: 0.7;
}

.app-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  min-height: 100vh;
}

.app-content {
  text-align: center;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: var(--sign-shadow);
  width: 100%;
  max-width: 500px;
}

.app-header {
  color: #333;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.dropdown {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  background-color: white;
  margin-bottom: 1rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 0.85rem;
}

.dropdown:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button {
  padding: 0.75rem 1.25rem;
  background-color: var(--sign-primary);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.button:hover { filter: brightness(1.1); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: 0.4; cursor: not-allowed; }

.input-box {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

@media (min-width: 768px) {
  .app-header { font-size: 1.875rem; }
  .dropdown,
  .button { font-size: 1.1rem; }
}

/* Hidden-in-plain-sight link to the setup page, used to wrap unobtrusive elements
   (the clock, the logo) on each display. Mirrors the legacy "tap the logo" pattern -
   no visual difference from the wrapped element, but tappable by staff who know. */
.signage-hidden-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}
.signage-hidden-link:hover,
.signage-hidden-link:focus { color: inherit; text-decoration: none; }

/* Staleness indicator: small ambient bullet shown next to the clock on each
   display when the meeting-data cache is older than 2x the fetch interval.
   Mirrors the legacy /signs/ bullet - tiny enough that occupants won't notice
   but operators glancing past can spot a stuck kiosk. Empty when fresh. */
.staleness-indicator {
  display: inline-block;
  font-size: 0.85em;
  opacity: 0.4;
  margin-right: 0.4rem;
  min-width: 0.8em;
  color: currentColor;
  line-height: 1;
}
.staleness-indicator:empty {
  margin-right: 0;
}

/* Admin pages (config): slim branded bar at the top.
   Ordinate logo on the left, optional tenant logo on the right (loaded from
   event-level Signage.Branding.LogoURL via admin-header.js). */
.signage-app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}
.signage-app-bar-logo {
  height: 36px;
  width: auto;
  display: block;
}
.signage-app-bar-tenant {
  display: flex;
  align-items: center;
  height: 36px;
}
.signage-app-bar-tenant img {
  max-height: 36px;
  width: auto;
  display: block;
}

/* Login + setup pages: branded card centred on a soft background. */
.signage-brand-page {
  background:
    radial-gradient(ellipse at top, rgba(143, 188, 78, 0.15), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(30, 41, 59, 0.08), transparent 60%),
    #f3f4f6;
}
.signage-brand-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  min-height: 100vh;
}
.signage-brand-card {
  background-color: #ffffff;
  border-radius: 14px;
  box-shadow: 0 30px 60px -20px rgba(15, 23, 42, 0.3);
  width: 100%;
  max-width: 540px;
  padding: 3rem 2.5rem 2.5rem;
  text-align: center;
}
.signage-brand-card-logos {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.signage-brand-card-mainlogo {
  height: 60px;
  width: auto;
  display: block;
}
.signage-brand-card-tenant {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #6b7280;
  font-size: 0.95rem;
  min-height: 0;
}
.signage-brand-card-tenant:not(:empty)::before {
  content: 'Powering';
  color: #9ca3af;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.signage-brand-card-tenant img {
  max-height: 80px;
  max-width: 320px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.signage-brand-card-product {
  color: #6b7280;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}
.signage-brand-card-greeting {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.5rem;
}
.signage-brand-card-subtitle {
  color: #6b7280;
  font-size: 0.95rem;
  margin: 0 0 1.75rem;
  line-height: 1.4;
}

/* ---- iOS 12 fallbacks (no flex gap) --------------------------------------
   Safari < 14.1 ignores gap on flex containers (grid gap works fine).
   js/shared/flexgap.js adds .no-flexgap to <html> when flex gap isn't
   honoured; these rules replicate each flex gap above with margins.
   Delete this block when the legacy iPad kiosks retire. */
.no-flexgap .signage-app-bar > * + * { margin-left: 1rem; }
.no-flexgap .signage-brand-card-logos > * + * { margin-top: 1rem; }
.no-flexgap .signage-brand-card-tenant > * + * { margin-left: 0.6rem; }
/* The 'Powering' ::before is a flex item too, but * + * can't reach
   pseudo-elements - space it off the following logo directly. */
.no-flexgap .signage-brand-card-tenant:not(:empty)::before { margin-right: 0.6rem; }
