/* Tokens mirror the Thundera app's palettes and size tokens. */

:root {
  --white: #ffffff;
  --gray-5: #d9d9d9;
  --gray-6: #bfbfbf;
  --gray-7: #8c8c8c;
  --gray-10: #262626;
  --primary-10: #001d66;
  --secondary-4: #ffc069;
  --green-8: #237804;

  --surface: var(--white);
  --text: var(--gray-10);
  --text-secondary: var(--gray-7);
  --text-title: var(--primary-10);
  --panel-frame: rgba(67, 67, 67, 0.5);
  --page-bg: #f5f5f5;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.12);

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;

  --panel-width: 382px;
  --panel-padding: 16px;
  --radius-frame: 12px;
  --radius-card: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1f1f1f;
    --text: #f0f0f0;
    --text-secondary: var(--gray-6);
    --text-title: #91caff;
    --panel-frame: rgba(20, 20, 20, 0.6);
    --page-bg: #141414;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family:
    Nunito,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  color: var(--text);
  background: var(--page-bg);
}

p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.map {
  width: 100%;
  height: 100%;
}

.panel {
  position: absolute;
  top: var(--s-4);
  left: var(--s-4);
  z-index: 1;

  display: flex;
  flex-direction: column;
  gap: var(--s-3);

  width: calc(var(--panel-width) + var(--panel-padding) * 2);
  max-height: calc(100% - var(--s-4) * 2);
  padding: var(--panel-padding);

  background: var(--panel-frame);
  border-radius: var(--radius-frame);
  overflow-y: auto;
}

.card {
  flex-shrink: 0;
  padding: var(--s-3);
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.panel-title {
  margin: 0 0 var(--s-2);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-title);
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}

.info-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.info-text {
  font-size: 0.875rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.shipment {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
}

/* Colour is set from JS. */
.shipment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  width: 22px;
  height: 22px;
  padding: var(--s-1);
  border-radius: var(--s-1);

  color: var(--white);
  background: var(--secondary-4);
}

.shipment-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.shipment-name {
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.shipment-status {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--secondary-4);
}

.shipment-address,
.shipment-phone {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.shipment-phone {
  display: flex;
  align-items: center;
  gap: var(--s-1);
}

.shipment-phone-icon {
  display: inline-flex;
  flex-shrink: 0;
}

.disclaimer {
  padding: var(--s-2) var(--s-3);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-secondary);
  text-align: center;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);

  background: var(--page-bg);
}

.overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-4);

  max-width: 420px;
  padding: var(--s-4);

  text-align: center;
}

.overlay-message {
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--text);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-5);
  border-top-color: var(--text-title);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

.brand {
  position: absolute;
  right: var(--s-4);
  bottom: var(--s-4);
  z-index: 1;

  padding: var(--s-1) var(--s-3);
  border-radius: var(--radius-card);

  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand a {
  font-weight: 700;
  color: var(--text-title);
  text-decoration: none;
}

.brand a:hover,
.brand a:focus-visible {
  text-decoration: underline;
}

/* Bottom sheet on a phone, so the map stays the hero. */
@media (max-width: 640px) {
  .panel {
    top: auto;
    right: var(--s-2);
    bottom: var(--s-2);
    left: var(--s-2);
    width: auto;
    max-height: 60%;
    padding: var(--s-2);
  }

  .panel-title {
    font-size: 1.125rem;
  }

  .brand {
    top: var(--s-2);
    right: var(--s-2);
    bottom: auto;
  }
}
