/* =========================================================
   /assets/css/search.css
   検索ページ専用
   ========================================================= */

.card{
  background:var(--bg-card);
  border:1px solid var(--border-soft);
  border-radius:12px;
  padding:16px;
  box-shadow:0 1px 3px rgba(15,23,42,0.04);
}

/* =========================
   Search form
   ========================= */

.search-form{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.search-block{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.search-block-title{
  font-size:13px;
  font-weight:800;
  color:var(--text-main);
}

/* =========================
   選びたいたんぱく源エリア強調
========================= */

.search-block{
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:12px;
  padding:14px;
}

/* 単一たんぱく */
.search-single-protein{
  display:flex;
  align-items:flex-start;
  gap:10px;
  width:fit-content;
  margin-top:14px;
  padding:10px 14px;
  border:1px solid #cbd5e1;
  border-radius:10px;
  background:#fff;
  cursor:pointer;
  transition:all .2s ease;
}
.search-protein-options{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 260px));
  gap:10px;
  margin-top:18px;
}

.search-protein-options .search-single-protein{
  width:auto;
  margin-top:0;
  padding:10px 12px;
}
.search-single-protein input{
  width:16px;
  height:16px;
  margin-top:2px;
  accent-color:var(--accent-main-deep);
}

.search-single-protein span{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.search-single-protein strong{
  font-size:13px;
  color:#0f172a;
  font-weight:600;
}

.search-single-protein small{
  font-size:11px;
  color:#64748b;
}

/* ON状態 */
.search-single-protein:has(input:checked){
  background:var(--accent-soft);
  border-color:var(--accent-border);
  color:var(--accent-main-deep);
}

/* hover */
.search-single-protein:hover{
  border-color:#94a3b8;
}

/* =========================
   Filter chips
   ネイティブcheckbox安定版
   ========================= */

.search-filter-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.search-filter-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:34px;
  padding:7px 12px;
  border:1px solid var(--border-soft);
  border-radius:8px;
  background:#fff;
  color:var(--text-main);
  font-size:13px;
  line-height:1.4;
  cursor:pointer;
  transition:
    background .15s ease,
    border-color .15s ease,
    color .15s ease,
    transform .15s ease;
  -webkit-tap-highlight-color:transparent;
  user-select:none;
}

.search-filter-chip:hover{
  border-color:#d7dfe8;
  transform:translateY(-1px);
}

.search-filter-chip__input{
  position:static;
  width:16px;
  height:16px;
  margin:0;
  flex:0 0 auto;
  cursor:pointer;
  accent-color:var(--accent-main-deep);
}

.search-filter-chip__box{
  display:none;
}

.search-filter-chip__text{
  display:inline-block;
}

/* checkbox選択状態 */
.search-filter-chip:has(.search-filter-chip__input:checked){
  background:var(--accent-soft);
  border-color:var(--accent-border);
  color:var(--accent-main-deep);
}

.search-filter-chip.is-exclude .search-filter-chip__input{
  accent-color:#b94a48;
}

.search-filter-chip.is-exclude:has(.search-filter-chip__input:checked){
  background:#fdecec;
  border-color:#f5c2c0;
  color:#b94a48;
}

/* JS classにも対応 */
.search-filter-chip.is-active{
  background:var(--accent-soft);
  border-color:var(--accent-border);
  color:var(--accent-main-deep);
}

.search-filter-chip.is-exclude-active{
  background:#fdecec;
  border-color:#f5c2c0;
  color:#b94a48;
}

/* =========================
   Exclude UI
   ========================= */

.search-exclude-panel{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.search-exclude-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  flex-wrap:wrap;
}

.search-exclude-title{
  margin:0 0 4px;
  font-size:15px;
  font-weight:800;
  color:#b94a48;
}

.search-exclude-note{
  margin:0;
  font-size:12px;
  line-height:1.7;
  color:var(--text-muted);
}

.search-exclude-reset{
  border:none;
  background:none;
  padding:0;
  font-size:13px;
  color:var(--accent-main-deep);
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
}

.search-exclude-quick,
.search-exclude-group,
.search-exclude-selected{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.search-exclude-subtitle{
  font-size:12px;
  font-weight:800;
  color:var(--text-soft);
}

.search-exclude-groups{
  display:flex;
  flex-direction:column;
  gap:14px;
  padding-top:2px;
}

.search-exclude-selected-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.search-exclude-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:32px;
  padding:6px 10px;
  border:none;
  border-radius:999px;
  background:#fdecec;
  color:#b94a48;
  font-size:12px;
  font-weight:700;
}

/* =========================
   Actions
   ========================= */

.search-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  padding-top:4px;
}

.search-actions .btn{
  min-height:44px;
}

/* =========================
   Selected conditions
   ========================= */

.selected-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.text-link{
  font-size:13px;
  color:var(--accent-main-deep);
  font-weight:700;
  text-decoration:none;
}

.chip-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-height:34px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--border-soft);
  background:#fff;
  color:var(--text-main);
  font-size:13px;
  font-weight:700;
  line-height:1.3;
}

.chip--soft{
  background:var(--accent-soft);
  border-color:var(--accent-border);
  color:var(--accent-main-deep);
}

.chip--exclude{
  background:#fdecec;
  border-color:#f5c2c0;
  color:#b94a48;
}

/* =========================
   Result header
   ========================= */

.result-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.result-count-label{
  font-size:12px;
  color:var(--text-soft);
  margin-bottom:2px;
}

.result-count-value{
  font-size:24px;
  line-height:1.2;
  font-weight:900;
  color:var(--text-main);
}

