html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background-color: #222b31;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

canvas {
  display: block;
}

/* Søkeboks */
#searchBox {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#searchInput {
  width: 320px;
  font-size: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e1e5e9;
  background: rgba(255, 255, 255, 0.9);
  transition: all 0.2s ease;
}

#searchInput:focus {
  outline: none;
  border-color: #4285f4;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
  background: white;
}

#resetCenterBtn {
  padding: 10px 16px;
  background: #f8f9fa;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #5f6368;
  transition: all 0.2s ease;
}

#resetCenterBtn:hover {
  background: #e8f0fe;
  border-color: #4285f4;
  color: #1a73e8;
}

/* Søkeresultater */
#searchResults {
  position: absolute;
  top: 76px;
  left: 16px;
  z-index: 11;
  width: 380px;
  max-height: 360px;
  overflow: auto;
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(12px);
  display: none;
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#searchResults .item {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #f1f3f4;
  transition: background-color 0.15s ease;
}

#searchResults .item:last-child {
  border-bottom: none;
}

#searchResults .item:hover,
#searchResults .item.active {
  background: #f8f9fa;
}

#searchResults .item-content {
  flex: 1;
}

#searchResults .name {
  font-weight: 600;
  color: #202124;
  font-size: 15px;
  line-height: 1.3;
}

#searchResults .name mark {
  background: #fff3cd;
  color: #856404;
  padding: 0 2px;
  border-radius: 2px;
}

#searchResults .meta {
  color: #5f6368;
  font-size: 13px;
  margin-top: 2px;
  line-height: 1.2;
}

#searchResults .meta mark {
  background: #e8f0fe;
  color: #1a73e8;
  padding: 0 2px;
  border-radius: 2px;
}

#searchResults .badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  background: #e8f0fe;
  color: #1a73e8;
  border: 1px solid rgba(26, 115, 232, 0.2);
}

/* Etasjeknapper */
#floorButtons {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  gap: 8px;
}

#floorButtons button {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #5f6368;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

#floorButtons button:hover {
  background: rgba(255, 255, 255, 1);
  border-color: #4285f4;
  color: #1a73e8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#floorButtons button:active {
  transform: translateY(0);
}

/* Loading overlay */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(34, 40, 49, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.loading-content {
  text-align: center;
  color: white;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #4285f4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-message {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  opacity: 0.9;
}

/* Notification system */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 320px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification-success {
  background: #34a853;
  border-left: 4px solid #137333;
}

.notification-error {
  background: #ea4335;
  border-left: 4px solid #c5221f;
}

.notification-warning {
  background: #fbbc04;
  color: #3c4043;
  border-left: 4px solid #f29900;
}

.notification-info {
  background: #4285f4;
  border-left: 4px solid #1a73e8;
}

/* Scrollbar styling for search results */
#searchResults::-webkit-scrollbar {
  width: 8px;
}

#searchResults::-webkit-scrollbar-track {
  background: #f1f3f4;
  border-radius: 4px;
}

#searchResults::-webkit-scrollbar-thumb {
  background: #dadce0;
  border-radius: 4px;
}

#searchResults::-webkit-scrollbar-thumb:hover {
  background: #bdc1c6;
}

/* Mobile responsive */
@media (max-width: 768px) {
  #searchBox {
    left: 12px;
    right: 12px;
    width: auto;
    padding: 8px 10px;
    top: 80px; /* Move down to avoid floor buttons */
  }

  #searchInput {
    width: auto;
    min-width: 75%;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  #searchResults {
    left: 12px;
    right: 12px;
    width: auto;
    top: 134px; /* Adjust for moved search box */
  }

  #floorButtons {
    top: 12px;
    right: 12px;
    left: 12px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: space-between;
  }

  #floorButtons button {
    padding: 8px 12px;
    font-size: 13px;
    flex: 1;
    min-width: 0;
  }

  #resetCenterBtn {
    padding: 8px 12px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  #searchBox {
    flex-direction: column;
    gap: 6px;
    top: 70px; /* Adjust for smaller screens */
  }

  #searchResults {
    top: 140px; /* Adjust accordingly */
  }

  #searchInput {
    font-size: 16px;
  }

  #searchResults .item {
    padding: 10px 12px;
  }

  #searchResults .name {
    font-size: 14px;
  }

  #searchResults .meta {
    font-size: 12px;
  }

  #floorButtons {
    gap: 4px;
  }

  #floorButtons button {
    padding: 6px 8px;
    font-size: 12px;
  }
}

/* Keyboard navigation hints */
.search-hint {
display: none;
}

/* Hide keyboard hints on mobile */
@media (max-width: 768px) {
  .search-hint {
    display: none;
  }
}

/* Focus visible for accessibility */
button:focus-visible,
input:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  #searchBox, #searchResults {
    border: 2px solid #000;
  }
  
  #searchInput {
    border: 2px solid #000;
  }
  
  .notification {
    border: 2px solid currentColor;
  }
}