html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #ffffff;
}

.h4, h4 {
    font-size: Large;
    font-weight: bolder;
}

.h4, .h5, .h6, h4, h5, h6 {
    margin-top: 10px;
    margin-bottom: 0px;
}

#map {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.leaflet-tile {
  filter: grayscale(100%);
}

.info-popup {
    white-space: nowrap;
}

/* Pakota selectize-dropdown avautumaan ylöspäin */
.dropup-select .selectize-control.single .selectize-dropdown {
  top: auto !important;
  bottom: 100% !important;
  margin-bottom: 5px;
  z-index: 9999;
}

#info-container {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.3s ease-in-out;
  max-height: 90vh;
  overflow-y: auto;
  padding-right: 6px; /* tilaa scrollbarille */
  scrollbar-width: thin;
  scrollbar-color: #aaa #f0f0f0;
}

/* WebKit-selaimille */
#info-container::-webkit-scrollbar {
  width: 8px;
}

#info-container::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

#info-container::-webkit-scrollbar-thumb {
  background-color: #aaa;
  border-radius: 4px;
  border: 2px solid #f0f0f0;
}

#info-container::-webkit-scrollbar-thumb:hover {
  background-color: #888;
}


.mode-description {
  margin: 0;
  padding: 4px 8px;
  background-color: #f5f5f5;
  border-left: 3px solid #ccc;
  font-size: 0.9em;
}

.close-button {
  padding: 6px 6px; /* pienempi ylä/ala- ja sivupadding */
  font-size: 12px;  /* halutessasi pienempi fontti */
  line-height: 1;
  background-color: transparent;
  border: none;
  cursor: pointer;
}

.project-text {
    margin: 0px;
}

.last-updated-panel {
    position: absolute;
    bottom: 100px;
    right: 70px;
    max-width: 275px;
    z-index: 5000;
    background-color: white;
    margin: 5px;
    padding: 10px;
    border-radius: 3px 15px;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
}

.last-updated-panel p {
    margin: 0;
}

.shiny-date-input .form-control {
  font-family: monospace;
}

.date-range-inline {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.form-group {
    margin-bottom: 0px;
    margin-top: -13px;
}


#options-panel {
    position: absolute;
    bottom: 20px;
    right: 75px; 
    max-width: 275px; 
    z-index: 5000;
    background-color: white;
    margin: 5px;
    padding: 10px;
    border-radius: 3px 15px;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);
    overflow-y: visible;
    max-height: none;
}

.irs-grid-pol.small {
  height: 0px;
}

.irs--shiny .irs-bar {
    top: 25px;
    height: 8px;
    border-top: 1px solid #697886;
    border-bottom: 1px solid #697886;
    background: #697886;
    cursor: s-resize;
    z-index: 2;
}

.irs--shiny .irs-handle {
    top: 17px;
    width: 22px;
    height: 22px;
    border: 1px solid #444444;
    background-color: #444444;
    box-shadow: 1px 1px 3px rgba(255, 255, 255, 0.3);
    border-radius: 7px;
    z-index: 2;
}

.irs--shiny .irs-from, .irs--shiny .irs-to, .irs--shiny .irs-single {
    color: #000000;
    text-shadow: none;
    padding: 1px 3px;
    background-color: #ffffff;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.333;
}

.irs--shiny .irs-min, .irs--shiny .irs-max {
    top: 0;
    padding: 1px 3px;
    text-shadow: none;
    background-color: rgb(255 255 255 / 10%);
    border-radius: 3px;
    font-size: 11px;
    line-height: 1.333;
}

.irs-grid-text {
    position: absolute;
    bottom: 0;
    left: 0;
    white-space: nowrap;
    text-align: center;
    font-size: 11px;
    line-height: 7px;
    padding: 0 1px;
}

.form-group {
    margin-bottom: 0px;
}

/*
.year-select-inline {
  display: flex;
  align-items: center;
  height: 40px;
  gap: 10px;
}

.dropup-select {
  display: flex;
  align-items: center;
  padding-top: 12px;
}


.year-select-inline label {
  margin: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.year-select-inline .selectize-control {
  min-width: 80px;
  max-width: 80px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.year-select-inline .selectize-input input {
  align-items: center;
  margin: 0 !important;
  padding: 0 !important;
  height: auto;
}

.year-select-inline .selectize-input {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 2px 6px !important;
  margin: 0 !important;
  height: 100% !important;
  line-height: 1.2;
  box-sizing: border-box;
  width: auto !important;
  max-width: 80px;
}

.year-select-inline .selectize-control.single {
  height: 100%;
  display: flex;
  align-items: center;
}

.year-select-inline .selectize-control.single .selectize-input:after {
  display: none !important;
}

.year-select-inline .selectize-input .item {
  display: flex;
  align-items: center;
  height: 100%;
}

.year-select-inline .selectize-control.single .selectize-input > .item {
  display: flex;
  align-items: center;
}

.selectize-dropdown-content {
  max-height: none !important;
  max-width: 80px;
}
*/



