/* Map Styles */
#mapwrapper {
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 0;
  background-color: transparent;
  min-width: 220px;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#visnames {
  font-family: Arial, Helvetica, sans-serif;
}

#mapbase svg {
  max-height: 100%;
  width: 100%;
  margin: 0;
}

#tipus {
  font: 14px/16px Trebuchet MS, Helvetica, Arial, sans-serif;
  display: none;
  max-width: 40%;
  padding: 5px;
  border: 1px solid #404040;
  color: #404040;
  z-index: 1000;
  float: left;
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  /* Corrected 265 to 255 */
  word-break: keep-all;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.5);
  -moz-box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.5);
  -webkit-box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.5);
}

#tipus p {
  margin: 0 !important;
  color: #404040 !important;
}

#tipus img {
  float: left;
  padding: 3px;
  max-width: 100%;
}

/* Responsive Map */
@media screen and (max-width: 320px) {
  #mapbase svg {
    height: 140px;
  }
}

@media screen and (max-width: 400px) and (min-width: 321px) {
  #mapbase svg {
    height: 180px;
  }
}

@media screen and (max-width: 480px) and (min-width: 401px) {
  #mapbase svg {
    height: 250px;
  }
}

@media screen and (max-width: 568px) and (min-width: 481px) {
  #mapbase svg {
    height: 290px;
  }
}

@media screen and (max-width: 685px) and (min-width: 569px) {
  #mapbase svg {
    height: 340px;
  }
}

@media screen and (max-width: 767px) and (min-width: 686px) {
  #mapbase svg {
    height: 420px;
  }
}

@media screen and (min-width: 768px) {
  #mapbase svg {
    height: 470px;
  }
}

/* Search and Form Styles - Namespaced to .completion-plugin-container to avoid global conflicts */
.completion-plugin-container .column2 {
  width: 290px;
  margin: 0px auto;
  float: left;
  margin-left: 20px;
}

.completion-plugin-container .column1 {
  width: 300px;
  color: #000;
  float: left;
}

.completion-plugin-container input.search-input {
  background-image: url('searchicon.png');
  /* You might need to adjust this path */
  background-position: 10px 12px;
  background-repeat: no-repeat;
  width: 100%;
  font-size: 16px;
  padding: 12px 20px 12px 40px;
  border: 1px solid #ddd;
  margin-bottom: 12px;
}

.completion-plugin-container table.completion-table {
  border-collapse: collapse;
  width: 100%;
  border: 1px solid #ddd;
  font-size: 18px;
}

.completion-plugin-container table.completion-table th,
.completion-plugin-container table.completion-table td {
  text-align: left;
  padding: 12px;
}

.completion-plugin-container table.completion-table tr {
  border-bottom: 1px solid #ddd;
}

.completion-plugin-container table.completion-table tr.header,
.completion-plugin-container table.completion-table tr:hover {
  background-color: #f1f1f1;
}

.completion-plugin-container .message_container {
  display: none;
  font-weight: bold;
  color: red;
}

.completion-plugin-container select {
  width: 100%;
  padding: 16px 20px;
  border: 1px solid black;
  border-radius: 4px;
  background-color: #fff;
}

.completion-plugin-container input[type=text],
.completion-plugin-container input[type=password] {
  border: 1px solid black;
  border-radius: 4px;
  width: 100%;
  padding: 12px 20px;
  margin: 8px 0;
  box-sizing: border-box;
}

.completion-plugin-container input[type=button],
.completion-plugin-container input[type=submit],
.completion-plugin-container input[type=reset],
.completion-plugin-container .button {
  background-color: #000;
  border: none;
  color: white;
  padding: 16px 32px;
  text-decoration: none;
  margin: 4px 2px;
  cursor: pointer;
  display: inline-block;
  font-size: 16px;
  text-align: center;
}

.completion-plugin-container input[type=button]:hover,
.completion-plugin-container input[type=submit]:hover,
.completion-plugin-container .button:hover {
  opacity: 0.8;
}

/* Override Moodle theme SVG color rules within the map */
#mapbase svg path[id^="us_"] {
  fill: #ebeced !important;
  transition: fill 0s !important;
}

#mapbase svg path[id^="us_"]:hover {
  fill: #003754 !important;
}

/* Make state text visible on dark hover background */
#mapbase svg text[id^="us_vn"]:hover~path,
#mapbase svg g:hover path[id^="us_"] {
  fill: #003754 !important;
}

/* Prevent Moodle from styling anything inside mapbase */
#mapbase svg * {
  transition: none !important;
}