/* Tracker Online PWA Styles */

:root {
  --pwa-primary: #0066cc;
  --pwa-primary-hover: #0052a3;
  --pwa-bg: #f8f9fa;
  --pwa-text: #212529;
}

html.pwa-standalone {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* PWA App Bar */
.pwa-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-bottom: 1px solid #e0e4e8;
  padding: 8px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pwa-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  color: #1a202c;
  text-decoration: none;
}

.pwa-header-brand img {
  height: 28px;
  width: auto;
  margin: 0;
  vertical-align: middle;
}

.pwa-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Install Button */
.pwa-btn-install {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--pwa-primary);
  color: #ffffff !important;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

.pwa-btn-install:hover {
  background: var(--pwa-primary-hover);
  box-shadow: 0 3px 6px rgba(0, 102, 204, 0.3);
  text-decoration: none;
}

.pwa-btn-install svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Status Badges */
.pwa-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.pwa-badge::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.pwa-badge-online {
  background: #e6f7ec;
  color: #0d6832;
}

.pwa-badge-online::before {
  background: #10b981;
}

.pwa-badge-offline {
  background: #fef3c7;
  color: #92400e;
}

.pwa-badge-offline::before {
  background: #f59e0b;
  animation: pwa-pulse 1.8s infinite ease-in-out;
}

@keyframes pwa-pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* PWA Toasts */
.pwa-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483647;
  padding: 12px 20px;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 14px;
  animation: pwa-fadein 0.3s ease;
}

.pwa-toast-info {
  background: #1f2937;
  color: #ffffff;
}

.pwa-toast-update {
  background: #0066cc;
  color: #ffffff;
}

.pwa-toast-update button {
  background: #ffffff;
  color: #0066cc;
  border: none;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.pwa-toast-update button:hover {
  background: #f0f0f0;
}

.pwa-toast-fadeout {
  opacity: 0;
  transition: opacity 0.4s ease;
}

@keyframes pwa-fadein {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

body.pwa-standalone #header {
  padding-top: 4px;
}

/* Keep installation controls usable on narrow screens and safe-area devices. */
.pwa-header-bar { gap: 8px; flex-wrap: wrap; }
.pwa-header-brand, .pwa-header-actions { min-width: 0; }
.pwa-toast { box-sizing: border-box; max-width: calc(100vw - 24px); flex-wrap: wrap; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.pwa-toast button { cursor: pointer; padding: 6px 10px; }
@media (max-width: 420px) { .pwa-header-bar { padding: 6px 8px; } .pwa-header-brand { font-size: 14px; gap: 6px; } .pwa-header-actions { gap: 6px; } }

/* Launch guidance lives below Tracker alongside the existing page text. */
#pagetext h2 { font: 600 1.25rem/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
#pagetext details > summary { cursor: pointer; font-weight: 600; margin: 1em 0; }
#pagetext [hidden] { display: none !important; }

/* Make the SwingJS slider thumb easy to see against the track. */
.swingjs .ui-j2sslider-horizontal[id*="_SliderUI_"] > .ui-j2sslider-handle {
  background: #0066cc;
  border-color: #004a99;
}
