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

:root {
  --green:   #2e8b6a;
  --green2:  #4caf8c;
  --bg:      #f4f8f6;
  --card:    #ffffff;
  --text:    #2c3e50;
  --muted:   #7f8c8d;
  --border:  #e0e8e4;
  --shadow:  0 2px 12px rgba(0,0,0,0.07);
  --radius:  14px;
}

body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }

/* ── Header ── */
header {
  background: linear-gradient(135deg, #1a6b4e 0%, #2e8b6a 50%, #4caf8c 100%);
  color: #fff; padding: 28px 20px 24px;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
header h1 { font-size: clamp(1.3rem, 3vw, 1.8rem); white-space: nowrap; }

/* Brand wrap (h1 + tagline) */
.brand-wrap {
  display: flex; flex-direction: column; gap: 2px;
  flex-shrink: 0;
}
.tagline {
  font-size: clamp(.72rem, 1.6vw, .82rem);
  color: rgba(255,255,255,0.92);
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.02em;
  font-style: italic;
}
.search-wrap { display: flex; flex: 1; min-width: 240px; max-width: 520px; gap: 8px; }
.search-wrap input {
  flex: 1; padding: 10px 18px; border-radius: 30px; border: none;
  font-size: 1rem; outline: none;
}
.search-wrap button {
  padding: 10px 22px; background: #fff; color: var(--green);
  border: none; border-radius: 30px; font-weight: 700; cursor: pointer;
  transition: background .2s; white-space: nowrap;
}
.search-wrap button:hover { background: #e8f5ee; }

/* ── Species Bar ── */
.species-bar {
  background: #fff;
  border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 200;
}
.species-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; padding: 0 16px;
}
.species-tab {
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 36px; border: none; background: none; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  font-size: .95rem; font-weight: 700; color: var(--muted);
  gap: 4px; transition: all .2s;
}
.species-tab .species-icon { font-size: 1.6rem; }
.species-tab.active { color: var(--green); border-bottom-color: var(--green); }
.species-tab:hover:not(.active) { background: var(--bg); color: var(--text); }

/* ── Disease Pills Bar ── */
.disease-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  position: sticky; top: 74px; z-index: 100;
}
.disease-pills-wrap {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  overflow-x: auto; scrollbar-width: none;
}
.disease-pills-wrap::-webkit-scrollbar { display: none; }
.disease-pills { display: flex; gap: 8px; width: max-content; }

.disease-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 30px;
  border: 2px solid var(--border); background: var(--card);
  cursor: pointer; white-space: nowrap;
  font-size: .85rem; font-weight: 600; color: var(--text);
  transition: all .2s;
}
.disease-pill:hover { border-color: var(--green2); }
.disease-pill.active { background: var(--green); border-color: var(--green); color: #fff; }
.disease-pill .pill-count {
  font-size: .75rem; opacity: .7;
  background: rgba(0,0,0,0.08); padding: 1px 6px; border-radius: 10px;
}
.disease-pill.active .pill-count { background: rgba(255,255,255,0.25); opacity: 1; }

/* ── Layout ── */
.layout { display: flex; max-width: 1200px; margin: 24px auto; padding: 0 16px; gap: 24px; }

/* ── Sidebar ── */
aside {
  width: 240px; flex-shrink: 0;
  position: sticky; top: 140px;
  align-self: flex-start;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
aside::-webkit-scrollbar { width: 4px; }
aside::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.filter-card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.filter-card h3 {
  font-size: .8rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: 12px;
}

/* disease list in sidebar */
.disease-list { display: flex; flex-direction: column; gap: 4px; }
.disease-tag {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: 10px; cursor: pointer; transition: background .15s;
  border: 2px solid transparent;
}
.disease-tag:hover { background: var(--bg); }
.disease-tag.active { background: #e8f5ee; border-color: var(--green2); }
.disease-tag .d-icon { font-size: 1rem; width: 20px; text-align: center; }
.disease-tag .d-name { font-size: .85rem; font-weight: 600; color: var(--text); flex: 1; }
.disease-tag .d-count { font-size: .75rem; color: var(--muted); background: var(--bg); padding: 1px 6px; border-radius: 10px; }

/* food type buttons */
.type-btns { display: flex; flex-direction: column; gap: 7px; }
.type-btn {
  width: 100%; padding: 9px 14px; background: var(--bg); border: 2px solid var(--border);
  border-radius: 10px; cursor: pointer; font-size: .88rem; text-align: left;
  transition: all .2s; font-weight: 600; color: var(--muted);
}
.type-btn.active { border-color: var(--green2); background: #e8f5ee; color: var(--green); }
.type-btn:hover:not(.active) { border-color: var(--green2); }

/* breed size buttons */
.breed-btns { display: flex; flex-direction: column; gap: 7px; }
.breed-btn {
  width: 100%; padding: 9px 14px; background: var(--bg); border: 2px solid var(--border);
  border-radius: 10px; cursor: pointer; font-size: .88rem; text-align: left;
  transition: all .2s; font-weight: 600; color: var(--muted);
}
.breed-btn.active { border-color: var(--green2); background: #e8f5ee; color: var(--green); }
.breed-btn:hover:not(.active) { border-color: var(--green2); }

/* brand checkboxes */
.brand-list { display: flex; flex-direction: column; gap: 6px; }
.brand-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .88rem; padding: 4px 0; }
.brand-label input { accent-color: var(--green2); width: 16px; height: 16px; flex-shrink: 0; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* clear btn */
.clear-btn {
  width: 100%; padding: 10px; background: transparent; border: 2px solid var(--border);
  border-radius: 10px; color: var(--muted); cursor: pointer; font-size: .88rem; font-weight: 600;
  transition: all .2s; margin-top: 4px;
}
.clear-btn:hover { border-color: #e74c3c; color: #e74c3c; background: #fdf0ef; }

/* ── Main content ── */
main { flex: 1; min-width: 0; }

.result-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.result-bar p { color: var(--muted); font-size: .9rem; }
.sort-select { padding: 8px 12px; border: 2px solid var(--border); border-radius: 10px; font-size: .88rem; color: var(--text); background: var(--card); cursor: pointer; }

/* ── Disease header banner ── */
.disease-header {
  background: var(--card); border-radius: var(--radius); padding: 18px 22px;
  margin-bottom: 18px; box-shadow: var(--shadow); border-left: 5px solid var(--green2);
  display: none;
}
.disease-header.show { display: block; }
.disease-header h2 { font-size: 1.1rem; margin-bottom: 5px; }
.disease-header p  { color: var(--muted); font-size: .88rem; }

/* ── Grid ── */
.food-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

/* ── Food Card ── */
.food-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; transition: transform .2s, box-shadow .2s;
  border: 2px solid transparent; display: flex; flex-direction: column;
}
.food-card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px rgba(0,0,0,0.12); border-color: var(--green2); }

.card-top { padding: 16px; display: flex; align-items: flex-start; gap: 12px; flex: 1; }
.card-top .brand-badge {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  padding: 3px 9px; border-radius: 20px; margin-bottom: 5px; display: inline-block;
}
.card-top h3 { font-size: .92rem; line-height: 1.4; margin-bottom: 6px; }
.card-animal-icon {
  font-size: 1.8rem; background: var(--bg); border-radius: 12px;
  width: 50px; height: 50px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}

/* disease tags on card */
.card-diseases { padding: 0 16px 12px; display: flex; flex-wrap: wrap; gap: 5px; }
.card-disease-tag {
  font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  color: #fff; white-space: nowrap;
}

.card-footer {
  padding: 11px 16px; background: var(--bg);
  display: flex; justify-content: center; align-items: center;
  border-top: 1px solid var(--border);
}
.card-footer .detail-btn { font-size: .85rem; color: var(--green); font-weight: 700; background: none; border: none; cursor: pointer; }

/* ── Empty state ── */
.empty {
  text-align: center; padding: 60px 24px; color: var(--muted);
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); max-width: 480px; margin: 20px auto;
}
.empty .icon { font-size: 3.5rem; margin-bottom: 12px; }
.empty h3 { font-size: 1.15rem; color: var(--text); margin-bottom: 8px; }
.empty p { font-size: .95rem; margin-bottom: 18px; }
.empty .empty-suggestions {
  list-style: none; padding: 0; margin: 16px 0 20px;
  text-align: left; display: inline-block;
}
.empty .empty-suggestions li {
  font-size: .88rem; color: var(--text);
  padding: 6px 0; line-height: 1.5;
}
.empty .empty-clear-btn {
  padding: 10px 22px; background: var(--green); color: #fff;
  border: none; border-radius: 30px; font-weight: 700;
  cursor: pointer; font-size: .9rem; transition: background .2s;
}
.empty .empty-clear-btn:hover { background: #1a6b4e; }

/* ── Header Nav (for about page) ── */
.header-nav {
  display: flex; gap: 20px; margin-left: auto;
}
.header-nav a {
  color: #fff; text-decoration: none; font-weight: 600;
  padding: 6px 14px; border-radius: 20px; font-size: .92rem;
  transition: background .2s;
}
.header-nav a:hover { background: rgba(255,255,255,0.15); }
.header-nav a.active { background: rgba(255,255,255,0.2); }

/* ── About Page ── */
.about-page {
  max-width: 820px; margin: 28px auto 40px; padding: 0 16px;
}
.about-container {
  background: var(--card); border-radius: var(--radius);
  padding: 36px 32px; box-shadow: var(--shadow);
}
.about-container h1 {
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  color: var(--green); margin-bottom: 10px;
}
.about-container .lead {
  color: var(--muted); font-size: 1rem;
  line-height: 1.7; margin-bottom: 28px;
  padding-bottom: 20px; border-bottom: 2px solid var(--border);
}
.about-section { margin-bottom: 32px; }
.about-section h2 {
  font-size: 1.15rem; margin-bottom: 12px; color: var(--text);
}
.about-section p {
  font-size: .95rem; line-height: 1.75; color: var(--text);
  margin-bottom: 12px;
}
.about-section ul {
  padding-left: 22px; margin-bottom: 12px;
}
.about-section li {
  font-size: .92rem; line-height: 1.85; color: var(--text);
}
.about-warning {
  background: #fff8e6; border-left: 4px solid #f6c026;
  padding: 16px 20px; border-radius: 10px; margin: 14px 0;
  font-size: .92rem; line-height: 1.7; color: #7a5c00;
}
.about-warning b { display: block; margin-bottom: 6px; }
.contact-box {
  background: var(--bg); border-radius: 12px;
  padding: 18px 20px; margin-top: 12px;
}
.contact-box p { margin-bottom: 6px; font-size: .92rem; }
.contact-box a {
  color: var(--green); text-decoration: none; font-weight: 600;
}
.contact-box a:hover { text-decoration: underline; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--green); text-decoration: none; font-weight: 600;
  margin-bottom: 16px; font-size: .9rem;
}
.back-link:hover { text-decoration: underline; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card); border-radius: 20px; max-width: 580px; width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  transform: translateY(20px); transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 24px 24px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.close-btn { background: var(--bg); border: none; border-radius: 50%; width: 36px; height: 36px; font-size: 1.2rem; cursor: pointer; flex-shrink: 0; }
.modal-body { padding: 20px 24px 28px; }

.modal-diseases { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.modal-section { margin-top: 20px; }
.modal-section h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 12px; }

.nutrient-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.nutrient-box { background: var(--bg); border-radius: 12px; padding: 12px; text-align: center; }
.nutrient-box .val { font-size: 1.05rem; font-weight: 700; color: var(--green); }
.nutrient-box .lbl { font-size: .75rem; color: var(--muted); margin-top: 3px; }

.info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.info-row:last-child { border-bottom: none; }
.info-row .lbl { color: var(--muted); }
.info-row .val { font-weight: 600; text-align: right; max-width: 60%; }

.warning-box { background: #fff8e6; border: 1px solid #f6c026; border-radius: 12px; padding: 14px 16px; margin-top: 18px; font-size: .86rem; color: #7a5c00; }
.warning-box b { display: block; margin-bottom: 4px; }

/* Buy buttons */
.buy-section { margin-top: 20px; }
.buy-section h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 12px; }
.buy-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.buy-btn {
  flex: 1; min-width: 130px; padding: 12px 16px;
  border-radius: 12px; border: none; cursor: pointer;
  font-size: .88rem; font-weight: 700; text-decoration: none;
  text-align: center; display: inline-block; transition: opacity .2s;
}
.buy-btn:hover { opacity: .85; }
.buy-btn.shopee { background: #ee4d2d; color: #fff; }
.buy-btn.lazada  { background: #0f146d; color: #fff; }
.buy-btn.clinic  { background: var(--bg); color: var(--green); border: 2px solid var(--green2); }

/* ── Footer ── */
footer {
  background: #1a2e28; color: #a0b8b0;
  padding: 40px 20px 28px; margin-top: 40px;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; gap: 32px; flex-wrap: wrap; justify-content: space-between;
}
.footer-brand { flex: 1; min-width: 200px; }
.footer-logo { font-size: 1.2rem; font-weight: 700; color: #fff; display: block; margin-bottom: 10px; }
.footer-brand p { font-size: .86rem; line-height: 1.7; }
.footer-info { flex: 1; min-width: 200px; font-size: .86rem; line-height: 1.9; }
.footer-info p:first-child { color: #f6c026; font-weight: 600; }
.footer-meta { font-size: .83rem; line-height: 1.8; }
.footer-version { color: #5a8a78; font-size: .78rem; margin-top: 4px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .search-wrap { max-width: 100%; width: 100%; }
  .species-tab { padding: 12px 20px; }
  .layout { flex-direction: column; }
  aside { width: 100%; position: static; max-height: none; overflow-y: visible; top: auto; }
  .disease-bar { position: static; }
  .footer-inner { flex-direction: column; gap: 20px; }
}
