header {
  background-color: #FFED00;
  color: #444;
  padding: 20px 10px 18px 10px;
  font-family: sans-serif;
}

.title {
  margin: 10px;
  font-family: Arial, sans-serif;
  font-size: 28px;
  font-weight: bold;
}

.title2 {
  margin: 10px;
  font-family: Arial, sans-serif;
  font-size: 23px;
  font-weight: bold;
  color: #444;
}

.body-text {
  margin: 10px;
  font-family: Arial, sans-serif;
  font-size: 16px;
} 

#mobileMenu {
  overflow-y: auto;
}

.menu-toggle, 
.menu-close-btn, 
.mobile-legend-btn,
#authPanelContainer,
#mobileAddPlantBtn,
#mobileSearchContainer {
  display: none !important;
}

.menu-container {
  display: block !important;
  position: static !important;
  width: auto !important;
  height: auto !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

#mobileLegendContent {
  display: none;
}

#mobileLegendList {
  width: 100%;
}


.mobile-legend-species {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 14px;
}

.mobile-legend-species.active span {
  font-weight: bold;
}

.mobile-legend-color {
  display: inline-block;
  width: 14px;
  height: 14px;
  min-width: 14px;
  border-radius: 50%;
  border: 1px solid #555;
}

#authPanel {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9998;
  background: white;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  font-family: Arial,sans-serif;
  width: 200px;
  box-sizing: border-box; 
}

#authPanel input,
#authPanel button {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  margin-bottom: 10px;
}

#authPanel .button-group {
  display: flex;
  gap: 2px;
  margin-top: 10px;
  margin-bottom: 10px;
}

#authPanel .button-group button {
  flex: 1; 
  margin: 0;
}

#resetPasswordBtn {
  display: inline-flex;
  align-items: center;
  background: white;
  border: none;
  font-size: 13px;
  color: #4008EE;
  cursor: pointer;
}

#layout {
  display: flex;
  height: 550px;
}

#map {
  flex: 1;
  width: 100%;
  height: 550px;
}

.leaflet-map-pane, #addBtn {
  z-index: auto !important;
}

.leaflet-customPopupPane-pane, .leaflet-popup-pane, .leaflet-popup {
  z-index: 99999 !important;
}

#mapSwitcher {
  position: absolute;
  top: 80px;
  right: 530px;
  z-index: 2000;
}

#map-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid #d0d0d0;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
}

#languageSwitcher {
  position: absolute;
  top: 80px;
  right: 365px;
  z-index: 2000;
}

#language-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid #d0d0d0;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
}

#language-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.finland-flag {
  width: 24px;
  height: 15px;
  background-color: #ffffff;
  position: relative;
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

.finland-flag::before {
  content: "";
  position: absolute;
  top: 5px; /* (15px / 3) */
  left: 0;
  width: 100%;
  height: 5px;
  background-color: #002f6c;
}

.finland-flag::after {
  content: "";
  position: absolute;
  top: 0;
  left: 6px;
  width: 5px;
  height: 100%;
  background-color: #002f6c;
}