.sort-select{
  height:40px;
  padding:0 12px;
  border:1px solid var(--border-soft);
  border-radius:10px;
  background:#fff;
  color:var(--text-main);
  font-size:13px;
}

/* =========================
   Empty state
   ========================= */

.search-empty{
  background:var(--bg-card);
  border:1px solid rgba(226,232,240,0.9);
  border-radius:12px;
  box-shadow:0 1px 3px rgba(15,23,42,0.04);
  padding:14px;
}

.search-empty-title{
  font-weight:800;
  font-size:14px;
  margin-bottom:6px;
}

.search-empty-desc{
  font-size:13px;
  color:var(--text-muted);
  line-height:1.7;
}

/* =========================
   Search result cards
   ========================= */

.search-result-cards{
  margin-top:16px;
  padding:0 4px;
}

.search-result-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.search-food-card{
  display:block;
  background:#fff;
  border:1px solid var(--border-soft);
  border-radius:12px;
  padding:12px;
  box-shadow:0 1px 3px rgba(15,23,42,0.04);
  color:var(--text-main);
  text-decoration:none;
  cursor:pointer;
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease;
}

.search-food-card-inner{
  display:flex;
  flex-direction:column;
  min-height:100%;
}

.search-food-top{
  display:flex;
  align-items:flex-start;
  gap:12px;
  margin-bottom:10px;
}

.search-food-image{
  width:74px;
  height:74px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  overflow:hidden;
}

.search-food-image img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

.search-food-main{
  min-width:0;
  flex:1;
}

.search-food-brand{
  display:block;
  margin-bottom:2px;
  font-size:11px;
  line-height:1.35;
  color:var(--accent-main-deep);
  font-weight:700;
  letter-spacing:.04em;
}

.search-food-name{
  margin:0 0 8px;
  font-size:17px;
  line-height:1.42;
  font-weight:800;
  word-break:break-word;
  overflow-wrap:anywhere;
  min-height:48px;
}

.search-food-tags{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.search-food-tag{
  display:inline-flex;
  align-items:center;
  min-height:30px;
  padding:6px 10px;
  border-radius:6px;
  background:var(--bg-soft);
  border:1px solid var(--border-soft);
  font-size:10px;
  color:var(--text-main);
  line-height:1.4;
}

.search-food-tag.method-dry{
  background:#eef2ff;
  color:#3730a3;
}

.search-food-tag.method-airdried{
  background:#ecfdf5;
  color:#047857;
}

.search-food-tag.method-freezedried{
  background:#fef3c7;
  color:#92400e;
}

.search-food-tag.method-ovenbaked{
  background:#e0f2fe;
  color:#075985;
}

.search-food-tag.method-wet{
  background:#fee2e2;
  color:#b91c1c;
}

.search-food-tag.method-raw{
  background:#dcfce7;
  color:#166534;
}

.search-food-tag.method-unknown{
  background:#f3f4f6;
  color:#6b7280;
}

.search-food-nutrition-row{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:10px;
  margin-top:16px;
}

.search-food-nutrition-item{
  background:#f9fafb;
  border:none;
  border-radius:8px;
  padding:8px 6px;
  text-align:center;
  min-width:0;
}

.search-food-nutrition-label{
  display:block;
  margin-bottom:4px;
  font-size:11px;
  line-height:1.4;
  color:var(--text-soft);
}

.search-food-nutrition-value{
  display:block;
  font-size:14px;
  line-height:1.3;
  font-weight:800;
  color:var(--text-main);
  white-space:nowrap;
}

.search-food-foot{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:4px;
  margin-top:12px;
  color:var(--accent-main-deep);
  font-size:13px;
  font-weight:700;
}

@media (hover:hover) and (pointer:fine){
  .search-food-card:hover{
    box-shadow:0 2px 8px rgba(15,23,42,0.05);
    border-color:#d7dfe8;
    transform:translateY(-2px);
  }
}
.search-extra-option{
  margin-top:8px;
  background:#fff;
  border-color:var(--border-soft);
}

.search-extra-option strong{
  font-size:13px;
}

.search-extra-option small{
  color:var(--text-soft);
}
.selected-condition-note{
  margin:8px 0 0;
}


.search-condition-details{
  display:block;
}

.search-condition-summary{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:14px 16px;
  background:#fff;
  border:1px solid var(--border-soft);
  border-radius:12px;
  box-shadow:0 1px 3px rgba(15,23,42,0.04);
  font-size:15px;
  font-weight:800;
  color:var(--text-main);
  cursor:pointer;
  list-style:none;
}

.search-condition-summary::-webkit-details-marker{
  display:none;
}

.search-condition-summary-icon{
  font-size:18px;
  color:var(--text-soft);
  transition:transform .18s ease;
}

.search-condition-details[open] .search-condition-summary-icon{
  transform:rotate(180deg);
}

.search-condition-details[open] .search-condition-summary{
  margin-bottom:12px;
}

.search-condition-note{
  margin:0 0 12px;
}
/* =========================
   Pagination spacing
   ========================= */

.pagination{
  margin-top:14px;
}

/* =========================
   Responsive
   ========================= */

@media (max-width:767px){
  .search-result-grid{
    grid-template-columns:1fr;
  }

  .search-food-name{
    min-height:auto;
  }
}

@media (max-width:640px){
  .search-actions{
    flex-direction:column;
  }

  .search-actions .btn{
    width:100%;
  }

  .result-count-value{
    font-size:22px;
  }
}

.related-links {
  margin: 10px 0 26px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.related-links a {
  font-size: 13px;
  color: var(--text-main);
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.75;
  transition: all 0.2s ease;
}

.related-links a:hover {
  opacity: 1;
  color: var(--accent-color);
}