/* Global styles */
:root {
  --main-bg-color: black;
  --main-text-color: white;
  --inactive-color: #777777;
  --accent-color: red;
  --border-style: 1px solid white;
  --main-font: 13px Courier, sans-serif;
  --standard-padding: 10px;
  --standard-margin: 5px;
  --taskbar-height: 30px;
  --container-spacing: 6vh;
  --mobile-container-spacing: 8vw;
}

body {
  padding: 0;
  margin: 0;
  background-color: var(--main-bg-color);
  overflow: hidden;
}

/* Make sure the visualization is always fullscreen */
.main {
  width: 100vw;
  height: 100vh;
  position: relative;
}

span {
  line-height: 1.0;
}

/* Map related styles */
.mapboxgl-canvas-container *, .mapboxgl-ctrl-nav-compass {
  cursor: crosshair !important;
}

a.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-bottom-right {
  display: none !important;
}

/* Map container styles - always full screen */
#mapvis {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block; /* Ensure always visible */
}

#mapvis > .mapboxgl-map {
  width: 100%;
  height: 100%;
}

/* Fix canvas container in mapvis */
#mapvis canvas {
  display: block;
}

/* Taskbar styles */
#console {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--taskbar-height);
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  padding: 0 10px;
/*  background-color: rgba(0, 0, 0, 0.5);*/
  z-index: 10;
  box-sizing: border-box;
}

#console button {
  background-color: transparent;
  border: none;
  color: var(--main-text-color);
  font: var(--main-font);
  padding: 0 15px 0 0;
  cursor: pointer;
  height: 100%;
  transition: color 0.3s ease;
}

#console button:hover {
  color: var(--accent-color);
}

#console button.active {
  color: var(--main-text-color);
}

#console button.inactive {
  color: var(--inactive-color);
}

/* Hidden back button, shown when info is active */
#back {
  display: none;
  position: fixed;
  top: 7px;
  left: 0;
  height: var(--taskbar-height);
  color: var(--main-text-color);
  font: var(--main-font);
/*  background-color: rgba(0, 0, 0, 0.5);*/
  width: 100%;
  z-index: 10;
  padding: 0 10px;
  display: none;
  align-items: center;
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

#back::-webkit-scrollbar {
  display: none;
}

#back button {
  background-color: transparent;
  border: none;
  color: var(--main-text-color);
  font: var(--main-font);
  cursor: pointer;
}

/* Hide/show toggle */
#hide, #show {
  position: fixed;
  top: 0;
  right: 15px;
  color: var(--main-text-color);
  font: var(--main-font);
  text-align: center;
  cursor: pointer;
  z-index: 11;
  height: var(--taskbar-height);
  display: flex;
  align-items: center;
  justify-content: center;
}

#show {
  display: none;
  top: 10px;
}

/* Info panel styles - centered */
#info {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40%;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 5;
}

#infoMessage {
  color: var(--main-text-color);
  font: var(--main-font);
  padding: var(--standard-padding);
  text-align: left;
/*  border: var(--border-style);*/
  background-color: rgba(0, 0, 0, 0.8);
}

#emailForm {
  display: flex;
  flex-flow: row wrap;
  justify-content: space-between;
  margin-top: 10px;
}

#emailForm > input[type=text] {
  border: var(--border-style);
  border-radius: 0;
  background-color: transparent;
  color: var(--main-text-color);
  padding: 3px;
  font: var(--main-font);
  outline: none;
  flex-grow: 1;
  margin-right: 5px;
}

#emailForm > input[type=submit] {
  border: var(--border-style);
  color: var(--main-text-color);
  background-color: transparent;
  font: var(--main-font);
  cursor: pointer;
  padding: 3px 10px;
}

#emailForm > input[type=submit]:hover {
  background-color: transparent;
  color: var(--accent-color);
  cursor: crosshair !important;
}

/* Market display styles */
#market {
  position: fixed;
  display: none;
  flex-flow: column;
  right: var(--container-spacing);
  top: calc(var(--taskbar-height) + 10px);
  color: var(--main-text-color);
  font: var(--main-font);
  max-width: 30vw;
  z-index: 5;
  background-color: rgba(0, 0, 0, 0.8);
}

