@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  margin: 0; padding: 0;
  min-height: 100vh;
  background: url('bg.webp') center/cover no-repeat fixed;
  display: flex; align-items: flex-start; justify-content: center;
}

body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  backdrop-filter: none;
  background: rgba(0,0,0,0.1);
  z-index: 0;
}

.container-fluid {
  position: relative; z-index: 1;
  max-width: 700px; width: 100%;
  margin: 60px auto; padding: 0;
}

/* Loading overlay */
.app-loading-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #adbcaa, #8a9f85);
  transition: opacity 0.4s ease;
}
.app-loading-overlay.app-loading-hidden {
  opacity: 0; pointer-events: none;
}
.app-loading-paws { display: flex; gap: 14px; }
.app-loading-paws span {
  font-size: 32px;
  opacity: 0.25;
  animation: app-paw-step 1.2s ease-in-out infinite;
}
.app-loading-paws span:nth-child(1) { animation-delay: 0s; }
.app-loading-paws span:nth-child(2) { animation-delay: 0.15s; }
.app-loading-paws span:nth-child(3) { animation-delay: 0.3s; }
.app-loading-paws span:nth-child(4) { animation-delay: 0.45s; }
@keyframes app-paw-step {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-10px); }
}

/* Header */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; padding: 0 4px;
}
/* desktop: recreate the original "logo beside a stacked text column" look,
   even though title/subtitle/meta are now separate siblings in the markup
   (split out so mobile can regroup them independently — see media query) */
.app-header-left {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "logo title" "logo subtitle" "logo meta";
  align-items: center;
  column-gap: 16px;
}
.app-header-top { display: contents; }
.app-logo {
  grid-area: logo;
  width: 100px; height: 100px;
  background: #8a9f85; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: white; flex-shrink: 0;
}
.app-title { grid-area: title; font-size: 30px; font-weight: 700; color: #fff; }
.app-subtitle { grid-area: subtitle; font-size: 19px; color: rgba(255,255,255,0.8); margin-top: 4px; }
.header-meta { grid-area: meta; margin-top: 4px; display: flex; flex-direction: column; gap: 1px; }
.header-source-link { font-size: 13px; color: rgba(255,255,255,0.7); text-decoration: underline; }
.header-updated { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; }

/* Lang switcher */
.lang-switch {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}
.lang-switch .lang-btn {
  position: relative; width: 48px; height: 48px;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 10px; overflow: hidden;
  background: rgba(255,255,255,0.1); color: #fff;
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all 0.2s; display: flex; align-items: center; justify-content: center;
}
.lang-switch .lang-btn::before {
  content: attr(data-flag);
  position: absolute; font-size: 36px;
  filter: blur(3px); opacity: 0.45;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  pointer-events: none;
}
.lang-switch .lang-btn span { position: relative; z-index: 1; }
.lang-switch .lang-btn.active {
  border-color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.25);
}
.lang-switch .lang-btn.active::before { opacity: 0.6; filter: blur(1px); }
.lang-switch .lang-btn:hover { background: rgba(255,255,255,0.2); }

/* Card */
.card {
  background: rgba(255,255,255,0.95);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  padding: 28px 28px 24px;
}

