/* ===================================================
   Icon Button Shared Tokens
   Search icon と Filter drawer button を統一するための変数。
   サイズ・色をここ一箇所で管理する。
   =================================================== */
:root {
  --brand-icon-btn-width:     36px;
  --brand-icon-btn-height:    34px;
  --brand-icon-btn-bg:        #20a2dc80;
  --brand-icon-btn-radius:    8px;
  --brand-icon-btn-color:     #fff;
  --brand-icon-btn-icon-size: 16px;
}

/* Tablet: 48x48px（Global Header のハンバーガーボタンに合わせたタッチターゲット） */
@media (min-width: 690px) and (max-width: 999px) {
  :root {
    --brand-icon-btn-width:     48px;
    --brand-icon-btn-height:    48px;
    --brand-icon-btn-icon-size: 20px;
  }
}

/* オーバーレイ */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 999;
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ドロワーメニュー本体 */
.drawer-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  max-width: 85vw;
  height: 100%;
  background: white;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease-out;
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.drawer-menu.active {
  transform: translateX(0);
}

/* ドロワーヘッダー */
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.drawer-title {
  font-size: 24px;
  font-weight: bold;
  margin: 0;
  color: #000;
}

.drawer-clear-all {
  color: #68bedf;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.3s;
}

.drawer-clear-all:hover {
  opacity: 0.7;
}

.drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}

.drawer-close:hover {
  opacity: 0.7;
}

/* ドロワーコンテンツ */
.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}


.drawer-section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
  padding: 8px 16px;
  background: #c4e9fb;
  color: #000;
  border-radius: 4px;
}

.drawer-facet {
  padding-left: 20px;
  padding-right: 20px;

  .facetwp-facet {
    margin-bottom: 16px;
  }
}

/* ドロップダウン */
.drawer-dropdown {
  margin-bottom: 12px;
}

.drawer-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  transition: border-color 0.3s;
}

.drawer-select:hover,
.drawer-select:focus {
  border-color: #00bcd4;
  outline: none;
}

/* Body scroll lock when drawer is open */
body.drawer-open {
  overflow: hidden;
}

/* レスポンシブ */
@media (max-width: 768px) {
  .drawer-menu {
    width: 100%;
    max-width: 80vw;
  }
}

/* ===================================================
   Active Filter Chips (Tablet / Mobile only)
   =================================================== */

/* Container: PC では非表示 */
.brand-active-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 32px; /* チップがゼロでも行の高さを維持 */
}

@media (min-width: 1000px) {
  .brand-active-chips {
    display: none;
  }
}

/* 個別チップ */
.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #d9eef8;
  color: #1a3c55;
  border-radius: 16px;
  padding: 4px 8px 4px 12px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;

  @media (min-width: 690px) and (max-width: 999px) {
    font-size: 16px;
  }
}

/* チップ内ラベル */
.brand-chip-label {
  line-height: 1.2;
}

/* チップ内 X ボタン */
.brand-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  background: rgba(0, 0, 0, 0.15);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: inherit;
  transition: background 0.2s;
}

.brand-chip-remove:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Chip decorations by facet type */

/* Search: 🔍"query" */
.brand-chip[data-facet="brand_search"] .brand-chip-label::before {
  content: '🔍"';
}
.brand-chip[data-facet="brand_search"] .brand-chip-label::after {
  content: '"';
}

/* Context: #label */
.brand-chip[data-facet="brand_contexts"] .brand-chip-label::before {
  content: '#';
}

/* Category: fa-folder-open + label */
.brand-chip[data-facet="brand_categories"] .brand-chip-label::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  content: '\f07c';
  padding-right: 3px;
}

/* ===================================================
   Brand Filter Bar ([brand_filter_bar] shortcode)
   chips(grow) | drawer-trigger button(fixed right) を
   同一行に並べるレイアウト
   =================================================== */

/*
 * Elementor の shortcode ウィジェット自体を full-width にする。
 * チップがゼロのとき width: auto（＝ボタン幅）に縮んで左寄りになるのを防ぐ。
 */
.brand-search-container .elementor-hidden-desktop .elementor-widget-shortcode {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.brand-search-container .elementor-hidden-desktop .elementor-widget-container,
.brand-search-container .elementor-hidden-desktop .elementor-shortcode {
  width: 100%;
}

.brand-filter-bar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.brand-filter-bar .brand-active-chips {
  flex: 1 1 auto;
  min-width: 0;
}

/* ===================================================
   Drawer Trigger Button
   Search icon (.facetwp-icon) と同サイズ・同スタイル。
   CSS Custom Properties で一元管理。
   =================================================== */
.brand-filter-bar .drawer-trigger {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--brand-icon-btn-width);
  height: var(--brand-icon-btn-height);
  padding: 0;
  background: var(--brand-icon-btn-bg);
  border: none;
  border-radius: var(--brand-icon-btn-radius);
  cursor: pointer;
  color: var(--brand-icon-btn-color);
  font-size: var(--brand-icon-btn-icon-size);
}