#buy, #price {
  border: var(--border-style);
  padding: var(--standard-padding);
  width: 10vw;
}

#buy {
  margin-bottom: var(--standard-margin);
}

/* Chat container styles */
#chatContainer {
  position: fixed;
  bottom: var(--container-spacing);
  left: var(--container-spacing);
  width: 30vw;
  display: none;
  z-index: 5;
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}



#chat {
  display: flex;
  flex-flow: column;
  justify-content: flex-end;
  padding: var(--standard-padding);
  font: var(--main-font);
  color: var(--main-text-color);
  border: var(--border-style);
  margin-bottom: var(--standard-margin);
  max-height: 30vh;
  overflow-y: auto;
  background-color: rgba(0, 0, 0, 0.8);
}

.chatLine * {
  word-break: break-word;
  hyphens: auto;
  width: inherit;
}

.chatEntity {
  width: inherit;
  word-break: break-word;
  hyphens: auto;
}

/* Chat form styles */
#userChat {
  display: flex;
  flex-flow: row nowrap;
  justify-content: space-between;
}

#userChat > input[type=text] {
  border: var(--border-style);
  border-radius: 0;
  background-color: transparent;
  color: var(--main-text-color);
  padding: 3px;
  font: var(--main-font);
  outline: none;
}

#username {
  width: 20%;
  border: var(--border-style);
  margin-right: 5px;
}

#userMessage {
  width: 60%;
  margin-right: 5px;
}

#userChat > input[type=submit] {
  width: 15%;
  border: var(--border-style);
  color: var(--main-text-color);
  font-size: 11px;
  background-color: transparent;
  cursor: pointer;
}

#userChat > input[type=submit]:hover {
  background-color: transparent;
  color: var(--accent-color);
  cursor: crosshair !important;
}

/* Interface to contain all UI elements */
#interface {
  position: relative;
  z-index: 5;
}

/*************************Mobile Styles**************************/

/* Tablet and smaller */
@media screen and (max-width: 1024px) {
  #info {
    width: 60%;
  }
  
  #market {
    max-width: 40vw;
  }
  
  #buy, #price {
    width: 20vw;
  }
  
  #chatContainer {
    width: 40vw;
  }
}

/* Mobile landscape */
@media screen and (max-width: 800px) and (orientation: landscape) {
  #info {
    width: 70%;
  }
}

/* Mobile portrait */
@media screen and (max-width: 600px) {
  #info {
    width: 80%;
  }
  
  /* Mobile chat styles */
  #chatContainer {
    position: fixed;
    left: var(--mobile-container-spacing);
    right: var(--mobile-container-spacing);
    bottom: var(--mobile-container-spacing);
    width: calc(100% - 2 * var(--mobile-container-spacing));
    -ms-overflow-style: none;  /* IE and Edge */
  	scrollbar-width: none;  /* Firefox */
  }

  #chatContainer::-webkit-scrollbar {
  display: none;
}
  
  #chat {
    max-height: 25vh;
  }
  
  /* Mobile market styles */
  #market {
    position: fixed;
    flex-flow: column;
    right: var(--mobile-container-spacing);
    left: var(--mobile-container-spacing);
    top: calc(var(--taskbar-height) + 10px);
    max-width: none;
    width: calc(100% - 2 * var(--mobile-container-spacing));
  }
  
  #buy, #price {
    width: auto;
  }
  
  /* Adjust username and message fields for mobile */
  #username {
    width: 25%;
  }
  
  #userMessage {
    width: 55%;
  }
  
  #userChat > input[type=submit] {
    width: 15%;
  }
}

/* Fix for font sizing in mobile browsers */
@media screen and (-webkit-min-device-pixel-ratio:0) { 
  select, textarea, input {
    font-size: 13px;
  }
}

@media screen and (-webkit-min-device-pixel-ratio:0) { 
  select:focus, textarea:focus, input:focus {
    font-size: 13px;
  }
}

@media screen and (device-aspect-ratio: 9/16) {
  select, textarea, input[type="text"], input[type="password"],
  input[type="datetime"], input[type="datetime-local"],
  input[type="date"], input[type="month"], input[type="time"],
  input[type="week"], input[type="number"], input[type="email"],
  input[type="tel"], input[type="url"] { 
    font-size: 16px; 
  }
}
