:root {
  --map-bg: #f8f9fa;
  --map-ui-bg: rgba(255, 255, 255, 0.95);
  --map-ui-shadow: 0 2px 6px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);
  --map-accent: #1a73e8;
  --map-text: #202124;
  --map-text-secondary: #70757a;
  --map-border: #dadce0;
  --map-radius: 8px;
  --map-font: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: var(--map-font);
  overflow: hidden;
  background-color: var(--map-bg);
}

.map-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Map Canvas Area */
.map-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #e5e3df; /* Google Maps-like light grey-tan background */
  background-image: 
    linear-gradient(rgba(0,0,0,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  overflow: hidden;
}

.indoor-map-floorplan {
  position: relative;
  width: 1000px;
  height: 850px;
  background: #f8f9fa;
  border: 2px solid #bdc1c6;
  border-radius: 4px;
  padding: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
}

.map-corridor {
  background: #ffffff;
  position: absolute;
  z-index: 1;
}

.map-room {
  background: #fdfdfd;
  border: 1px solid #dadce0;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  transition: background 0.2s;
  z-index: 2;
}

.map-room:hover {
  background: #f1f3f4;
  cursor: pointer;
}

.room-label {
  font-size: 10px;
  color: #70757a;
  pointer-events: none;
  line-height: 1.1;
  text-transform: uppercase;
  font-weight: 600;
}

.room-code {
  font-weight: 700;
  color: #3c4043;
  display: block;
  font-size: 11px;
}

.map-lab { background: #e8f0fe; border-color: #aecbfa; } /* Blue tint for labs */
.map-lab .room-label { color: #1967d2; }
.map-lab .room-code { color: #174ea6; }

.map-faculty { background: #fef7e0; border-color: #feefc3; } /* Yellow tint for faculty */
.map-faculty .room-label { color: #ea8600; }
.map-faculty .room-code { color: #b06000; }

.map-toilet { background: #f1f3f4; border-color: #dadce0; }
.map-toilet .room-label { color: #70757a; font-size: 8px; }

.map-courtyard {
  background: #e6f4ea; /* Green tint for courtyards */
  border: 2px dashed #ceead6;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.courtyard-text {
  color: #1e8e3e;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transform: rotate(-45deg);
  opacity: 0.6;
}

.map-stairs {
  background: repeating-linear-gradient(
    45deg,
    #f1f3f4,
    #f1f3f4 4px,
    #dadce0 4px,
    #dadce0 8px
  );
  border: 1px solid #dadce0;
  position: absolute;
}

.map-canvas:active {
  cursor: grabbing;
}

.map-image-wrapper {
  position: relative;
  transform: scale(1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* UI Elements - Floating Over Map */

/* Search Bar */
.search-container {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10;
  width: 392px;
  max-width: calc(100% - 40px);
}

.search-box {
  background: var(--map-ui-bg);
  border-radius: var(--map-radius);
  box-shadow: var(--map-ui-shadow);
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 48px;
}

.search-input {
  border: none;
  background: transparent;
  flex: 1;
  height: 100%;
  font-size: 16px;
  color: var(--map-text);
  outline: none;
  padding-left: 12px;
}

.search-icon {
  color: var(--map-text-secondary);
}

.search-divider {
  width: 1px;
  height: 28px;
  background: var(--map-border);
  margin: 0 12px;
}

.search-actions {
  display: flex;
  gap: 12px;
  color: var(--map-accent);
}

/* Bottom Controls */
.controls-bottom-right {
  position: absolute;
  bottom: 30px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.control-btn {
  width: 40px;
  height: 40px;
  background: var(--map-ui-bg);
  border: none;
  border-radius: 4px;
  box-shadow: var(--map-ui-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--map-text-secondary);
  transition: background 0.2s;
}

.control-btn:hover {
  background: #f1f3f4;
  color: var(--map-text);
}

.zoom-group {
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--map-ui-shadow);
}

.zoom-group .control-btn {
  box-shadow: none;
  border-radius: 0;
}

.zoom-group .control-btn:first-child {
  border-bottom: 1px solid var(--map-border);
}

/* Floor Switcher */
.floor-switcher {
  position: absolute;
  bottom: 120px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 10;
}

.floor-btn {
  width: 40px;
  height: 40px;
  background: var(--map-ui-bg);
  border: 1px solid var(--map-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--map-ui-shadow);
  color: var(--map-text-secondary);
}

.floor-btn.active {
  background: var(--map-accent);
  color: white;
  border-color: var(--map-accent);
}

/* Info Panel (Sidebar) */
.info-panel {
  position: absolute;
  top: 80px;
  left: 20px;
  width: 392px;
  max-width: calc(100% - 40px);
  background: var(--map-ui-bg);
  border-radius: var(--map-radius);
  box-shadow: var(--map-ui-shadow);
  max-height: calc(100% - 120px);
  overflow-y: auto;
  z-index: 9;
  display: none; /* Default hidden, but we'll show it on some pages */
}

.info-panel.visible {
  display: block;
}

.info-header {
  position: relative;
}

.info-image {
  width: 100%;
  height: 200px;
  background-color: #eee;
  background-size: cover;
  background-position: center;
}

.info-content {
  padding: 20px;
}

.info-title {
  margin: 0 0 4px 0;
  font-size: 22px;
  font-weight: 500;
  color: var(--map-text);
}

.info-subtitle {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: var(--map-text-secondary);
}

.info-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--map-border);
  padding-bottom: 16px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--map-accent);
  text-decoration: none;
}

.info-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.detail-icon {
  color: var(--map-accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.detail-text {
  font-size: 14px;
  color: var(--map-text);
  line-height: 1.4;
}

/* Category Pills */
.categories-container {
  position: absolute;
  top: 80px;
  left: 20px;
  display: flex;
  gap: 8px;
  z-index: 10;
  overflow-x: auto;
  padding-bottom: 10px;
  width: auto;
  max-width: calc(100% - 40px);
}

.category-pill {
  background: var(--map-ui-bg);
  border: 1px solid var(--map-border);
  border-radius: 20px;
  padding: 0 16px;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 14px;
  color: var(--map-text);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  transition: background 0.2s;
}

.category-pill:hover {
  background: #f1f3f4;
}

/* User Location Marker */
.user-marker {
  position: absolute;
  width: 20px;
  height: 20px;
  background: #4285f4;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 10px rgba(66, 133, 244, 0.2), 0 2px 4px rgba(0,0,0,0.3);
  z-index: 20;
  transform: translate(-50%, -50%);
}

.user-marker::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: rgba(66, 133, 244, 0.15);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  70% { transform: scale(2); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

/* Route Line Layer */
.route-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

/* Marker / Pin */
.map-marker {
  position: absolute;
  transform: translate(-50%, -100%);
  cursor: pointer;
  z-index: 5;
  text-decoration: none;
}

.marker-pin {
  width: 24px;
  height: 24px;
  background: #ea4335;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.map-marker:hover .marker-pin {
  transform: rotate(-45deg) scale(1.2);
}

.marker-pin::after {
  content: '';
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  transform: rotate(45deg);
}

.marker-label {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 4px 10px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  color: #3c4043;
  border: 1px solid #dadce0;
}

.marker-pos-302 { top: 140px; left: 280px; } /* IT LAB B-303 (at 240,140, width 80) center is 280 */
.marker-pos-faculty { top: 140px; left: 360px; } /* Faculty Room B-302 (at 320,140, width 80) center is 360 */
.marker-pos-seminar { top: 140px; left: 450px; } /* Classroom B-301 (at 400,140, width 100) center is 450 */
.marker-user-pos { top: 815px; left: 450px; } /* Near bottom passage */

.marker-blue { background: #4285f4; }
.marker-green { background: #34a853; }
.marker-large { width: 40px; height: 40px; }

.map-dimmed { filter: grayscale(0.5) contrast(0.8); }