#show-gantt, #info-button, #toggle-project-info-button, #select-all-button, #select-none-button {
    z-index: 5000;
    background-color: white;
    margin: 2px;
    padding: 7px;
    border-radius: 3px 15px;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);
    border-style: none;
    cursor: pointer;
    transition: 0.2s all ease;
}

#show-gantt:hover, #info-button:hover, #toggle-project-info-button:hover, #select-all-button:hover, #select-none-button:hover {
    background-color: rgb(230, 230, 230);
    transform: translateY(-2px);
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4);
}


#show-gantt:active, #info-button:active, #toggle-project-info-button:active, #select-all-button:active, #select-none-button:active {
    transform: translateY(1px);
    box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);
}

#general-info-panel {
  position: absolute;
  top: 10px;
  right: 15px;
  max-width: 450px;
  max-height: 70vh;
  padding: 16px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.5;
  z-index: 5000;
}

@media only screen and (max-width: 768px) {
  #general-info-panel {
    max-width: 90vw;
    max-height: 60vh;
    font-size: 13px;
  }
}

#year-select-div {
    margin: 5px;
    text-align: center;
}

#project-info-panel {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 5000;
    background-color: rgba(255, 255, 255, 0);
    margin: 0px;
    /* padding: 10px; */
    border-radius: 3px 15px;
    /* box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4); */
    overflow-y: auto;
    max-height: 95%;
}

.project-info-card {
  background-color: white;
  margin: 5px;
  padding: 10px;
  padding-bottom: 5px;
  width: auto; /* tämä sallii kortin kasvaa sisällön mukaan */
  max-width: 400px;
  min-width: 300px; /* estää litistymisen */
  border-radius: 3px 15px;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  overflow: hidden;
  flex-shrink: 0; /* estää kutistumisen flex-kontekstissa */
}


.project-info-card.animate-in {
  animation: fadeAndSlideInFromLeft 0.3s ease;
}

.project-info-card.card-exit-animation {
  animation: fadeAndSlideOutToLeft 0.3s forwards;
}


@media only screen and (max-width: 1400px) {
    .project-info-card {
        max-width: 250px;
    }

    #general-info-panel {
        max-width: 450px;
    }
}

.info-card-content {
  margin-top: 5px;
  margin-bottom: 5px;
  /* ei reunaa tai varjostusta */
}


.info-card-content > div:first-child {
  display: flex !important;
  gap: 5px !important;
  flex-wrap: wrap !important;
  width: 100% !important;
}

.info-card-content > div:last-child {
  width: 100% !important;
  margin-top: 5px !important;
}

.icon-button {
  margin: 5px;
  padding: 6px;
  width: 40px;
  height: 40px;
  border-style: none;
  border-radius: 25%;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);
  background-color: white;
  color: black;
  cursor: pointer;
  transition: 0.2s all ease;
}

.icon-button:hover {
  color: #e6e6e6;
  transform: translateY(-2px);
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.4);
}

.icon-button:active {
  transform: translateY(1px);
  box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);
}


.icon-button {
    transition-duration: 0.4s;
    font-size: 24px;
  }
  

.info-header {
    font-size: large;
}

.red {
    background-color: #F45957;
}

.orange {
    background-color: #f4a357;
}

.yellow {
    background-color: #FFDF82;
}

.lightgreen {
    background-color: #4df07e;
}

.green {
    background-color: #5ec27c;
}

.grey {
    background-color: #98AFBA;
}

#chart_div, #timeline-div{
    display: block;
    width: 90%;
    margin: auto;
    /* margin: 5px; */
    margin-top: 20px;
    padding: 10px;
    z-index: 5000;
    background-color: rgb(255, 255, 255);
    border-radius: 3px 15px;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);
}

#to-page-top {
    margin: auto;
    margin-top: 10px;
    width: 75px;
    padding: 5px;
    border-radius: 3px 15px;
    background-color: rgb(255, 255, 255);
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);
}

#to-page-top:hover {
    background-color: rgb(230, 230, 230);
}

#to-page-top-button {
    border-style: none;
    margin: auto;
    background-color: rgba(255, 255, 255, 0);
    width: 75px;
    cursor: pointer;
}

/* Scale slider stuff */
.scale-slider-container {
    margin: 10px;
}

#scale-slider-label {
    text-align: center;
}

#scale-slider {
    width: 100%;
}

#scale-slider-count {
    text-align: center;
    display: none;
}

/* Scrollbar stuff */
/* width */
::-webkit-scrollbar {
    width: 10px;
}

/* Track */
::-webkit-scrollbar-track {
    background: #3d3d3d50;
}