/* Search input */
.form-group { width: 100% !important; }
.selectize-control { margin-bottom: 16px; width: 100% !important; }
.selectize-control .selectize-input {
  border: 1px solid #ddd !important; border-radius: 10px !important;
  padding: 10px 14px !important; font-size: 15px !important;
  box-shadow: none !important; min-height: 44px !important;
}
.selectize-input.focus { border-color: #8a9f85 !important; }
.add-all-option {
  font-weight: 600; color: #2f5233;
  border-bottom: 1px solid #eee;
}

/* Magic button */
.magic-section {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
  justify-content: center; margin-top: 16px; margin-bottom: 4px;
}
.btn-magic {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.5); border-radius: 10px;
  color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn-magic:hover { background: #8a9f85; color: white; }
.magic-animals { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.magic-animal-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 20px; font-size: 13px;
  border: 1.5px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.magic-animal-toggle.active {
  border-color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.2); color: #fff;
}
.magic-for-label { font-size: 12px; color: rgba(255,255,255,0.6); white-space: nowrap; }

/* Check button */
.btn-check-bouquet {
  width: 100%; padding: 12px;
  background: #8a9f85; color: white; border: none;
  border-radius: 10px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
  margin-bottom: 20px;
}
.results-section { margin-top: 0; }
.btn-check-bouquet:hover { background: #718372; }
.check-row { display: flex; gap: 8px; margin-bottom: 20px; }
.check-row .btn-check-bouquet { flex: 1; margin-bottom: 0; }
.btn-clear {
  padding: 12px 16px; white-space: nowrap;
  background: none; color: #999; border: 1px solid #ddd;
  border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.btn-clear:hover { background: #f5f5f5; color: #666; border-color: #ccc; }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: #2c3e50; color: #fff;
  font-size: 11px; font-weight: 400; white-space: nowrap;
  padding: 5px 9px; border-radius: 6px;
  pointer-events: none; opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
}
[data-tooltip]:hover::after { opacity: 1; }
.verdict-info { font-size: 10px; margin-left: 3px; opacity: 0.6; }

/* Column header highlights */
.th-dangerous    { background: #f5e8e6; color: #9e6060 !important; border-radius: 6px; }
.th-questionable { background: #f5f0e6; color: #8a7040 !important; border-radius: 6px; }
.th-unknown      { background: #f4f4f4; color: #888 !important; border-radius: 6px; }
.th-safe         { background: #e8f0e8; color: #5a7a5a !important; border-radius: 6px; }

/* Alert banner */
.alert-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 600; margin-bottom: 16px;
}
.alert-dangerous { background: #f5e8e6; color: #9e6060; }
.alert-safe      { background: #e8f0e8; color: #5a7a5a; }
.alert-questionable { background: #f5f0e6; color: #8a7040; }

/* Results */
.table-wrapper {
  border: 1px solid #eee; border-radius: 12px;
  overflow: hidden; margin-top: 4px;
}
.result-table { width: 100%; border-collapse: collapse; }
.result-table thead { background: #f8f9fa; }
.result-table th {
  padding: 10px 12px; text-align: center;
  font-size: 11px; font-weight: 700; color: #999;
  letter-spacing: 0.05em; text-transform: uppercase;
  border-bottom: 1px solid #eee;
}
.result-table th:first-child { text-align: left; }
.result-table td {
  padding: 8px 12px; border-bottom: 1px solid #f4f4f4;
  font-size: 14px; vertical-align: middle;
}
.result-table tbody tr:last-child td { border-bottom: none; }

/* Verdict pills */
.verdict-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.verdict-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.verdict-dangerous { background: #f5e8e6; color: #9e6060; }
.verdict-dangerous .verdict-dot { background: #c49090; }
.verdict-safe      { background: #e8f0e8; color: #5a7a5a; }
.verdict-safe .verdict-dot      { background: #8aaa85; }
.verdict-questionable { background: #f5f0e6; color: #8a7040; }
.verdict-questionable .verdict-dot { background: #c4a870; }
.verdict-unknown   { background: #f4f4f4; color: #999; }
.verdict-unknown .verdict-dot   { background: #bbb; }
a.verdict-dangerous, a.verdict-safe { text-decoration: none; }
a.verdict-dangerous .verdict-pill,
a.verdict-safe .verdict-pill { cursor: pointer; }
a.verdict-dangerous:hover .verdict-pill { background: #edd8d8; }
a.verdict-safe:hover .verdict-pill      { background: #cde0cd; }
.verdict-questionable, .verdict-unknown { cursor: help; }
.pill-link { text-decoration: none; }

.name-aliases { font-size: 12px; color: #aaa; font-weight: 400; }
.remove-btn {
  background: none; border: none; color: #ccc; font-size: 18px;
  cursor: pointer; padding: 0 4px; line-height: 1;
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
}
.remove-btn:hover { color: #c49090; }
.name-row td {
  padding: 14px 12px 4px; font-size: 15px; border-bottom: none;
  position: relative;
}
.name-row td:first-child { padding-right: 32px; }
.entry-row td {
  padding: 5px 12px 7px; border-bottom: 1px solid #f4f4f4;
}
.entry-row td:not(:first-child) { text-align: center; }
.entry-row:last-child td { border-bottom: 2px solid #eee; }
.entry-scientific { font-size: 12px; color: #999; font-style: italic; }
.entry-accepted { font-size: 11px; color: #bbb; font-style: normal; }
.entry-slug { font-size: 11px; color: #bbb; font-style: normal; }

@media (max-width: 600px) {
  .container-fluid { margin: 16px auto; padding: 0 12px; }

  /* Header compact */
  .app-header { flex-direction: column; align-items: center; gap: 8px; margin-bottom: 12px; }
  .app-title { font-size: 20px; }
  .app-subtitle { font-size: 13px; }
  .app-logo { width: 60px; height: 60px; font-size: 28px; }
  .lang-switch {
    display: flex; flex-direction: row; gap: 4px;
    grid-template-columns: unset;
    align-self: center;
  }
  .app-header-left { display: flex; flex-direction: column; align-items: center; width: 100%; }
  .app-subtitle, .header-meta { text-align: center; align-items: center; }
  .lang-switch .lang-btn { width: 36px; height: 32px; font-size: 11px; border-radius: 8px; }

  /* Card */
  .card { padding: 16px 14px; }

  /* Table: иконки на мобиле */
  .verdict-pill { padding: 0; border-radius: 50%; width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center; }
  .verdict-dot { display: none; }
  .verdict-label { font-size: 0; }
  .verdict-pill::after { font-size: 14px; font-weight: 700; }
  .verdict-dangerous::after { content: '✕'; color: #9e6060; }
  .verdict-safe::after      { content: '✓'; color: #5a7a5a; }
  .verdict-questionable::after { content: '?'; color: #8a7040; }
  .verdict-unknown::after   { content: '?'; color: #999; }

  .result-table th { padding: 8px 4px; }
  .result-table td { padding: 4px 4px; }
  .entry-scientific { font-size: 10px; }
  .name-row td { font-size: 13px; padding: 10px 4px 3px; }
  .name-aliases { font-size: 10px; }
}

.suggestion-link {
  color: #8a9f85; cursor: pointer; text-decoration: underline;
  margin-right: 6px; font-size: 13px;
}
.suggestion-link:hover { color: #718372; }
.unknown-note { color: #999; font-size: 12px; margin-top: 4px; }

/* Empty state */
.empty-state {
  text-align: center; padding: 30px 0; color: #999;
}
.empty-state .icon { font-size: 36px; margin-bottom: 8px; }
.empty-state .title { font-size: 15px; font-weight: 600; color: #666; }
.empty-state .sub { font-size: 13px; color: #999; margin-top: 4px; }

/* Legend */
.legend {
  display: flex; justify-content: center; gap: 20px;
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid #eee;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #666; cursor: help; }
.legend-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 9px; line-height: 1;
  opacity: 0.6;
}
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.dot-safe { background: #8aaa85; }
.dot-questionable { background: #c4a870; }
.dot-dangerous { background: #c49090; }

/* Source */
.source-line {
  text-align: center; margin-bottom: 16px;
  font-size: 13px;
}
.source-line a { color: rgba(255,255,255,0.75); text-decoration: underline; }
.source-line a:hover { color: #fff; }

/* Download */
.download-section { margin-top: 16px; text-align: center; }
.btn-download {
  background: none; border: 1px solid #ddd; border-radius: 8px;
  padding: 6px 18px; font-size: 12px; color: #999; cursor: pointer;
}

/* Contact */
.contact-section { text-align: center; margin-bottom: 12px; }
.btn-contact {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px;
  background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.3); border-radius: 20px;
  font-size: 12px; text-decoration: none; margin-top: 12px;
}

@media print {
  body::before, .app-header, .source-line, .contact-section,
  .selectize-control, .btn-check-bouquet, .check-row, .legend,
  .download-section, .magic-section, .remove-btn,
  .contact_ui, #contact_ui { display: none !important; }
  body { background: white !important; }
  .card { box-shadow: none !important; border: none !important; }
  .table-wrapper { border: 1px solid #ccc !important; }
  a { text-decoration: none !important; color: inherit !important; pointer-events: none; }
  a[href]::after { content: none !important; }
}
