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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* Header */
#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: #1a73e8;
  color: white;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

#header h1 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Search */
#search-wrap {
  flex: 1;
  max-width: 320px;
  position: relative;
}

#search {
  width: 100%;
  padding: 6px 32px 6px 10px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
  background: rgba(255,255,255,0.2);
  color: white;
}

#search::placeholder { color: rgba(255,255,255,0.6); }
#search:focus { background: rgba(255,255,255,0.95); color: #333; }
#search:focus::placeholder { color: #999; }

#search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: rgba(255,255,255,0.6);
  font-size: 18px; cursor: pointer; display: none; line-height: 1;
}
#search:focus ~ #search-clear { color: #999; }

#search-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: white;
  color: #333;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 240px;
  overflow-y: auto;
  display: none;
  z-index: 1001;
}

#search-results.visible { display: block; }

.search-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #333;
}

.search-item:hover, .search-item.active { background: #e8f0fe; }
.search-item .floor-badge {
  font-size: 11px;
  background: #1a73e8;
  color: white;
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Language toggle */
#lang-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
#lang-btn:hover { background: rgba(255,255,255,0.3); }

#btn-3d {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
#btn-3d:hover { background: rgba(255,255,255,0.3); }

/* Floor switcher */
#floor-switcher {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  overflow: hidden;
}

.floor-tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: white;
  color: #555;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.floor-tab:not(:last-child) { border-right: 1px solid #e0e0e0; }
.floor-tab:hover { background: #f0f0f0; }
.floor-tab.active { background: #1a73e8; color: white; }

/* Map container */
#map {
  position: fixed;
  top: 42px;
  left: 0; right: 0; bottom: 0;
  z-index: 1;
}

/* Leaflet popup override */
.leaflet-popup-content-wrapper {
  border-radius: 6px;
  font-size: 14px;
}
.leaflet-popup-content {
  margin: 10px 14px;
  line-height: 1.4;
}
.popup-label { font-weight: 600; font-size: 15px; }
.popup-floor { color: #666; font-size: 13px; }

/* Room highlight pulse */
@keyframes room-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}
.room-highlight {
  animation: room-pulse 1.5s ease-in-out 3;
}

/* Loading */
#loading {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.3s;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid #e0e0e0;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Info button */
#info-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
#info-btn:hover { background: rgba(255,255,255,0.3); }

/* Info panel */
#panel-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1999;
}
#panel-overlay.visible { display: block; }

#info-panel {
  position: fixed;
  top: 0; right: -320px; bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: white;
  z-index: 2000;
  box-shadow: -2px 0 12px rgba(0,0,0,0.2);
  transition: right 0.25s ease;
  display: flex;
  flex-direction: column;
}
#info-panel.open { right: 0; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1a73e8;
  color: white;
  flex-shrink: 0;
}
.panel-header h2 { font-size: 16px; margin: 0; }
#panel-close {
  background: none; border: none; color: white;
  font-size: 22px; cursor: pointer; line-height: 1;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.panel-section {
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
}
.panel-section h3 {
  font-size: 14px;
  color: #1a73e8;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.panel-section p {
  font-size: 13px;
  color: #555;
  line-height: 1.5;
  margin: 0 0 8px;
}

/* Legend */
.legend-items { display: flex; flex-direction: column; gap: 6px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #555; }
.legend-color {
  width: 16px; height: 16px; border-radius: 3px;
  flex-shrink: 0; border: 1px solid rgba(0,0,0,0.1);
}

/* Feedback */
#feedback-text {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
}
#feedback-text:focus { border-color: #1a73e8; outline: none; }

#feedback-send {
  margin-top: 8px;
  padding: 6px 16px;
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}
#feedback-send:hover { background: #1557b0; }

#feedback-msg {
  font-size: 12px;
  color: #4caf50;
  margin-top: 6px;
  min-height: 16px;
}

.panel-footer {
  border-bottom: none;
}
.panel-footer p {
  font-size: 12px;
  color: #999;
  text-align: center;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  #header h1 { font-size: 14px; }
  #search-wrap { max-width: 140px; }
  #search { font-size: 13px; padding: 5px 8px; }
  .floor-tab { padding: 8px 12px; font-size: 13px; }
  #btn-3d { font-size: 12px; padding: 3px 8px; }
  #lang-btn { font-size: 12px; padding: 3px 8px; }
  #info-btn { font-size: 14px; padding: 3px 6px; }
}
