:root {
  --panel-bg: #e0f0ff;
  --panel-border: #b5cfe8;
  --accent: #007acc;
  --accent-soft: #e3f3ff;
  --accent-strong: #005a99;
  --text-main: #222;
  --text-muted: #555;
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.1);
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background: #ffffff;
  height: 100vh;
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "left   map";
  height: 100vh;
}

.app__header {
  grid-area: header;
  padding: 10px 16px;
  border-bottom: 1px solid #dfe7f3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f7fbff;
}

.app__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #143d68;
}

.app__subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.toggle-btn {
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid var(--accent);
  padding: 6px 14px;
  font-size: 0.9rem;
  background: #ffffff;
  color: #007acc;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-soft);
}

.toggle-btn--active {
  background: var(--accent);
  color: #ffffff;
}

.toggle-btn span.icon {
  font-size: 0.95rem;
}

.left-panel {
  grid-area: left;
  background: var(--panel-bg);
  border-right: 1px solid var(--panel-border);
  padding: 12px 10px;
  overflow-y: auto;
}

.left-panel__section {
  margin-bottom: 16px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.section__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #123454;
}

.section__subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.checkbox-group,
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.control-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 0.12s ease;
}

.control-label:hover {
  background: rgba(255, 255, 255, 0.9);
}

.control-label input {
  accent-color: var(--accent);
}

.threshold-label {
  padding: 4px 6px;
}

.threshold-label input {
  margin-right: 4px;
}

/* update map button section */
.left-panel__section--actions {
  text-align: center;
}

.update-btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background 0.15s ease, transform 0.05s ease;
}

.update-btn:hover {
  background: var(--accent-strong);
}

.update-btn:active {
  transform: scale(0.98);
}

.update-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.map-container {
  grid-area: map;
  position: relative;
  overflow: hidden;
}

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

/* Vulnerability panel (right side) */
.vuln-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 260px;
  max-height: calc(100% - 20px);
  background: var(--panel-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.vuln-panel--open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.vuln-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #c7e0ff;
  border-bottom: 1px solid var(--panel-border);
}

.vuln-panel__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #123454;
}

.vuln-panel__close {
  border: none;
  background: #ffffff;
  border-radius: 999px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.vuln-panel__body {
  padding: 8px 10px 10px;
  overflow-y: auto;
  font-size: 0.9rem;
}

.vuln-panel__subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.vuln-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vuln-item {
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.vuln-item:hover {
  background: var(--accent-soft);
}

.vuln-item__label {
  font-size: 0.9rem;
  color: #1b3550;
}

.vuln-item__radio {
  accent-color: var(--accent);
  margin-left: 6px;
}

.vuln-item--active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.vuln-item--active .vuln-item__label {
  color: #ffffff;
  font-weight: 600;
}

.vuln-item--active .vuln-item__radio {
  filter: brightness(1.2);
}

/* Small screens */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "header"
      "left"
      "map";
  }

  .left-panel {
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
  }
}
