/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  overflow: hidden;
  background-color: #000;
}

/* App container */
#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Help button in top right corner */
.help-button {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: all 0.3s ease;
}

.help-button:hover {
  background-color: rgba(0, 0, 0, 1);
  transform: scale(1.1);
}

.help-button:active {
  transform: scale(1.05);
}

/* Mobile Navigation */
#mobile-nav {
  background-color: rgba(0, 0, 0, 0.9);
  padding: 10px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: none;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  z-index: 100;
}

#mobile-panorama-select {
  flex: 1 1 auto;
  max-width: calc(100% - 60px);
  padding: 10px 12px;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  font-weight: 500;
  border-radius: 4px;
}

#mobile-panorama-select option {
  background-color: #1a1a1a;
  color: #fff;
  padding: 10px;
}

#mobile-panorama-select:focus {
  border-color: rgba(255, 255, 255, 0.6);
  background-color: rgba(255, 255, 255, 0.15);
}

.mobile-home-button {
  padding: 10px 15px;
  font-size: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 4px;
  width: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-home-button:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.mobile-home-button:active {
  transform: translateY(0);
}

/* Mobile description container */
#mobile-description-container {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  width: 100%;
  height: calc(100vh - 60px);
  overflow-y: auto;
  background: white;
  z-index: 20;
}

/* Top Menu */
#top-menu {
  background-color: rgba(0, 0, 0, 0.9);
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
}

/* Contact email next to help button */
#contact-email {
  position: fixed;
  top: 20px;
  right: 70px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.8;
  z-index: 200;
  background-color: rgba(0, 0, 0, 0.9);
  padding: 10px 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  height: 40px;
  box-sizing: border-box;
}

#controls {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

#controls label {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

/* Level buttons container */
#level-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Level buttons */
.level-button {
  padding: 8px 16px;
  font-size: 0.9rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  font-weight: 500;
  white-space: nowrap;
}

.level-button:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.level-button.active {
  background-color: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 1);
}

.level-button:active {
  transform: translateY(0);
}

/* Panorama select dropdown */
#panorama-select {
  padding: 8px 12px;
  font-size: 0.9rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  font-weight: 500;
  border-radius: 4px;
  min-width: 200px;
}

#panorama-select option {
  background-color: #1a1a1a;
  color: #fff;
  padding: 8px;
}

#panorama-select:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

#panorama-select:focus {
  border-color: rgba(255, 255, 255, 0.6);
  background-color: rgba(255, 255, 255, 0.15);
}

/* General description button - add spacing */
#general-description-btn {
  margin-left: 15px;
}

/* Main Content Area */
#main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Left Panel: Floor Plan */
#floor-plan-panel {
  width: 30%;
  min-width: 300px;
  background-color: #1a1a1a;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#floor-plan-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 15px 20px;
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#floor-plan-container {
  flex: 1;
  overflow: hidden;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#floor-plan-canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: crosshair;
  image-rendering: auto;
}

/* Right Panel: Viewer */
#viewer-panel {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#viewer-container {
  width: 100%;
  height: 100%;
}

/* Mobile viewer container adjustments */
@media (max-width: 768px) {
  #viewer-panel {
    display: block !important;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100vh - 60px);
    z-index: 10;
  }

  #viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
  }
}

/* Loading indicator */
#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 1.5rem;
  text-align: center;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.8);
  padding: 2rem 3rem;
}

/* Error message */
#error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  background-color: rgba(0, 0, 0, 0.9);
  padding: 2rem 3rem;
  border: 2px solid #fff;
  max-width: 80%;
  text-align: center;
  z-index: 1000;
  font-size: 1rem;
}

/* Navigation markers */
.navigation-marker {
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  border: 1px solid #fff;
  text-align: center;
  user-select: none;
}

.navigation-marker:hover {
  background-color: rgba(0, 0, 0, 1);
  transform: scale(1.1);
}

/* Markdown container - modern card style */
#markdown-container {
  background: #fff;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  overflow-y: auto;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Close button */
.markdown-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #000;
  border: 2px solid #fff;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  transition: all 0.2s ease;
  z-index: 200;
}

.markdown-close-btn:hover {
  background: #333;
  color: #fff;
  transform: translateY(-2px);
}

