/* «Зільник» - розпізнавач рослини (identify.php). Тема: нічний ботанічний сад. */

/* атрибут hidden сильніший за display компонентів (як у app.css) */
[hidden] { display: none !important; }

.idf-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.idf-head { text-align: center; margin-bottom: 26px; }
.idf-head h1 {
  font-size: clamp(28px, 3.6vw, 36px);
  color: var(--gold-soft);
  margin-bottom: 10px;
}
.idf-lead {
  color: var(--text-dim);
  max-width: 52ch;
  margin: 0 auto;
  font-size: 15.5px;
}

/* ---- Денний ліміт розпізнавань ---- */
.idf-limit {
  margin: -8px auto 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-faint);
}
.idf-limit #idf-limit-count { color: var(--text-dim); font-weight: 600; }
.idf-limit-full { color: var(--el-fire); }
.idf-limit-full #idf-limit-count { color: var(--el-fire); }

/* ---- Гейт для гостей ---- */
.idf-gate {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 42px 24px;
  box-shadow: var(--shadow);
}
.idf-gate-icon { font-size: 40px; margin-bottom: 12px; }
.idf-gate-text { color: var(--text-dim); margin-bottom: 20px; }

/* ---- Картка завантаження ---- */
.idf-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.idf-drop {
  display: block;
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  overflow: hidden;
}
.idf-drop:hover,
.idf-drop.dragover { border-color: var(--green); background: var(--surface-2); }

.idf-drop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 240px;
  padding: 28px 20px;
  gap: 6px;
}
.idf-drop-icon { font-size: 42px; opacity: .9; }
.idf-drop-title { font-size: 17px; color: var(--text); font-weight: 600; }
.idf-drop-hint { font-size: 13px; color: var(--text-faint); }

.idf-preview { display: block; }
.idf-preview img {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  background: #000;
}

/* ---- Вибір органу рослини ---- */
.idf-organs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}
.idf-organs-label { color: var(--text-dim); font-size: 14px; font-weight: 500; }
.idf-organ-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.idf-organ {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--text-dim);
  font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: all .18s ease;
}
.idf-organ:hover { border-color: var(--green); color: var(--text); }
.idf-organ.active {
  border-color: transparent;
  background: linear-gradient(135deg, #1c6e42, #2f9d63);
  color: #f2fbf4;
}

/* ---- Дії ---- */
.idf-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}
.idf-privacy {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--text-faint);
  text-align: center;
}

/* ---- Результат ---- */
.idf-result { margin-top: 26px; }

.idf-loading {
  text-align: center;
  padding: 34px 16px;
  color: var(--text-dim);
}
.idf-spinner {
  width: 34px; height: 34px;
  margin: 0 auto 14px;
  border: 3px solid var(--line);
  border-top-color: var(--green-soft);
  border-radius: 50%;
  animation: idf-spin .9s linear infinite;
}
@keyframes idf-spin { to { transform: rotate(360deg); } }

.idf-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 20px;
  font-size: 14.5px;
}
.idf-note-icon { font-size: 22px; line-height: 1.3; }
.idf-note.ok       { background: rgba(47,157,99,.12);  border: 1px solid rgba(87,185,129,.35); color: var(--green-pale); }
.idf-note.uncertain{ background: rgba(201,169,97,.10); border: 1px solid rgba(201,169,97,.35); color: var(--gold-soft); }
.idf-note.error    { background: rgba(217,121,82,.12); border: 1px solid rgba(217,121,82,.4);  color: #ffbfa6; }
.idf-note.first    { background: rgba(47,157,99,.12);  border: 1px solid rgba(87,185,129,.35); color: var(--green-pale); }
/* Прохання підтвердити пошту й вичерпана квота сайту - обидва «зупинись і прочитай»,
   тож і колір золотий, як у «потрібно більше деталей», а не тривожний червоний. */
.idf-note.verify,
.idf-note.capped   { background: rgba(201,169,97,.10); border: 1px solid rgba(201,169,97,.35); color: var(--gold-soft); }

/* ---- «Мої знахідки» (finds.php) ---- */
.finds-count {
  margin: -8px 0 18px;
  font-size: 13.5px;
  color: var(--text-faint);
}
.finds-note { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--text-faint); }

.finds-list { display: flex; flex-direction: column; gap: 10px; }
.find-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.find-row.hit { border-color: rgba(87, 185, 129, .28); }

.find-thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.find-thumb img { width: 100%; height: 100%; object-fit: cover; }
.find-thumb-ph { font-size: 22px; opacity: .5; }

