:root {
  --primary-color: #55b4fa;
  --bg-color: #0f172a;
  --header-bg: rgba(30, 41, 59, 0.7);
  --text-color: #f1f5f9;
  --accent-color: #38bdf8;
  --card-bg: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.1);
  --transition-speed: 0.3s;
}

body.light-theme {
  --bg-color: #f8fafc;
  --header-bg: rgba(255, 255, 255, 0.8);
  --text-color: #1e293b;
  --card-bg: rgba(0, 0, 0, 0.05);
  --border-color: rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: "Outfit", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  height: 100vh;
  overflow: hidden;
  transition:
    background-color var(--transition-speed),
    color var(--transition-speed);
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-header {
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.logo h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.logo h1 span {
  color: var(--accent-color);
  font-weight: 300;
}

.search-container {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  max-width: 500px;
  margin: 0 2rem;
}

.search-container input,
.search-container select {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  color: var(--text-color);
  outline: none;
  transition: all 0.2s;
}

.search-container select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
  font-family: inherit;
  font-weight: 600;
}

.search-container input:focus,
.search-container select:focus {
  border-color: var(--accent-color);
}

.search-container button {
  background: var(--accent-color);
  color: var(--bg-color);
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.search-container button:hover {
  opacity: 0.9;
}

.controls {
  display: flex;
  gap: 0.5rem;
}

.controls button {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.controls button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.viewer-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
}

.initial-notice,
.error-notice {
  text-align: center;
  padding: 2rem;
  max-width: 500px;
  color: var(--text-color);
  opacity: 0.8;
}

.initial-notice h2,
.error-notice h2 {
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.error-notice code {
  display: block;
  background: #000;
  color: #4caf50;
  padding: 0.5rem;
  margin: 1rem 0;
  border-radius: 4px;
  font-family: monospace;
}

.viewer-container:active {
  cursor: grabbing;
}

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

svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Footer & Legend */
.app-footer {
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  padding: 0.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.legend {
  display: flex;
  gap: 1.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.orange {
  background-color: #ffccbc;
  border: 1px solid #fe6637;
}
.dot.green {
  background-color: #e8f5e9;
  border: 1px solid #80cd86;
}
.dot.blue {
  background-color: #f3e5f5;
  border: 1px solid #c67ad1;
}
.dot.purple {
  background-color: #fff9c4;
  border: 1px solid #ffeb3c;
}

/* Highlight result */
.highlight-node {
  animation: highlight-pulse 1.5s infinite;
}

@keyframes highlight-pulse {
  0% {
    filter: drop-shadow(0 0 0px var(--accent-color));
  }
  50% {
    filter: drop-shadow(0 0 15px var(--accent-color));
  }
  100% {
    filter: drop-shadow(0 0 0px var(--accent-color));
  }
}

#matchCount {
  color: var(--accent-color);
  font-weight: 600;
}
