/* agri-formula.css — frontend section v1.1 */

/* ── Wrapper ──────────────────────────────────────────────────────────── */

.af-section {
  font-family: "Sarabun", "Noto Sans Thai", sans-serif;
  margin: 1.5rem 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #dcdfe5;
}

/* ── Header ───────────────────────────────────────────────────────────── */

.af-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #0f6b4e;
  color: #fff;
}

.af-section-head-title {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  flex: 1;
}

.af-section-head-badge {
  font-size: 11px;
  padding: 2px 10px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 20px;
}

/* ── Tab strip ────────────────────────────────────────────────────────── */

.af-tab-strip {
  display: flex;
  border-bottom: 2px solid #dcdfe5;
  padding: 0 16px;
  background: #fff;
}

.af-tab {
  font-size: 13px;
  padding: 10px 14px 10px 0;
  margin-right: 4px;
  color: #7e8993;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.af-tab.active {
  color: #0f6b4e;
  border-bottom-color: #0f6b4e;
  font-weight: 500;
}

.af-tab-badge {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 20px;
}

.af-tab-badge--chemical   { background: #fee2e2; color: #991b1b; }
.af-tab-badge--organic    { background: #dcfce7; color: #166534; }
.af-tab-badge--integrated { background: #e0f2fe; color: #0369a1; }

/* ── Panel ────────────────────────────────────────────────────────────── */

.af-panel {
  display: none;
  padding: 16px;
  background: #fff;
}

.af-panel.active { display: block; }

/* ── Timing row ───────────────────────────────────────────────────────── */

.af-timing {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: #7e8993;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #dcdfe5;
}

.af-timing strong { color: #222; }

/* ── Ingredient table — desktop ───────────────────────────────────────── */

.af-ingredient-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}

.af-ingredient-table th {
  text-align: left;
  font-size: 11px;
  color: #7e8993;
  font-weight: 400;
  padding: 0 8px 8px;
  border-bottom: 1px solid #dcdfe5;
}

.af-ingredient-table td {
  padding: 8px;
  border-bottom: 1px solid #f1f1f3;
  vertical-align: middle;
  color: #222;
}

.af-ingredient-table tr:last-child td { border-bottom: none; }

/* ── Ingredient list — mobile ─────────────────────────────────────────── */

.af-ingredient-list { display: none; }

/* ── Role badge ───────────────────────────────────────────────────────── */

.af-role-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.af-role-badge--main_active        { background: #e8f5f0; color: #0a5038; }
.af-role-badge--adjuvant           { background: #e0f2fe; color: #0369a1; }
.af-role-badge--secondary_nutrient { background: #fef9c3; color: #854d0e; }
.af-role-badge--primary_nutrient   { background: #fef9c3; color: #854d0e; }
.af-role-badge--amino_acid         { background: #f3e8ff; color: #6b21a8; }
.af-role-badge--other              { background: #f1f1f3; color: #7e8993; }

/* ── Product link ─────────────────────────────────────────────────────── */

.af-product-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #f97316;
  text-decoration: none;
  margin-top: 2px;
}

.af-product-link:hover { text-decoration: underline; }

/* ── Precaution ───────────────────────────────────────────────────────── */

.af-precaution {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 12px;
  color: #9a3412;
  margin-bottom: 12px;
}

/* ── Related articles ─────────────────────────────────────────────────── */

.af-related {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #dcdfe5;
}

.af-related-label {
  font-size: 11px;
  color: #7e8993;
  margin-bottom: 8px;
  margin-top: 0;
}

.af-article-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #dcdfe5;
  border-radius: 8px;
  margin-bottom: 6px;
  text-decoration: none;
  color: #222;
  transition: border-color .15s;
}

.af-article-card:hover { border-color: #0f6b4e; }

.af-article-icon {
  width: 32px;
  height: 32px;
  background: #e8f5f0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #0f6b4e;
  font-size: 16px;
}

.af-article-title {
  font-size: 13px;
  font-weight: 500;
  color: #222;
  flex: 1;
}

.af-article-meta {
  font-size: 11px;
  color: #7e8993;
}

.af-article-arrow {
  color: #dcdfe5;
  font-size: 16px;
}

/* ── Mobile ───────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .af-ingredient-table { display: none; }
  .af-ingredient-list  { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

  .af-ingredient-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #dcdfe5;
    border-radius: 8px;
  }

  .af-ingredient-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .af-ingredient-item-rate {
    font-size: 12px;
    color: #7e8993;
  }

  .af-ingredient-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #222;
  }

  .af-tab { font-size: 12px; padding: 8px 10px 8px 0; }
  .af-section-head { padding: 10px 14px; }
  .af-panel { padding: 12px; }
}