.find-body { flex: 1 1 auto; min-width: 0; }
.find-date { font-size: 12px; color: var(--text-faint); letter-spacing: .02em; }
.find-name { margin-top: 2px; font-family: var(--font-display); font-size: 20px; line-height: 1.25; }
.find-name a { color: var(--text); text-decoration: none; }
.find-name a:hover { color: var(--green-pale); }
.find-name-sci, .find-name-miss { color: var(--text-dim); font-size: 18px; }
.find-meta { margin-top: 1px; font-size: 12.5px; color: var(--text-faint); }

.find-score {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-dim);
}

.finds-empty {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 56px 24px;
}
.finds-empty-icon { font-size: 40px; opacity: .55; }
.finds-empty-text {
  margin: 14px auto 22px;
  max-width: 34em;
  font-size: 15px;
  color: var(--text-dim);
}

@media (max-width: 560px) {
  .find-name { font-size: 17px; }
  .find-thumb { width: 44px; height: 44px; }
}

/* ---- «Додати в сад» у збігу з грімуаром ---- */
.idf-match-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.idf-garden-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.idf-garden-btn:hover:not(:disabled) { border-color: var(--green); color: var(--text); }
.idf-garden-btn:disabled { opacity: .6; cursor: default; }
.idf-garden-btn.active {
  border-color: rgba(87, 185, 129, .5);
  background: rgba(47, 157, 99, .14);
  color: var(--green-pale);
}
.idf-garden-emoji { font-size: 14px; line-height: 1; }

.idf-verify-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.idf-verify-msg { font-size: 13px; color: var(--text-dim); }
.idf-verify-msg.error { color: #ffbfa6; }

/* Форма, вимкнена гейтом: сам input вимкнено в identify.php, тут - лише вигляд. */
.idf-card-off { opacity: .5; }
.idf-card-off .idf-drop { cursor: not-allowed; }

.idf-tips { margin: 8px 0 0; padding-left: 18px; color: var(--text-dim); font-size: 13.5px; }
.idf-tips li { margin: 2px 0; }

.idf-cand-title {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-faint);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

.idf-cands { display: flex; flex-direction: column; gap: 14px; }

.idf-cand {
  display: flex;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: border-color .2s;
}
.idf-cand.top { border-color: rgba(201,169,97,.45); box-shadow: 0 0 0 1px rgba(201,169,97,.15); }

.idf-cand-main { flex: 1; min-width: 0; }
.idf-cand-sci {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  color: var(--text);
  margin: 0 0 3px;
}
.idf-cand-rank {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  letter-spacing: .05em;
  color: var(--gold-soft);
  margin-right: 8px;
  vertical-align: 2px;
}
.idf-cand-common { color: var(--text-dim); font-size: 13.5px; margin-bottom: 10px; }
.idf-cand-family { color: var(--text-faint); font-size: 12.5px; }

/* смужка впевненості */
.idf-score { margin: 10px 0 12px; }
.idf-score-bar {
  height: 7px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
}
.idf-score-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--green-soft));
}
.idf-score-fill.hi { background: linear-gradient(90deg, var(--gold), var(--gold-soft)); }
.idf-score-label { font-size: 12.5px; color: var(--text-faint); margin-top: 5px; }

/* блок «в грімуарі» / «немає» */
.idf-match {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 4px;
  border: 1px solid var(--line-soft);
  background: var(--bg-deep);
}
.idf-match.hit  { border-color: rgba(87,185,129,.4); background: rgba(47,157,99,.08); }
.idf-match.dup  { display: block; border-style: dashed; color: var(--text-faint); font-size: 12.5px; }
.idf-match-thumb {
  width: 52px; height: 52px; flex: none;
  border-radius: 8px; object-fit: cover;
  background: var(--surface-2);
}
.idf-match-thumb-ph {
  width: 52px; height: 52px; flex: none;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-faint);
  font-size: 22px;
}
.idf-match-body { flex: 1; min-width: 0; }
.idf-match-name { font-weight: 600; color: var(--green-pale); }
.idf-match-name a { color: var(--green-pale); }
.idf-match-name a:hover { color: var(--gold-soft); }
.idf-match-meta { font-size: 12.5px; color: var(--text-dim); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idf-match-approx { color: var(--gold-soft); font-size: 12px; font-style: italic; }
.idf-match-miss { color: var(--text-faint); font-size: 13px; }
.idf-match-open {
  flex: none;
  font-size: 13px; font-weight: 600;
  color: var(--gold-soft);
  white-space: nowrap;
}

/* Кнопки не стискаються, тож на вузькому екрані вони з'їдають місце в назви й опису
   («схожа з грімуару» ламалась по слову на рядок). Там вони йдуть окремим рядком під текстом. */
@media (max-width: 560px) {
  .idf-match { flex-wrap: wrap; }
  .idf-match-actions { flex-basis: 100%; justify-content: flex-end; }
}

@media (max-width: 520px) {
  .idf-cand { flex-direction: column; }
  .idf-actions { flex-direction: column-reverse; }
  .idf-actions .btn { width: 100%; }
}