/* Handle */
::-webkit-scrollbar-thumb {
    background: rgb(255, 255, 255);
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
    background: rgb(201, 201, 201);
}

.hideEl {
    visibility: hidden;
}

.btn-toggled {
    background-color: rgb(128, 128, 128) !important;
    color:rgb(255, 255, 255);
}

#time-buttons {
    margin-top: 5px;
    text-align: center;
}

.time-btn {
    margin: 6px 2px 2px 2px;
    width: 45px;
}

.start-time-input {
    float: left;
    margin: 0px 3px 3px 0px;
}

.end-time-input {
    float: right;
    margin: 0px 0px 3px 3px;
}

.leaflet-bottom.leaflet-right .leaflet-control-zoom {
  position: absolute !important;
  bottom: 20px;
  right: 15px;
  left: auto !important;
  top: auto !important;
  z-index: 5000;
}


.leaflet-control-zoom {
  background-color: white;
  border: 1px solid black;
}

/* --- Nappulat yhteen pysty-sarakkeeseen --- */
#bottom-right-ui {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: nowrap;               /* ei rivinvaihtoja */
}

/*#function-buttons {
    position: absolute;
    right: 360px;
    bottom: 20px;
    z-index: 5000;
}

#function-buttons .icon-button,
#function-buttons .btn {
  display: block;
  white-space: nowrap;
}*/

#info-button-container {
    position: absolute;
    top: 10px;
    right: 70px;  /* layer-valikon vasemmalle puolelle */
    z-index: 400;
}

#info-button-container .icon-button {
    margin: 0;
}

#function-buttons {
    position: absolute;
    right: 360px;
    bottom: 20px;
    z-index: 5000;
    display: flex;
    flex-direction: column !important;
    align-items: flex-end;
    gap: 8px;
    margin-right: 10px;
}

#function-buttons .button-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

#function-buttons h5 {
    font-weight: bold;
    margin: 0 0 5px 0;
    font-size: 14px;
    text-align: left;
}

#selection-buttons {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    position: absolute;
    bottom: 150px;  /* vuosivalitsimen yläpuolella */
    right: 25px;    /* samassa linjassa vuosivalitsimen kanssa */
    z-index: 5000;
}

#selection-buttons .btn {
  font-weight: bold;
  display: block;
  white-space: nowrap;
}

/* --- Varoituskontti legendin malliin --- */
#ip3-warning {
  position: absolute !important;
  z-index: 6000 !important;    /* nappien (5000) yli */
  pointer-events: none;        /* ei varjosta klikkejä */
}

/* Yläpuolelle: nappien + paneelin kokonaiskorkeus huomioitu */
#ip3-warning.pos-above {
  left: 20px !important;
  bottom: calc(20px + var(--br-height, 0px) + 10px) !important;
}

/* Vaihtoehtoinen sijainti vasemmalle (jos joskus vaihdat) */
#ip3-warning.pos-left {
  bottom: 30px !important;
  right: calc(var(--br-offset, 0px) + 10px) !important;
}

#ip3-warning.pos-bottomleft {
  position: absolute !important;
  left: 20px !important;
  bottom: 20px !important;
  z-index: 6000 !important;
  pointer-events: none;
}

/* Animations */
@keyframes fadeAndSlideInFromLeft {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeAndSlideOutToLeft {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(-100%);
    opacity: 0;
  }
}

/* Pakota vain kuvaukset nappuloiden alle, ei nappuloita itseään */
.info-card-content > div:last-child {
  width: 100% !important;
  margin-top: 5px !important;
  clear: both !important;
}

/* Varmista että nappulat pysyvät rivissä */
.info-card-content > div:first-child {
  display: flex !important;
  gap: 5px !important;
  flex-wrap: wrap !important;
  width: 100% !important;
}


/* Värilegendi korttien yläpuolelle */
#severity-legend {
  background: rgba(255, 255, 255, 0.95);
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  margin-bottom: 5px;
  border: 1px solid rgba(0,0,0,0.1);
}

#severity-legend h5 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid #ccc;
  flex-shrink: 0;
}

.legend-color.green { background-color: #5ec27c; }
.legend-color.yellow { background-color: #FFDF82; }
.legend-color.orange { background-color: #f4a357; }
.legend-color.red { background-color: #F45957; }
.legend-color.grey { background-color: #98AFBA; }

/* Korttien container - rullattava alue legendin alla */
#cards-container {
  max-height: calc(90vh - 80px);
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #aaa #f0f0f0;
}

#cards-container::-webkit-scrollbar {
  width: 8px;
}

#cards-container::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

#cards-container::-webkit-scrollbar-thumb {
  background-color: #aaa;
  border-radius: 4px;
  border: 2px solid #f0f0f0;
}

#cards-container::-webkit-scrollbar-thumb:hover {
  background-color: #888;
}
