/* MeteoLab SK — Agro modul UI */
.agri-body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

.agri-top {
  display: flex; align-items: center; gap: 12px;
  padding: 10px clamp(12px, 3vw, 24px);
  background: linear-gradient(180deg, #ffffff 0%, #f4faf4 100%);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.agri-top h1 { font-family: var(--font-display); font-size: 1.12rem; font-weight: 700; letter-spacing: -.02em; }
.agri-top h1 em { font-style: normal; color: #2e7d32; }
.agri-top .sub { font-size: .68rem; color: var(--ink-soft); }
.agri-top .spacer { flex: 1; }

.agri-main { display: flex; flex: 1; min-height: 0; }
#agriMap { flex: 1; min-width: 0; background: #dfe9f2; position: relative; }

.agri-side {
  width: 460px; flex: 0 0 auto; border-left: 1px solid var(--line);
  background: var(--card); overflow-y: auto; padding: 14px 16px 26px;
}

.agri-h { font-family: var(--font-display); font-size: .85rem; font-weight: 700; margin: 16px 0 8px; }
.agri-h:first-child { margin-top: 0; }

.btn {
  font-family: var(--font-display); font-size: .74rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px;
  background: var(--paper); color: var(--ink); cursor: pointer; touch-action: manipulation;
}
.btn:hover { border-color: var(--azure); }
.btn.primary { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.btn.primary:hover { background: #256a29; }
.btn.danger { color: #c62828; }
.btn.small { padding: 6px 10px; font-size: .66rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.form-grid label { font-size: .68rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: 3px; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input, .form-grid select {
  font-family: var(--font-body); font-size: 16px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; min-height: 40px;
}

.field-list { display: flex; flex-direction: column; gap: 6px; }
.field-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  background: var(--paper); cursor: pointer; font-size: .78rem;
}
.field-item:hover { border-color: #2e7d32; }
.field-item b { font-family: var(--font-display); }
.field-item .meta { color: var(--ink-soft); font-size: .68rem; }
.field-item .spacer { flex: 1; }

.dash-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 10px;
}
.dash-head h2 { font-family: var(--font-display); font-size: 1.05rem; }
.dash-head .meta { font-size: .68rem; color: var(--ink-soft); }

.conf-badge {
  font-family: var(--font-display); font-size: .62rem; font-weight: 700;
  border-radius: 999px; padding: 4px 9px; white-space: nowrap;
}
.conf-vysoká { background: #d9f2e3; color: #1b5e20; }
.conf-stredná { background: #fdeeca; color: #8a5a00; }
.conf-nízka { background: #fbd9c9; color: #99330a; }
.conf-nedostatočné\ dáta, .conf-nd { background: #eee; color: #666; }

.agri-cards { display: flex; flex-direction: column; gap: 10px; }
.acard {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px 10px;
  background: #fff; position: relative; overflow: hidden;
}
.acard::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--line); }
.acard.ok::before { background: linear-gradient(90deg, #66bb6a, #2e7d32); }
.acard.warn::before { background: linear-gradient(90deg, #f0e641, #f59e0b); }
.acard.bad::before { background: linear-gradient(90deg, #ff7043, #c62828); }
.acard.info::before { background: linear-gradient(90deg, #2fb6e8, #1467c8); }
.acard h3 { font-family: var(--font-display); font-size: .84rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.acard h3 .st { font-size: .62rem; font-weight: 700; border-radius: 999px; padding: 3px 8px; }
.st.vhodné { background: #d9f2e3; color: #1b5e20; }
.st.prijateľné { background: #fdeeca; color: #8a5a00; }
.st.nevhodné { background: #fbd9c9; color: #99330a; }
.st.nd { background: #eee; color: #666; }
.acard .big { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; margin: 4px 0 2px; }
.acard p { font-size: .74rem; color: var(--ink-soft); line-height: 1.5; }
.acard details { margin-top: 8px; font-size: .7rem; }
.acard details summary {
  cursor: pointer; font-family: var(--font-display); font-weight: 600;
  color: var(--azure); font-size: .68rem; list-style: none;
}
.acard details summary::before { content: '❔ '; }
.acard details .why {
  background: var(--paper); border: 1px dashed var(--line); border-radius: 8px;
  padding: 8px 10px; margin-top: 6px; color: var(--ink-soft); line-height: 1.55;
}
.acard details .why ul { margin: 4px 0 4px 16px; }
.acard details .why .src { font-size: .62rem; margin-top: 6px; }

.wtype-bar { display: flex; gap: 5px; flex-wrap: wrap; margin: 6px 0; }
.wtype {
  font-family: var(--font-display); font-size: .64rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px;
  background: var(--paper); cursor: pointer;
}
.wtype.is-active { background: var(--azure); border-color: var(--azure); color: #fff; }

.strip { display: flex; gap: 1px; margin: 8px 0 2px; }
.strip i {
  flex: 1; height: 16px; border-radius: 2px; background: #eee; min-width: 2px;
}
.strip i.s-ok { background: #66bb6a; }
.strip i.s-warn { background: #f0c541; }
.strip i.s-bad { background: #ef7060; }
.strip-legend { font-size: .6rem; color: var(--ink-soft); display: flex; gap: 10px; }
.strip-legend .dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 3px; vertical-align: middle; }

.chart-box { position: relative; height: 200px; margin-top: 6px; }

.irr-list { font-size: .72rem; }
.irr-list li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }

.agri-note {
  font-size: .68rem; color: var(--ink-soft); line-height: 1.55;
  background: #fdf3e3; border: 1px solid #f3ddb0; border-radius: 10px;
  padding: 9px 11px; margin-top: 10px;
}
.agri-src { font-size: .62rem; color: var(--ink-soft); margin-top: 12px; line-height: 1.55; }
.agri-src a { color: var(--azure); }

.draw-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(14,34,51,.86); color: #fff; font-size: .74rem;
  padding: 8px 14px; border-radius: 999px; z-index: 1000; pointer-events: none;
  max-width: 92%; text-align: center;
}
.draw-tools {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 1000; display: flex; gap: 8px; background: rgba(255,255,255,.94);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px;
  box-shadow: var(--shadow);
}
.is-hidden { display: none !important; }

.err-list { color: #c62828; font-size: .72rem; margin: 6px 0; }

@media (max-width: 900px) {
  .agri-main { flex-direction: column; }
  #agriMap { flex: 0 0 42dvh; }
  .agri-side { width: 100%; border-left: 0; border-top: 1px solid var(--line); flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Ukážkové pole — pulz pri štarte */
.demo-field { animation: demoPulse 2.2s ease-in-out infinite; }
@keyframes demoPulse {
  0%,100% { fill-opacity: .18; stroke-opacity: .9; }
  50% { fill-opacity: .42; stroke-opacity: 1; }
}
.demo-label {
  font-family: var(--font-display); font-weight: 700; font-size: .72rem;
  color: #1b5e20; background: rgba(255,255,255,.94);
  border: 2px solid #2e7d32; border-radius: 999px; padding: 6px 12px;
  white-space: nowrap; transform: translate(-50%, -50%);
  box-shadow: 0 4px 14px rgba(27,94,32,.3); cursor: pointer;
}
@media (prefers-reduced-motion: reduce) { .demo-field { animation: none; } }

/* Tlač reportu poľa */
@media print {
  .agri-top .btn, .agri-top .back-link, #agriMap, .btn-row, .strip, .strip-legend,
  .chart-box, .irr-list button, .form-grid, #irrAdd { display: none !important; }
  .agri-body { height: auto; overflow: visible; }
  .agri-main { display: block; }
  .agri-side { width: 100%; border: 0; padding: 0; overflow: visible; }
  .acard { break-inside: avoid; border: 1px solid #ccc; }
  .acard details { display: block; }
  .acard details .why { display: block; }
  body::after {
    content: 'Report vygeneroval MeteoLab SK (meteolab.sk) — meteorologická vhodnosť podmienok, nie agronomické rozhodnutie. Zdroje: Open-Meteo (CC BY 4.0), ERA5 © ECMWF/Copernicus.';
    display: block; font-size: 9px; color: #666; margin-top: 14px;
  }
}

/* Vyhľadávanie v agro hlavičke + editačné body kreslenia */
.agri-search { flex: 0 1 230px; min-width: 160px; }
.vtx {
  width: 16px; height: 16px; border-radius: 50%;
  background: #2e7d32; border: 3px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.4);
  cursor: grab; transform: translate(-50%, -50%);
}
.vtx:active { cursor: grabbing; }
.vtx-mid {
  width: 12px; height: 12px; border-radius: 50%;
  background: rgba(255,255,255,.85); border: 2px solid #2e7d32;
  opacity: .75; cursor: copy; transform: translate(-50%, -50%);
}
.vtx-mid:hover { opacity: 1; }
@media (max-width: 900px) {
  .agri-search { flex: 1 1 100%; order: 6; }
}


/* ---------- Ovládanie mapy: plávajúci klaster na mape (vzor mapových appiek) ---------- */
.ag-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }

.map-ctl {
  position: absolute; top: 12px; right: 12px; z-index: 1000;
  display: flex; flex-direction: column; gap: 7px;
}
.map-ctl button {
  width: 44px; height: 44px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 1.15rem; line-height: 1; cursor: pointer;
  box-shadow: 0 3px 10px rgba(14, 34, 51, .18);
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .1s, background .15s, color .15s;
}
.map-ctl button:hover { transform: scale(1.05); }
.map-ctl button:active { transform: scale(.96); }
.map-ctl button.is-on {
  background: var(--azure); border-color: var(--azure); color: #fff;
  box-shadow: 0 3px 12px rgba(20, 103, 200, .45);
}
[data-theme="dark"] .map-ctl button { box-shadow: 0 3px 10px rgba(0, 0, 0, .45); }

@media (max-width: 700px) {
  .map-ctl { top: 10px; right: 10px; gap: 6px; }
  .map-ctl button { width: 42px; height: 42px; }
  .agri-top .sub { display: none; } /* na mobile stačí titulok — menej tlačenice */
}
