html, body {
  height: 100%;
  margin: 0;
}

/* Kartta */
#map {
  height: 90vh;
  width: 100%;
}

/* Yläpalkin kontrollit */
#controls {
  padding: 10px;
  background: #f0f0f0;
}

button {
  margin-right: 10px;
}

/* Kamerapainike */
#kameraBtn {
  background: #16a34a;      /* vihreä */
  color: white;

  border: none;
  border-radius: 10px;

  padding: 8px 14px;

  font-size: 18px;          /* isompi kamera */
  line-height: 1;

  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

#kameraBtn:hover {
  background: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.3);
}

#kameraBtn:active {
  transform: translateY(0);
}
#kameraBtn i {
  font-size: 22px;
}

/* Kaikki palstat -painike */
#kaikkiKuvatBtn {
  padding: 6px 12px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

#kaikkiKuvatBtn i {font-size: 16px;
}

/* Kiinteistötunnus-labelit */
/* Kiinteistötunnus-labelit */
.ktunnus-label .ktunnus-box {
  display: inline-block;
  font-size: 14px;
  font-weight: bold;
  background: white;
  border: 2px solid #333;
  border-radius: 6px;
  padding: 6px 10px;
  min-width: 160px;
  text-align: left;

  color: black;
  white-space: nowrap;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.25);

  transition: font-size 0.2s;   /* 🔹 tekee zoomista pehmeän */
  transform: scale(var(--label-scale, 1));
  transform-origin: center center;
  will-change: transform;
}


/* Area labelit */
.area-tooltip {
  background: white;
  border: 2px solid #000;
  color: #111;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
}

.area-label {
  background: white;
  border: 2px solid #000;
  border-radius: 6px;
  padding: 6px 10px;
  min-width: 70px;
  text-align: center;
  font-family: sans-serif;
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.3);
}

/* ===== Moderni liukupalkki ===== */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 6px;
  background: linear-gradient(
    to right,
    #1976d2 0%,
    #1976d2 50%,
    #ddd 50%,
    #ddd 100%
  );
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

/* Chrome / Edge */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border: 2px solid #1976d2;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Firefox */
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #ffffff;
  border: 2px solid #1976d2;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
/* --- Yleinen ulkoasu yläpalkille --- */
#controls{
  padding: 10px 12px;
  background: #f6f7f9;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* --- Painikkeet --- */
#controls button{
  appearance: none;
  border: 1px solid rgba(0,0,0,0.12);
  background: #ffffff;
  color: #111;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  transition: transform .08s ease, box-shadow .12s ease, background .12s ease;
}

#controls button:hover{
  background: #fbfbfc;
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}

#controls button:active{
  transform: translateY(0px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* --- “Päätoiminto” (Hae kiinteistöt) --- */
#controls button.primary{
  background: #0f5bd6;
  border-color: rgba(0,0,0,0.0);
  color: #fff;
}

#controls button.primary:hover{
  background: #0d52c3;
}

/* --- “Vaara / poisto” (Poista mittaukset) --- */
#controls button.danger{
  background: #fff;
  border-color: rgba(220,38,38,0.35);
  color: #b91c1c;
}

#controls button.safe{
  background: #fff;
  border-color: rgba(21,128,61,0.35); /* ✅ vihreä */
  color: #15803d;
}


#controls button.danger:hover{
  background: rgba(220,38,38,0.06);
}

/* --- Input-kenttä siistiksi --- */
#controls input[type="text"]{
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.14);
  background: #fff;
  font-size: 14px;
  outline: none;
}

#controls input[type="text"]:focus{
  border-color: rgba(15,91,214,0.55);
  box-shadow: 0 0 0 3px rgba(15,91,214,0.15);
}
#kameraBtn{
  background:#16a34a;     /* ✅ vihreä */
  color:#fff;
  border:none;
  border-radius: 10px;

  padding: 8px 14px;
  font-size: 18px;
  line-height: 1;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#kameraBtn:hover{
  background:#15803d;     /* ✅ tummempi hover */
  box-shadow: 0 6px 14px rgba(0,0,0,0.30);
  transform: translateY(-1px);
}

#kameraBtn:active{
  transform: translateY(0);
}

#kameraBtn i{
  font-size: 22px;
}