.uk-flag {
  width: 25px;
  height: 15px;
  position: relative;
  background-color: #00247d; 
  overflow: hidden;
  box-shadow: 0 0 5px rgba(0,0,0,0.2);

  background-image:
    linear-gradient(90deg, transparent 45%, #cf142b 45%, #cf142b 55%, transparent 55%),
    linear-gradient(90deg, transparent 42%, #ffffff 42%, #ffffff 58%, transparent 58%),
    linear-gradient(0deg, transparent 40%, #cf142b 40%, #cf142b 60%, transparent 60%),
    linear-gradient(0deg, transparent 34%, #ffffff 34%, #ffffff 66%, transparent 66%),
    
    linear-gradient(26.5deg, transparent 48%, #cf142b 48%, #cf142b 52%, transparent 52%),
    linear-gradient(-26.5deg, transparent 48%, #cf142b 48%, #cf142b 52%, transparent 52%),
    
    linear-gradient(26.5deg, transparent 44%, #ffffff 44%, #ffffff 56%, transparent 56%),
    linear-gradient(-26.5deg, transparent 44%, #ffffff 44%, #ffffff 56%, transparent 56%);
}

#speciesInfo {
  top: 30px;
  width: 320px;
  padding: 15px;
  background: white;
  border-left: 1px solid #ccc;
  overflow-y: auto;
  font-family: Arial, sans-serif;
}

#speciesInfo h3 {
  margin-top: 0;
  font-family: Arial, sans-serif; 
  font-size: 20px; 
  font-weight: bold; 
  color: #444;
}

.plant-popup {
  width: 700px;
  max-width: 90vw;
}

.popup-main {
  display: flex;
  gap: 15px;
}

.popup-images {
  flex: 0 0 250px;
}

.popup-info {
  flex: 1;
  min-width: 0;
}

.popup-footer {
  margin-top: 12px;
}

.popup-description {
  margin-bottom: 10px;
}

.comments-container {
  max-height: 250px;
  overflow-y: auto;
}

.plant-images img {
  max-height: 300px;
  max-width: 300px;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 8px;
}

.leaflet-popup-content {
  max-width: 80vw;
}

.popup-main {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

.plant-form {
  display: none;
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;

  width: 320px;
  max-width: 90vw;

  background: white;
  padding: 16px;

  border-radius: 10px;
  border: 1px solid #ccc;

  max-height: 80vh;
  overflow-y: auto;

  box-shadow: 0 4px 12px rgba(0,0,0,0.2);

  font-family: sans-serif;
}

.plant-form h3 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 18px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.plant-form input,
.plant-form select,
.plant-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #bbb;
  border-radius: 6px;
  font-size: 14px;
}

.plant-form textarea {
  min-height: 100%;
  resize: vertical;
}

.plant-form input[readonly] {
  background: #f0f0f0;
  color: #666;
  cursor: not-allowed;
}

.coord-row {
  display: flex;
  gap: 8px;
}

.coord-row > div {
  flex: 1;
}

.coord-label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 2px;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;

  margin-top: 14px;
}

.button-row button {
  padding: 8px 14px;

  border: none;
  border-radius: 6px;

  cursor: pointer;
  font-size: 14px;
}

#savePlant {
  background: #2d7d46;
  color: white;
}

#savePlant:hover {
  background: #25673a;
}

.secondary {
  background: #ddd;
}

.secondary:hover {
  background: #c9c9c9;
}

.north-arrow {
  background: white;
  padding: 6px;
  border-radius: 6px;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
  text-align: center;
  font-size: 14px;
}

.legend {
  background: white;
  padding: 8px;
  border-radius: 6px;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
  font-size: 12px;
}

.legend-species.active span {
  font-weight: bold;
}

footer {
  background-color: #FFED00;
  color: #444;
  padding: 40px 20px 20px 20px;
  font-family: sans-serif;
}

.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-column {
  flex: 1;
  min-width: 250px;
  margin-bottom: 20px;
}

.footer-column h3 {
  color: #444;
  margin-bottom: 15px;
}

.footer-column ul {
  list-style: none;
  padding: 0;
}

.footer-column ul li {
  margin-bottom: 10px;
}

.footer-column ul li a {
  color: #444;
  text-decoration: none;
}

.footer-column ul li a:hover {
  color: #444;
}

.footer-bottom {
  text-align: center;
  margin-top: 30px;
  border-top: 1px solid #FFED00;
  padding-top: 20px;
  font-size: 14px;
  color: #444;
}

@media screen and (max-width: 768px) {

  html, body {
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
  }

  .legend {
    display: none !important;
  }

  #mobileLegendContent {
    position: fixed;
    top: 0 !important;
    right: 0 !important;
    width: 320px !important;
    max-width: 85vw !important;
    height: 100vh !important;

    background: white !important;
    z-index: 99999 !important;

    overflow-y: auto !important;
    box-sizing: border-box !important;

    padding: 10px !important;
    display: none;
    
  }

  #mobileLegendContent.open {
    display: block !important;
  }

  #mobileLegendList {
    width: 100%;
    padding: 10px 15px;
    box-sizing: border-box;
  }

  .mobile-legend-species {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 14px;
  }

  .mobile-legend-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    min-width: 14px;
    border-radius: 50%;
    border: 1px solid #555;
  }

  #mobileLegendBack {
    margin: 10px;
  }

  #mobileLegendContent .menu-close-btn {
    margin-bottom: 10px;
  }

  /* Näytetään valikkopainike headerissa */
  .menu-toggle {
    display: block !important;
    position: absolute;
    top: 15px;
    right: 15px;
    background: #444;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
  }
  
  header {
     padding-right: 120px;
  }

  /* Tehdään valikosta sivusta liukuva paneeli mobiiliin */
  .menu-container {
    display: flex !important;
    flex-direction: column;
    gap: 15px;
    position: fixed !important;
    top: 0;
    right: -100% !important; /* Piilossa oletuksena oikealla */
    width: 280px !important;
    height: 100vh !important;
    background: #ffffff !important;
    box-shadow: -4px 0 15px rgba(0,0,0,0.2) !important;
    z-index: 10000 !important;
    padding: 20px !important;
    box-sizing: border-box;
    transition: right 0.3s ease;
    overflow-y: auto;
  }

  /* Kun valikolle annetaan luokka .open, se liukuu esiin */
  .menu-container.open {
    right: 0 !important;
  }

  .menu-close-btn {
    display: block !important; 
    width: 100%;
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
  }

  .mobile-legend-btn {
    display: block !important;
    width: 100%;
    background: #FFED00;
    color: black;
    border: none;
    border-radius: 20px;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
  }

  #mobileAddPlantBtn {
    display: block !important; /* Kumotaan työpöytäversion piilotus */
    width: 100%;
    background: #2d7d46;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
  }

  /* Nollataan kaikkien elementtien absolute/fixed paikat mobiilivalikon sisällä */
  #authPanel {
    display: block !important;
    position: fixed !important;
    top: 130px;
    right: 10px;
    width: 180px !important;
    box-shadow: none !important;
  }

  #authPanel .button-group {
    flex-direction: column;
    gap: 0;
    margin: 0;
  }

  #authPanel input,
  #authPanel button {
    display: block;
    width: 100% !important;
    margin-top: 4px !important;
    margin-bottom: 4px !important;
  }

  #loggedOutView {
    width: 100%;
    box-sizing: border-box;
  }

  #loggedOutView input,
  #loggedOutView button {
    box-sizing: border-box;
    width: 100%;
  }

  #loggedOutView input {
    margin-bottom: 10px;
  }

  #loggedOutView button {
    margin-bottom: 10px;
  }

  #mapSwitcher, #languageSwitcher {
    position: static !important;
    width: 100% !important;
    box-shadow: none !important;
    align-items: center;
    padding: 0 !important;
  }
  
  #map-switch-btn, #language-btn {
    width: 100%;
    justify-content: center;
    background: #f5f5f5 !important;
    border: 1px solid #ccc !important;
  }

  #mobileSearchContainer {
    display: block !important;
  }

  /* Korjaukset pääasetteluun, jotta kartta mahtuu */
  #layout {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    margin-top: 0 !important;
    padding: 0 !important;
  }

  #map {
    width: 100% !important;
    height: 600px !important;
    min-height: 600px !important;
    position: relative !important;
    z-index: 1000 !important;
  }

  #addBtn, 
  .leaflet-bar:has(#addBtn) {
    display: none !important;
  }

  #searchInput,
  .leaflet-bar:has(#searchInput) {
    display: none !important;
  }

  #mapfilterSpecies,
  .leaflet-bar:has(#mapfilterSpecies) {
    display: none !important;
  }

  #resultCount,
  .leaflet-bar:has(#resultCount) {
    display: none !important;
  }

  #speciesInfo {
    width: 100% !important;
    box-sizing: border-box !important;
    border-left: none !important;
    border-top: 1px solid #ccc !important;
    padding: 15px !important;
    position: static !important;
  }

  .flex-container {
    flex-direction: column-reverse !important;
    align-items: center !important;
    gap: 15px !important;
  }

  #yieldTimeText {
    display: none !important;
  }

  .title2 {
    margin: 15px !important;
  }

  #chart {
    width: 100% !important;
    max-width: 100% !important;
  }

  #speciesImage {
    display: block !important;
    width: 100% !important;
    max-width: 350px !important;
    margin: 0 auto !important;
  }

  .body-text {
    margin: 15px !important;
  }

  /* Popup */
  .leaflet-popup {
    width: 100vw !important;
    max-width: 100vw !important;
  }

  .leaflet-popup-content-wrapper {
    max-width: 100vw !important;
    max-width: 100vw !important;
    box-sizing: border-box;
  }

  .leaflet-popup-content {
    width: 100% !important;
    max-width: none !important;
    margin: 4px !important;
    box-sizing: border-box;
  }

  .plant-popup {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
    padding: 12px;
  }

  .popup-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .popup-images {
    width: 100%;
    flex: none;
  }

  .plant-images img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;

  .popup-text {
    width: 100%;
  }
  }

  /* Kasvilomake */
  .plant-form {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    transform: none;

    width: auto;
    max-width: none;

    max-height: calc(100vh - 20px);
    overflow-y: auto;

    box-sizing: border-box;
    padding: 15px;
  }

  /* Lomakkeen koordinaatit allekkain pienellä näytöllä */
  .coord-row {
    flex-direction: column;
    gap: 8px;
  }

  /* Painikkeet */
  .button-row {
    flex-direction: column;
  }

  .button-row button {
    width: 100%;
  }

  /* Otsikot */
  .title {
    font-size: 24px;
  }

  .title2 {
    font-size: 20px;
  }

  .body-text {
    font-size: 14px;
  }

  /* Footer */
  .footer-container {
    flex-direction: column;
  }

  .footer-column {
    min-width: 0;
    width: 100%;
  }
}