@import url("../components/button.css");

#reports-panel {
  top: 0;
  right: 0;
  translate: calc(clamp(300px, 28svw, 600px) + 24px);
  height: calc(100svh - 24px);
  width: clamp(300px, 28svw, 600px);
  margin: 8px;
  padding: 4px;
  border-radius: 8px;
  background-color: var(--md-surface);
  box-shadow: 0 10px 20px rgb(0 0 0 / 19%), 0 6px 6px rgb(0 0 0 / 23%);
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
  isolation: isolate;
  transform-origin: top right;
  transition-property: height, translate, scale, opacity;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

#reports-panel.docked {
  height: 202px;
  translate: 0;
  opacity: 1;
  scale: .8;
  transition-property: height, translate, scale, opacity;
}

#reports-panel.docked:not(.show) #reports-list-view > .scroll-wrapper {
  overflow: hidden;
}

#reports-panel.show {
  height: calc(100svh - 24px);
  translate: 0;
  scale: 1;
  transition-property: height, translate, scale, opacity;
  transition-duration: 400ms, 400ms, 400ms, 200ms;
  transition-timing-function: cubic-bezier(0.05, 0.7, 0.1, 1);
}

body.has-eew #reports-panel.docked:not(.show) {
  opacity: 0;
  pointer-events: none;
}

#reports-list {
  display: grid;
  padding-right: 4px;
  border-radius: 8px;
  color: var(--md-on-surface);
  font-size: 16px;
  line-height: 16px;
  transition: color .2s;
}

.report-item {
  position: relative;
  border-radius: 8px;
  margin-bottom: 4px;
  isolation: isolate;
}

.report-item::after {
  content: "";
  position: absolute;
  bottom: -4px;
  height: 4px;
  width: 100%;
}

#reports-panel::before,
.report-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  transition: opacity .1s, background-color .2s;
}

#reports-panel::before {
  opacity: .08;
  background-color: var(--md-primary);
}

.report-item::before {
  opacity: .8;
  background-color: var(--md-secondary-container);
}

.report-item,
.report-cross g {
  transition: opacity .1s;
}

.report-item:last-child {
  margin-bottom: 4px;
}

.report-item.hightligh,
.report-item:hover {
  opacity: 1;
}

.report-item:first-child {
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  grid-template-rows: 32px 18px 24px;
  align-items: center;
  padding: 4px;
}

.report-item:not(:first-child) {
  display: grid;
  grid-template-columns: 56px auto min-content;
  grid-template-rows: repeat(2, 24px);
  align-items: center;
  padding: 4px;
}

#reports-panel.docked:not(.show) .report-item {
  display: none;
}

#reports-panel.docked:not(.show) .report-item:first-child,
#reports-panel.docked:not(.show) .report-item:nth-child(2),
#reports-panel.docked:not(.show) .report-item:nth-child(3) {
  display: grid;
}

#reports-panel.docked:not(.show) .report-item:not(:first-child) {
  opacity: 0.6;
}

#reports-list:has(> .report-item.hightlight) > .report-item:not(.hightlight),
#reports-list:has(> .report-item:hover) > .report-item:not(:hover) {
  opacity: .4;
}

