/* 三越伊勢丹 サイト内検索ウィジェット（吹き出し版） */
.mistore-search-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", sans-serif;
  box-sizing: border-box;
}
.mistore-search-widget *,
.mistore-search-widget *::before,
.mistore-search-widget *::after { box-sizing: border-box; }

.mistore-search-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border: 1px solid #e0e0e0;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  max-width: 260px;
}
.mistore-search-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
}
.mistore-search-bubble::after {
  content: '';
  position: absolute;
  right: 20px;
  bottom: -8px;
  border: 8px solid transparent;
  border-top-color: #fff;
  border-left-color: #fff;
  box-shadow: 1px 1px 0 0 #e0e0e0;
}
.mistore-search-bubble-text { color: #333; font-weight: 500; }
.mistore-search-bubble-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: #111;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.mistore-search-panel {
  display: none;
  position: absolute;
  bottom: 0;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  max-height: 75vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border: 1px solid #e0e0e0;
  flex-direction: column;
  overflow: hidden;
}
.mistore-search-panel.is-open { display: flex; }
.mistore-search-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
}
.mistore-search-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mistore-search-panel-title { font-weight: 600; font-size: 15px; }
.mistore-search-panel-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: #666;
  border-radius: 4px;
  padding: 0;
}
.mistore-search-panel-close:hover { background: #e0e0e0; color: #333; }
.mistore-search-panel-body {
  padding: 12px 14px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.mistore-search-panel-top {
  flex-shrink: 0;
}

.mistore-search-bar { display: flex; gap: 8px; margin-bottom: 4px; }
.mistore-search-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
}
.mistore-search-bar input:focus { outline: none; border-color: #111; }
.mistore-search-bar button {
  padding: 10px 16px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.mistore-search-bar button:hover { opacity: 0.9; }

/* ヒント非表示に伴い未使用（mistore-site-search.js 側コメント参照）
.mistore-search-input-hint {
  font-size: 11px;
  color: #888;
  margin: -2px 0 8px 0;
}

.mistore-search-type { display: flex; gap: 4px; margin-bottom: 8px; }
.mistore-search-type label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.mistore-search-type input { margin: 0; }
.mistore-search-type input:checked + span { font-weight: 600; }
*/

.mistore-search-product-filters { margin-bottom: 2px; }
.mistore-search-in-stock-only { margin-bottom: 8px; }
.mistore-search-in-stock-only label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; }
.mistore-search-in-stock-only input { margin: 0; }
.mistore-search-advanced-details {
  margin-bottom: 4px;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  background: #fafafa;
}
.mistore-search-advanced-summary {
  cursor: pointer;
  font-size: 12px;
  color: #444;
  padding: 6px 10px;
  list-style: none;
  font-weight: 500;
}
.mistore-search-advanced-details[open] > .mistore-search-advanced-summary {
  border-bottom: 1px solid #e8e8e8;
}
.mistore-search-advanced-summary::-webkit-details-marker { display: none; }
.mistore-search-advanced-summary::marker { content: ''; }
.mistore-search-advanced-inner {
  padding: 8px 10px 10px;
}
.mistore-search-filter-label { font-size: 11px; color: #666; margin: 2px 0 4px; }
.mistore-search-ancillary-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.mistore-search-ancillary-filters label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-size: 12px; }
.mistore-search-ancillary-filters input { margin: 0; }
.mistore-search-shelf-life-filter { display: flex; align-items: center; gap: 8px; margin-bottom: 0; }
.mistore-search-shelf-life-label { font-size: 12px; color: #333; white-space: nowrap; }
.mistore-search-shelf-life-filter input {
  width: 88px;
  padding: 5px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 12px;
}
.mistore-search-shipping-free-filter { margin-top: 8px; font-size: 12px; color: #333; }
.mistore-search-shipping-free-filter label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

.mistore-search-results {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;
  flex: 1;
  min-height: 12rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.mistore-search-results-panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mistore-search-results-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
}
.mistore-search-results-tabs button {
  flex: 1;
  padding: 8px 10px;
  border: none;
  background: none;
  font-size: 13px;
  cursor: pointer;
  color: #666;
}
.mistore-search-results-tabs button.active {
  background: #fff;
  color: #333;
  font-weight: 600;
  border-bottom: 2px solid #111;
  margin-bottom: -1px;
}
.mistore-search-product-panel-hint {
  font-size: 11px;
  color: #666;
  margin-bottom: 6px;
  line-height: 1.35;
  flex-shrink: 0;
}
.mistore-search-product-sort-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #444;
  flex-shrink: 0;
}
.mistore-search-product-sort-row .mistore-search-product-sort-label { margin: 0; cursor: pointer; }
.mistore-search-product-sort {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
}
.mistore-search-results-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px 10px;
  overscroll-behavior: contain;
}
.mistore-search-results-panel.active { display: flex; }
.mistore-search-query-hint {
  font-size: 11px;
  color: #666;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.mistore-search-knowledge-list,
.mistore-search-product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.mistore-search-knowledge-item {
  padding: 10px 0;
  border-bottom: 1px solid #e0e0e0;
}
.mistore-search-knowledge-item:last-child { border-bottom: none; }
.mistore-search-knowledge-item a { color: #111; text-decoration: none; font-weight: 600; font-size: 13px; }
.mistore-search-knowledge-item a:hover { text-decoration: underline; }
.mistore-search-knowledge-item .snippet { color: #666; font-size: 12px; margin-top: 4px; }
.mistore-search-knowledge-item .meta { font-size: 11px; color: #666; margin-top: 2px; }
.mistore-search-product-item {
  padding: 0;
  border-bottom: 1px solid #e0e0e0;
}
.mistore-search-product-item:last-child { border-bottom: none; }
.mistore-search-product-link,
.mistore-search-product-link.mistore-search-product-link--no-url {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  color: inherit;
  text-decoration: none;
  align-items: flex-start;
}
.mistore-search-product-link:hover {
  background: #f5f5f5;
}
.mistore-search-product-item .thumb {
  width: 56px;
  height: 56px;
  background: #e0e0e0;
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 11px;
  overflow: hidden;
}
.mistore-search-product-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mistore-search-product-item .thumb .thumb-placeholder {
  font-size: 11px;
}
.mistore-search-product-item .info { flex: 1; min-width: 0; }
.mistore-search-product-item .product-name { color: #111; font-weight: 600; font-size: 13px; }
.mistore-search-product-item .mistore-search-brand { font-size: 11px; color: #555; margin-top: 2px; font-weight: 500; }
.mistore-search-product-item .mistore-search-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.mistore-search-product-item .mistore-search-price-row--shipping-only {
  justify-content: flex-end;
}
.mistore-search-product-item .mistore-search-price-row .price {
  margin: 0;
  font-weight: 600;
  font-size: 13px;
}
.mistore-search-product-item .mistore-search-shipping-free {
  font-size: 11px;
  color: #1565c0;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.mistore-search-product-item .category { font-size: 11px; color: #666; margin-top: 2px; }
.mistore-search-product-item .mistore-search-stock-status { font-size: 11px; margin-top: 4px; }
.mistore-search-product-item .mistore-search-stock-status--available { color: #0a7c42; font-weight: 500; }
.mistore-search-product-item .mistore-search-stock-status--temp-out { color: #c62828; font-weight: 600; }
.mistore-search-product-item .mistore-search-stock-status--unavailable { color: #666; font-weight: 500; }
.mistore-search-product-item .mistore-search-stock-status--discontinued { color: #888; font-weight: 500; }
.mistore-search-product-item .mistore-search-ancillary { font-size: 11px; color: #555; margin-top: 2px; }
.mistore-search-empty { color: #666; padding: 16px; text-align: center; font-size: 13px; }
.mistore-search-loading {
  color: #666;
  padding: 16px;
  text-align: center;
  font-size: 13px;
  list-style: none;
}
.mistore-search-loading-progress {
  height: 5px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
  width: 100%;
}
.mistore-search-loading-progress-bar {
  height: 100%;
  width: 35%;
  background: #333;
  border-radius: 3px;
  animation: mistore-search-loading-shimmer 1.8s ease-in-out infinite;
}
@keyframes mistore-search-loading-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(380%); }
}
.mistore-search-loading-text {
  font-size: 13px;
  color: #666;
}

/* 大きめ表示トグル（デスクトップ時のみ表示） */
.mistore-search-panel-size-toggle {
  display: none;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #666;
  border-radius: 4px;
  padding: 0;
  margin-right: 4px;
  align-items: center;
  justify-content: center;
}
.mistore-search-panel-size-toggle:hover { background: #e0e0e0; color: #333; }

@media (min-width: 768px) {
  .mistore-search-panel-size-toggle { display: flex; }
  .mistore-search-panel.is-large {
    width: 560px;
    max-height: 85vh;
  }
}

/* 左下固定（チャットボット等と左右に分ける場合） */
.mistore-search-widget--bottom-left {
  left: 24px;
  right: auto;
}
.mistore-search-widget--bottom-left .mistore-search-panel {
  left: 0;
  right: auto;
}
.mistore-search-widget--bottom-left .mistore-search-bubble {
  position: relative;
}
.mistore-search-widget--bottom-left .mistore-search-bubble::after {
  left: 20px;
  right: auto;
  border-left-color: transparent;
  border-right-color: #fff;
  border-top-color: #fff;
  box-shadow: -1px 1px 0 0 #e0e0e0;
}

/* === Host-theme defensive overrides (mobile UI breakage fix) === */
.mistore-search-widget,
.mistore-search-widget * {
  text-align: left !important;
}
.mistore-search-widget .mistore-search-empty,
.mistore-search-widget .mistore-search-loading,
.mistore-search-widget .mistore-search-loading-text {
  text-align: center !important;
}
.mistore-search-product-link {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 12px !important;
}
.mistore-search-product-item .thumb {
  width: 56px !important;
  height: 56px !important;
  flex: 0 0 56px !important;
  display: flex !important;
}
.mistore-search-product-item .thumb img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover !important;
  display: block !important;
}
.mistore-search-product-item .info {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  display: block !important;
}

/* === 0.3.12: flex 子の width:100% 打ち消し（EC a span 干渉対策） === */
.mistore-search-widget a.mistore-search-product-link,
.mistore-search-widget .mistore-search-product-link.mistore-search-product-link--no-url {
  flex-wrap: nowrap !important;
}
.mistore-search-widget a.mistore-search-product-link > .thumb,
.mistore-search-widget a.mistore-search-product-link > .info,
.mistore-search-widget .mistore-search-product-link--no-url > .thumb,
.mistore-search-widget .mistore-search-product-link--no-url > .info {
  float: none !important;
  clear: none !important;
}
.mistore-search-widget a.mistore-search-product-link > .thumb,
.mistore-search-widget .mistore-search-product-link--no-url > .thumb {
  width: 56px !important;
  min-width: 56px !important;
  max-width: 56px !important;
  flex: 0 0 56px !important;
}
.mistore-search-widget a.mistore-search-product-link > .info,
.mistore-search-widget .mistore-search-product-link--no-url > .info {
  width: auto !important;
  max-width: none !important;
  flex: 1 1 0% !important;
  min-width: 0 !important;
}
.mistore-search-widget .mistore-search-product-item .info > * {
  width: auto !important;
  max-width: 100% !important;
  display: block !important;
  text-align: left !important;
}

/* === 0.3.13: EC テーマ link 色（白）干渉対策 === */
.mistore-search-widget {
  color: #333 !important;
}
.mistore-search-widget a.mistore-search-product-link,
.mistore-search-widget .mistore-search-product-link.mistore-search-product-link--no-url {
  color: #111 !important;
}
.mistore-search-widget .mistore-search-product-item .product-name,
.mistore-search-widget .mistore-search-product-item .mistore-search-price-row .price,
.mistore-search-widget .mistore-search-product-item .mistore-search-brand,
.mistore-search-widget .mistore-search-product-item .category,
.mistore-search-widget .mistore-search-product-item .mistore-search-ancillary {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}
.mistore-search-widget .mistore-search-product-item .mistore-search-price-row .price {
  color: #111 !important;
}
.mistore-search-widget .mistore-search-knowledge-item a,
.mistore-search-widget .mistore-search-knowledge-item a:visited,
.mistore-search-widget .mistore-search-knowledge-item a:hover {
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
}
.mistore-search-widget .mistore-search-knowledge-item .snippet,
.mistore-search-widget .mistore-search-knowledge-item .meta {
  color: #666 !important;
}

/* === 0.3.19: 検索バー固定＋その下を一体スクロール（PC/スマホ共通。詳細条件オープン時の商品閲覧改善） === */
.mistore-search-panel {
  max-height: var(--mistore-search-panel-max-h, 85vh);
}

  .mistore-search-panel-body {
    display: block;
    padding: 0 14px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* panel-top の箱を消し、検索バーをスクロール領域(panel-body)の直接の子にする。
     これで sticky の基準がスクロール全体になり、フィルタを開いても上端に固定され続ける。 */
  .mistore-search-panel-top {
    display: contents;
  }

  .mistore-search-bar {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #fff;
    margin: 0 -14px 8px;
    margin-top: 0;
    padding: 8px 14px;
    box-shadow: 0 1px 0 0 #e0e0e0;
  }

  /* 上 padding を検索バー直下へ移し、タイトルバー〜検索窓間の透けを防ぐ */
  .mistore-search-product-filters {
    margin-top: 4px;
  }

  .mistore-search-results {
    flex: none;
    min-height: 0;
  }

  .mistore-search-results-panels {
    overflow: visible;
    min-height: 0;
  }

  .mistore-search-results-panel {
    overflow: visible;
    min-height: 0;
  }

  .mistore-search-knowledge-list,
  .mistore-search-product-list {
    overflow: visible;
    min-height: 0;
  }

/* === 0.3.21: スマホ向けビューポート内収納（左右はみ出し・キーボード対策） === */
@media (max-width: 767px) {
  .mistore-search-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto !important;
    max-width: none;
    max-height: min(85dvh, var(--mistore-search-panel-max-h, 85dvh));
    overflow-x: hidden;
    z-index: 9999;
  }

  .mistore-search-widget--bottom-left .mistore-search-panel {
    left: 12px;
    right: 12px;
  }

  .mistore-search-bar {
    min-width: 0;
    width: 100%;
  }

  .mistore-search-bar input {
    min-width: 0;
    flex: 1 1 0%;
    font-size: 16px !important;
  }

  .mistore-search-shelf-life-filter input {
    font-size: 16px !important;
  }

  .mistore-search-bar button {
    flex-shrink: 0;
    padding: 10px 12px;
  }
}
