* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  color: #1a1a1a;
  background: #f7f7f5;
}

a { color: #0b5c8c; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 検索画面 ---------- */

.site-header {
  padding: 48px 16px 8px;
  text-align: center;
}

.site-title {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.04em;
}

.site-title a { color: #146eb4; }

.search-form {
  max-width: 640px;
  margin: 12px auto 0;
  padding: 0 16px;
}

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

.search-input {
  flex: 1;
  font-size: 1.05rem;
  padding: 12px 16px;
  border: 2px solid #d4d4d0;
  border-radius: 24px;
  outline: none;
}

.search-input:focus { border-color: #146eb4; }

.search-button {
  padding: 0 28px;
  font-size: 1rem;
  border: none;
  border-radius: 24px;
  background: #febd69;
  cursor: pointer;
}

.search-button:hover { background: #f3a847; }

.notice {
  max-width: 640px;
  margin: 20px auto;
  padding: 12px 16px;
  border-radius: 8px;
  text-align: center;
}

.notice-error { background: #fdecea; color: #a12622; }
.notice-ok { background: #e6f4ea; color: #1e7b34; }

.results-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 16px;
}

.facets {
  align-self: start;
  position: sticky;
  top: 16px;
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  font-size: 0.88rem;
}

.facets h3, .price-filter h3 {
  font-size: 0.9rem;
  margin: 14px 0 6px;
}

.facet-section ul { list-style: none; margin: 0; padding: 0; }
.facet-section li { margin: 4px 0; }

.price-inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.price-inputs input {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.price-inputs button {
  flex-basis: 100%;
  margin-top: 4px;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: #146eb4;
  color: #fff;
  cursor: pointer;
}

.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: #555;
}

.sort-form select { padding: 6px 8px; border-radius: 6px; border: 1px solid #ccc; }

.item-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.item-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}

.item-card:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }

.item-link { display: block; color: inherit; }

.item-image-wrap { position: relative; height: 160px; background: #fff; }
.item-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.badge-sale {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #cc0c39;
  color: #fff;
  font-size: 0.72rem;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 4px;
}

.item-title {
  font-size: 0.86rem;
  line-height: 1.4;
  height: 3.6em;
  overflow: hidden;
  margin: 8px 10px 4px;
}

.item-price {
  margin: 0 10px 12px;
  font-size: 1.05rem;
  font-weight: bold;
  color: #b12704;
}

.item-original-price {
  display: block;
  font-size: 0.78rem;
  font-weight: normal;
  color: #888;
}

.empty-message { text-align: center; color: #666; padding: 40px 0; }

.site-footer {
  text-align: center;
  font-size: 0.75rem;
  color: #999;
  padding: 24px 0 32px;
}

@media (max-width: 760px) {
  .results-layout { grid-template-columns: 1fr; }
  .facets { position: static; }
}

/* ---------- 管理画面 ---------- */

.admin-header {
  background: #232f3e;
  color: #fff;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-header h1 { font-size: 1.15rem; margin: 0; }

.admin-nav a {
  color: #ddd;
  margin-left: 16px;
  font-size: 0.9rem;
}

.admin-main {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px;
}

.panel {
  background: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.panel h2 { font-size: 1.05rem; margin-top: 0; }

.tag-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tag-table th, .tag-table td {
  border-bottom: 1px solid #eee;
  padding: 8px 6px;
  text-align: left;
  vertical-align: middle;
}
.row-actions form { display: inline; margin-right: 8px; }
.row-actions button {
  padding: 4px 10px;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
}
.row-actions button.danger { color: #a12622; border-color: #d8a09e; }
.row-actions button:disabled { opacity: 0.4; cursor: default; }

.default-badge {
  background: #146eb4;
  color: #fff;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.stack-form label { display: block; margin-bottom: 12px; font-size: 0.9rem; }
.stack-form input {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

.form-actions button {
  padding: 8px 20px;
  background: #146eb4;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.form-actions a { margin-left: 12px; }

.hint { font-size: 0.8rem; color: #777; }

.filter-bar select, .filter-bar button {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-right: 8px;
}

.product-cell { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.login-box {
  max-width: 360px;
  margin: 96px auto;
  background: #fff;
  border-radius: 10px;
  padding: 32px;
  text-align: center;
}

.login-box form { margin-top: 16px; }
.login-box label { display: block; text-align: left; font-size: 0.9rem; }
.login-box input {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.login-box button {
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  background: #146eb4;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
}