.report-cross {
  padding: 1px;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
  transition-property: opacity;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.report-cross:hover g,
.report-cross.hightlight g {
  opacity: 1 !important;
} 

.maplibregl-canvas-container:has(>.report-cross:hover) > .report-cross:not(:hover) g,
.maplibregl-canvas-container:has(>.report-cross.hightlight) > .report-cross:not(.hightlight) g {
  opacity: .1 !important;
} 

.report-cross:hover,
.report-cross.hightlight {
  z-index: 100 !important;
}

.overlay-container:has(>#reports-panel.show) + .map-container .report-cross {
  opacity: 1;
  pointer-events: all;
}

.overlay-container:has(>#reports-panel.show) + .map-container .report-cross.hide {
  opacity: 0;
  pointer-events: none;
}

.overlay-container:has(>#reports-panel.show) + .map-container:has(.hide) .report-cross:not(.hide) {
  height: 26.6px !important;
  width: 26.6px !important;
  z-index: 100 !important;
  filter: drop-shadow(0 0 4px #f006);
}

.overlay-container:has(>#reports-panel.show) + .map-container:has(.hide) .report-cross:not(.hide) g {
  scale: 0.35 !important;
  opacity: 1 !important;
}

.overlay-container:has(>#reports-panel.show) + .map-container:has(.hide) .report-cross:not(.hide) .cross-inner {
  fill: #f00 !important;
  filter: drop-shadow(0 0 6px #f00a);
}

.overlay-container:has(>#reports-panel.show) + .map-container:has(.hide) .report-cross:not(.hide) .cross-outer {
  fill: var(--md-on-surface) !important;
}

.report-color {
  position: relative;
  border: 3px solid #000;
  border-radius: 8px;
}

.report-title {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  overflow: hidden;
  min-width: 0;
}

.report-subtitle {
  opacity: .6;
  font-weight: 400;
  font-size: 12px;
  margin-left: 4px;
}

.report-time {
  color: var(--md-on-surface-variant);
  font-size: 14px;
}

.report-magnitude,
.report-depth {
  font-size: 18px;
  line-height: 18px;
}

.report-magnitude::before {
  content: "M";
  margin-right: 4px;
  color: var(--md-outline);
  font-size: 16px;
  line-height: 16px;
}

.report-depth::after {
  content: "㎞";
  margin-left: 4px;
  color: var(--md-outline);
  font-size: 16px;
  line-height: 16px;
}

.report-item:first-child > .report-color {
  grid-area: 1 / 1 / 4 / 2;
  height: 66px;
  width: 66px;
}

.report-item:first-child > .report-title {
  grid-area: 1 / 2 / 2 / 4;
  font-size: 20px;
  line-height: 20px;
}

.report-item:first-child > .report-title > .report-subtitle {
  font-size: 14px;
  line-height: 14px;
}

.report-item:first-child > .report-time {
  grid-area: 2 / 2 / 3 / 4;
}

.report-item:first-child > .report-magnitude {
  grid-area: 3 / 2 / 4 / 3;
}

.report-item:first-child > .report-depth {
  grid-area: 3 / 3 / 4 / 4;
}

.report-item:not(:first-child) > .report-color {
  grid-area: 1 / 1 / 3 / 2;
  height: 42px;
  width: 42px;
}

.report-item:not(:first-child) > .report-title {
  grid-area: 1 / 2 / 2 / 3;
  font-size: 16px;
  line-height: 16px;
}

.report-item:not(:first-child) > .report-time {
  grid-area: 2 / 2 / 3 / 3;
}

.report-item:not(:first-child) > .report-magnitude {
  grid-area: 1 / 3 / 3 / 4;
  text-align: right;
  margin-right: 4px;
}

.report-item:not(:first-child) > .report-depth {
  display: none;
}

.report-color::before,
.report-color::after {
  left: 50%;
  translate: -50%;
  color: var(--md-on-surface);
  font-weight: 700;
  font-size: 24px;
  text-shadow: 0 0 36px var(--md-on-surface);
  line-height: 42px;
}

.report-color.has-number {
  background-color: var(--md-secondary-container);
}

.report-color.has-number::before,
.report-color.has-number::after {
  color: #000;
  text-shadow: 0 0 16px #0004;
}

.report-color::after {
  padding-left: 18px;
  font-size: 16px;
  line-height: 34px;
}

.report-item:first-child > .report-color::before {
  font-size: 36px;
  line-height: 66px;
}

.report-item:first-child > .report-color::after {
  padding-left: 24px;
  font-size: 28px;
  line-height: 52px;
}

.int-unknown::before {
  content: "?";
  position: absolute;
}

.int-0::before {
  content: "0";
  position: absolute;
}

.int-1::before {
  content: "1";
  position: absolute;
}

.int-2::before {
  content: "2";
  position: absolute;
}

.int-3::before {
  content: "3";
  position: absolute;
}

.int-4::before {
  content: "4";
  position: absolute;
}

.int-5::before,
.int-6::before {
  content: "5";
  position: absolute;
  padding-right: 2px;
}

.int-7::before,
.int-8::before {
  content: "6";
  position: absolute;
  padding-right: 2px;
}

.report-item:first-child > .int-5::before,
.report-item:first-child > .int-6::before,
.report-item:first-child > .int-7::before,
.report-item:first-child > .int-8::before {
  padding-right: 8px;
}

.int-9::before {
  content: "7";
  position: absolute;
}

.int-5::after,
.int-7::after {
  content: "−";
  position: absolute;
}

.int-6::after,
.int-8::after {
  content: "+";
  position: absolute;
}

.report-detail-header-container {
  display: flex;
  flex-direction: column;
  margin: 0 12px;
}

#report-detail-subtitle {
  color: var(--md-secondary);
  font-size: 18px;
}

#report-detail-title {
  color: var(--md-primary);
  font-weight: 600;
  font-size: 32px;
  line-height: 42px;
  white-space: normal;
}

#report-detail-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-detail-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 4px;
  margin: 0 12px;
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field > .icon {
  height: 28px;
  width: 28px;
  margin-top: -4px;
  color: var(--md-on-surface-variant);
  font-size: 28px;
}

.field > .field-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.report-detail-stations-header,
.field-unit,
.field-name {
  color: var(--md-on-surface-variant);
  font-weight: 300;
  font-size: 13px;
}

.field-unit {
  margin: 0 4px;
}

.unit-degree::before {
  content:"°"
}

.field-value {
  color: var(--md-on-surface);
  font-size: 16px;
  line-height: 16px;
}

.report-detail-stations {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 12px;
  margin-top: 0;
  min-height: 0;
}

.report-detail-stations:has(#report-station-list:empty) {
  display: none;
}

.report-detail-station-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-station {
  display: flex;
  gap: 8px;
  padding-right: 8px;
}

.report-station::before {
  content: "";
  display: inline-block;
  width: 4px;
  border-radius: 4px;
}

.report-station.intensity-0::before {
  background-color: var(--md-surface-variant);
}

.report-station.intensity-1::before {
  background-color: #757575;
}

.report-station.intensity-2::before {
  background-color: #2774C2;
}

.report-station.intensity-3::before {
  background-color: #7BA822;
}

.report-station.intensity-4::before {
  background-color: #E8D630;
}

.report-station.intensity-5::before {
  background-color: #E68439;
}

.report-station.intensity-6::before {
  background-color: #DB641F;
}

.report-station.intensity-7::before {
  background-color: #DB1F1F;
}

.report-station.intensity-8::before {
  background-color: #AE1919;
}

.report-station.intensity-9::before {
  background-color: #862DB3;
}

.report-station-name {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}

.report-station-distance {
  color: var(--md-outline);
  font-size: 12px;
}

.report-wave-time circle {
  stroke: var(--md-outline);
  filter: drop-shadow(0 0 2px rgb(0 0 0 / 40%));
}

.report-wave-time text {
  font-family: Lato, "Noto Sans TC", sans-serif;
  font-size: 14px;
  fill: var(--md-on-surface-variant);
  stroke: var(--md-surface);
  stroke-width: 3px;
  paint-order: stroke;
}