#controls .break{
  flex-basis: 100%;
  width: 100%;
  height: 0;
}
#branding {
  position: absolute;
  bottom: 30px;
  right: 12px;
  

  z-index: 1000;
  background: rgba(255,255,255,0.9);
  padding: 6px 16px;
  border-radius: 12px;

  font-family: "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;

  color: #555;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.25);
  pointer-events: none;
}

#branding span {
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #222;
}
/* Tietosuojaselosta */
#tietosuojaBtn {
  position: absolute;
  bottom: 25px;
  left: 12px;        /* vasen alakulma */

  z-index: 1000;
}

#tietosuojaBtn button {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 12px;
  padding: 6px 12px;

  font-family: "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;

  box-shadow: 2px 2px 8px rgba(0,0,0,0.25);
}

#tietosuojaBtn button:hover {
  background: #fff;
}

/* ===== COMPACT TOOLBAR (lisää tiedoston loppuun) ===== */
#controls{
  padding: 6px 8px;     /* pienempi yläpalkki */
  gap: 6px;             /* pienemmät välit */
}

#controls button,
#kameraBtn{
  font-size: 12px;      /* pienempi teksti */
  padding: 5px 8px;     /* pienempi nappi */
  border-radius: 8px;
  line-height: 1;
  margin-right: 0;      /* poistaa vanhan button margin-right 10px vaikutuksen */
}

#controls input[type="text"]{
  height: 30px;
  font-size: 12px;
  padding: 0 8px;
  border-radius: 8px;
  min-width: 160px;     /* säädä pienemmäksi jos haluat */
  flex: 1 1 220px;      /* antaa inputin venyä ja ottaa tilaa */
}

input[type="range"]{
  width: 90px;          /* sliderit kapeammaksi */
  height: 5px;
}

input[type="range"]::-webkit-slider-thumb,
input[type="range"]::-moz-range-thumb{
  width: 14px;
  height: 14px;         /* pienempi “nuppi” */
}

/* jos haluat että nappien teksti ei koskaan katkea kahdelle riville */
#controls button{
  white-space: nowrap;
}

/* Karttaraportti
/* Kartta */
#map {
  height: 90vh;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Raporttipaneeli kartan päälle */
#raportti {
  position: fixed;
  top: 160px;
  left: 12px;

  width: 450px;        /* perusleveys */
  max-width: 70vw;     /* ei koskaan liian leveä */
  min-width: 420px;    /* ei kutistu liikaa */

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

  background: rgba(255,255,255,0.95);
  border: 2px solid #ccc;
  border-radius: 6px;

  padding: 10px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;

  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 2000;
  display: none;
}
#raportti div:first-child {
  font-weight: 700;
  margin-bottom: 6px;
}

/* pakota skaalaus kaikkiin label-bokseihin */
.ktunnus-box {
  transform: scale(var(--label-scale, 1)) !important;
  transform-origin: center center;
  display: inline-block;
}
/* Kamera painike (pakotetaan vihreäksi) */
#controls #kameraBtn{
  background: #1e6bd6 !important;
  color: #ffffff !important;

  font-size: 18px;
  padding: 8px 14px;
  min-width: 100px;   /* ← lisää leveyttä */

  border: none;
  border-radius: 10px;

  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

#controls #kameraBtn:hover{
  background: #1558b0 !important;
}

#controls #kameraBtn i{
  font-size: 16px;
  color: white;
}
#controls #tunnukset{
  min-width: 160px !important;
  width: 180px !important;
  flex: 0 0 900px !important;
}
.pelto-label {
  min-width: 160px;
  text-align: center;

  background: #ffeb3b;
  border: 2px solid #000;
  color: #000;

  font-weight: 700;
  white-space: nowrap;
  transform: scale(var(--label-scale, 1));
  transform-origin: center center;

  display: inline-block;
}

.raportti-summa {
  font-size: 15px;
  font-weight: 700;
  margin-top: 8px;
}

#karttaWrapper {
  position: relative;
  width: 100%;
  height: 90vh;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

#raportti {
  position: absolute;
  top: 160px;
  left: 12px;
  width: 320px;
  max-height: 65vh;
  overflow-y: auto;
  background: rgba(255,255,255,0.95);
  border: 2px solid #ccc;
  border-radius: 6px;
  padding: 10px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 2000;
  display: none;
}