/* Markdown content styling */
.markdown-content {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: white;
  padding: 80px 50px 50px 50px;
  animation: slideUp 0.4s ease-out;
  box-sizing: border-box;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.markdown-content h1 {
  font-size: 2.5em;
  font-weight: 700;
  margin-bottom: 0.3em;
  color: #000;
  line-height: 1.2;
}

.markdown-content h2 {
  font-size: 1.8em;
  font-weight: 600;
  margin-top: 2em;
  margin-bottom: 0.8em;
  color: #000;
  line-height: 1.3;
  padding-bottom: 0.3em;
  border-bottom: 2px solid #000;
}

.markdown-content h3 {
  font-size: 1.4em;
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.6em;
  color: #000;
  line-height: 1.4;
}

.markdown-content p {
  margin-bottom: 1.2em;
  line-height: 1.8;
  color: #000;
  font-size: 1.05em;
}

.markdown-content ul {
  margin-bottom: 1.5em;
  padding-left: 2em;
}

.markdown-content li {
  margin-bottom: 0.7em;
  line-height: 1.7;
  color: #000;
}

.markdown-content li::marker {
  color: #000;
}

.markdown-content strong {
  font-weight: 600;
  color: #000;
}

.markdown-content em {
  font-style: italic;
  color: #000;
}

.markdown-content a {
  color: #000;
  text-decoration: underline;
  transition: all 0.2s ease;
  font-weight: 500;
}

.markdown-content a:hover {
  color: #666;
}

.markdown-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2em auto;
  border: 1px solid #000;
}

/* Blue box styling for lines starting with 📐 */
.markdown-content .area-measurement {
  background: #fff;
  padding: 12px 20px;
  border: 2px solid #000;
  margin: 1em 0;
  font-weight: 500;
  color: #000;
  display: inline-block;
  font-size: 1.1em;
}

/* Splash Screen */
.splash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-in;
  padding: 20px;
  box-sizing: border-box;
}

.splash-content {
  background: #fff;
  max-width: 600px;
  width: 100%;
  padding: 40px 50px;
  border: 3px solid #000;
  text-align: center;
  animation: slideUp 0.4s ease-out;
}

.splash-text {
  font-size: 1.1em;
  line-height: 1.7;
  color: #000;
  margin-bottom: 30px;
  font-weight: 500;
}

.splash-ok-button {
  padding: 12px 40px;
  font-size: 1.1em;
  font-weight: 600;
  background-color: #000;
  color: #fff;
  border: 2px solid #000;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.splash-ok-button:hover {
  background-color: #fff;
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.splash-ok-button:active {
  transform: translateY(0);
}

/* Modal popup for help */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  animation: fadeIn 0.3s ease-in;
  padding: 20px;
  box-sizing: border-box;
}

.modal-content {
  background: #fff;
  max-width: 900px;
  max-height: 90vh;
  width: 100%;
  overflow-y: auto;
  border: 2px solid #000;
  position: relative;
  animation: slideUp 0.4s ease-out;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #000;
  border: 2px solid #fff;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close-btn:hover {
  background: #333;
  color: #fff;
  transform: scale(1.1);
}

.modal-markdown-content {
  padding: 40px 50px;
  background: white;
  margin: 0;
}

/* Photo Sphere Viewer customization */
.psv-container {
  background-color: #000;
}

.psv-loader-container {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  /* Mobile navigation is shown, desktop menu is hidden */
  #top-menu {
    display: none !important;
  }

  #floor-plan-panel {
    display: none !important;
  }

  #mobile-nav {
    display: flex !important;
  }

  #loading,
  #error {
    font-size: 1rem;
    padding: 1.5rem 2rem;
  }

  .navigation-marker {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }


  #controls {
    gap: 10px;
  }

  #controls label {
    font-size: 0.8rem;
  }

  .level-button {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  #markdown-container {
    padding: 15px !important;
    font-size: 14px !important;
  }

  .markdown-content {
    padding: 60px 20px 20px 20px !important;
  }

  .markdown-content h1 {
    font-size: 1.8em;
  }

  .markdown-content h2 {
    font-size: 1.5em;
  }

  .markdown-content h3 {
    font-size: 1.3em;
  }

  .markdown-image {
    margin: 1em 0;
  }

  .markdown-close-btn {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .help-button {
    display: none !important;
  }

  #contact-email {
    display: none !important;
  }

  /* Modal adjustments for mobile */
  .modal-overlay {
    padding: 10px;
  }

  .modal-content {
    max-height: 95vh;
  }

  .modal-markdown-content {
    padding: 25px 20px !important;
  }

  .modal-close-btn {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  /* Splash screen adjustments for mobile */
  .splash-overlay {
    padding: 15px;
  }

  .splash-content {
    padding: 30px 25px;
  }

  .splash-text {
    font-size: 1em;
    margin-bottom: 25px;
  }

  .splash-ok-button {
    padding: 10px 30px;
    font-size: 1em;
  }
}
