/* ========================================
 * EC-CUBE BtoB受注サイト - 共通コンポーネント
 * ======================================== */

/* ========================================
 * ヘッダー
 * ======================================== */
.btob-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--btob-header-height);
  padding: 0 var(--btob-space-md);
  background: var(--btob-bg-white);
  border-bottom: 1px solid var(--btob-border-light);
  z-index: var(--btob-z-header);
}

/* ハンバーガーメニュー */
.btob-header__menu {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--btob-touch-target);
  height: var(--btob-touch-target);
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}

.btob-header__menu-icon {
  position: relative;
  width: 22px;
  height: 2px;
  background: var(--btob-text);
  transition: background var(--btob-transition-fast);
}

.btob-header__menu-icon::before,
.btob-header__menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: var(--btob-text);
  transition: transform var(--btob-transition-fast);
}

.btob-header__menu-icon::before {
  top: -7px;
}

.btob-header__menu-icon::after {
  top: 7px;
}

/* メニュー開いた時のX */
.btob-header__menu.is-open .btob-header__menu-icon {
  background: transparent;
}

.btob-header__menu.is-open .btob-header__menu-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.btob-header__menu.is-open .btob-header__menu-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

@media (min-width: 992px) {
  .btob-header__menu {
    display: none;
  }
}

/* サイトタイトル */

.btob-header__home:hover {
  text-decoration: none;
}

.btob-header__title {
  font-size: 11px;
  font-weight: var(--btob-font-weight-bold);
  color: var(--btob-primary);
  line-height: 1.2;
  max-width: 70px;
  margin: 0;
}

/* ナビゲーション */
.btob-header__nav {
  display: flex;
  align-items: center;
  gap: var(--btob-space-xs);
}

.btob-header__nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--btob-touch-target);
  height: var(--btob-touch-target);
  color: var(--btob-text);
  transition: color var(--btob-transition-fast);
}

.btob-header__nav-item:hover {
  color: var(--btob-primary);
  text-decoration: none;
}

.btob-header__nav-item svg {
  width: 24px;
  height: 24px;
}

/* カートアイコン */
.btob-header__cart {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--btob-touch-target);
  height: var(--btob-touch-target);
  color: var(--btob-text);
  transition: color var(--btob-transition-fast);
}

.btob-header__cart:hover {
  color: var(--btob-primary);
  text-decoration: none;
}

.btob-header__cart svg {
  width: 24px;
  height: 24px;
}

.btob-header__cart-badge {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--btob-error);
  border-radius: var(--btob-radius-pill);
  font-size: 10px;
  font-weight: var(--btob-font-weight-bold);
  color: var(--btob-bg-white);
  line-height: 18px;
  text-align: center;
}

.btob-header__cart-badge.is-hidden {
  display: none;
}

/* PC版ヘッダー */
@media (min-width: 992px) {
  .btob-header {
    padding: 0 var(--btob-space-xl);
  }

  .btob-header__title {
    font-size: var(--btob-font-size-xl);
    max-width: none;
    white-space: nowrap;
  }

  .btob-header__nav {
    gap: var(--btob-space-sm);
  }
}

/* ========================================
 * ドロワーメニュー
 * ======================================== */
.btob-drawer-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--btob-z-modal) - 1);
}

.btob-drawer-overlay.is-visible {
  display: block;
}

.btob-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 85%;
  max-width: 320px;
  background: var(--btob-bg-white);
  z-index: var(--btob-z-modal);
  transform: translateX(100%);
  transition: transform var(--btob-transition-normal);
  overflow-y: auto;
}

.btob-drawer.is-open {
  transform: translateX(0);
}

/* ドロワーヘッダー */
.btob-drawer__header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: var(--btob-space-sm);
  border-bottom: 1px solid var(--btob-border-light);
}

.btob-drawer__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--btob-border);
  border-radius: var(--btob-radius-pill);
  color: var(--btob-text);
  cursor: pointer;
  transition: all var(--btob-transition-fast);
}

.btob-drawer__close:hover {
  background: var(--btob-bg);
  border-color: var(--btob-text);
}

/* ドロワー検索 */
.btob-drawer__search {
  padding: var(--btob-space-md);
  background: var(--btob-bg-white);
}

.btob-drawer__category {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 var(--btob-space-xl) 0 var(--btob-space-md);
  margin-bottom: var(--btob-space-sm);
  background: var(--btob-text);
  border: none;
  border-radius: 0;
  font-size: var(--btob-font-size-md);
  font-weight: var(--btob-font-weight-bold);
  color: var(--btob-bg-white);
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23fff' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.btob-drawer__keyword {
  display: flex;
  align-items: center;
  background: var(--btob-bg-white);
  border: 1px solid var(--btob-border);
}

.btob-drawer__keyword input {
  flex: 1;
  height: 44px;
  padding: 0 var(--btob-space-md);
  border: none;
  font-size: var(--btob-font-size-md);
  background: transparent;
}

.btob-drawer__keyword input::placeholder {
  color: var(--btob-text-muted);
}

.btob-drawer__keyword input:focus {
  outline: none;
}

.btob-drawer__keyword button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--btob-text);
  cursor: pointer;
}

/* ドロワーナビ */
.btob-drawer__nav {
  display: flex;
  flex-direction: column;
}

.btob-drawer__section {
  display: flex;
  flex-direction: column;
}

.btob-drawer__section--dark {
  background: var(--btob-text);
}

.btob-drawer__link {
  display: flex;
  align-items: center;
  padding: var(--btob-space-md) var(--btob-space-lg);
  font-size: var(--btob-font-size-md);
  color: var(--btob-text);
  text-decoration: none;
  border-bottom: 1px solid var(--btob-border-light);
  transition: background var(--btob-transition-fast);
}

.btob-drawer__link:hover {
  background: var(--btob-bg);
  text-decoration: none;
}

.btob-drawer__section--dark .btob-drawer__link {
  color: var(--btob-bg-white);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.btob-drawer__section--dark .btob-drawer__link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btob-drawer__link--icon {
  gap: var(--btob-space-md);
}

.btob-drawer__link--icon svg {
  flex-shrink: 0;
  opacity: 0.7;
}

@media (min-width: 992px) {
  .btob-drawer,
  .btob-drawer-overlay {
    display: none !important;
  }
}

/* ========================================
 * 検索バー
 * ======================================== */
.btob-search {
  display: flex;
  align-items: center;
  height: var(--btob-search-height);
  margin: 0 var(--btob-space-lg) var(--btob-space-md);
  background: var(--btob-bg-white);
  border: 2px solid var(--btob-border);
  border-radius: var(--btob-radius-md);
  overflow: hidden;
  transition: border-color var(--btob-transition-fast), box-shadow var(--btob-transition-fast);
}

@media (min-width: 992px) {
  .btob-search {
    margin: var(--btob-space-md) var(--btob-space-lg);
  }
}

.btob-search:focus-within {
  border-color: var(--btob-primary);
  box-shadow: 0 0 0 3px var(--btob-primary-light);
}

/* カテゴリセレクト */
.btob-search__category {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--btob-space-sm) 0 var(--btob-space-md);
  background: var(--btob-bg);
  border: none;
  border-right: 1px solid var(--btob-border);
  font-size: var(--btob-font-size-sm);
  color: var(--btob-text);
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23666' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
  min-width: 90px;
}

.btob-search__category:focus {
  outline: none;
  background-color: var(--btob-primary-light);
}

/* 検索アイコン */
.btob-search__icon {
  flex-shrink: 0;
  padding-left: var(--btob-space-md);
  color: var(--btob-text-muted);
  font-size: var(--btob-font-size-lg);
}

/* 検索入力 */
.btob-search__input {
  flex: 1;
  height: 100%;
  min-width: 0;
  padding: 0 var(--btob-space-sm);
  border: none;
  background: transparent;
  font-size: var(--btob-font-size-md);
}

.btob-search__input::placeholder {
  color: var(--btob-text-muted);
}

.btob-search__input:focus {
  outline: none;
}

/* 検索ボタン */
.btob-search__btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--btob-space-lg);
  height: 100%;
  background: var(--btob-primary);
  border: none;
  border-radius: 0;
  color: var(--btob-bg-white);
  font-size: var(--btob-font-size-sm);
  font-weight: var(--btob-font-weight-bold);
  cursor: pointer;
  transition: background var(--btob-transition-fast);
}

.btob-search__btn:hover {
  background: var(--btob-primary-hover);
}

.btob-search__btn:active {
  background: var(--btob-primary-active);
}

/* ========================================
 * カテゴリタブ
 * ======================================== */
.btob-categories {
  display: flex;
  gap: var(--btob-space-sm);
  padding: var(--btob-space-md) var(--btob-space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--btob-bg-white);
  border-bottom: 1px solid var(--btob-border-light);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.btob-categories::-webkit-scrollbar {
  display: none;
}

.btob-categories__filter {
  display: flex;
  align-items: center;
  gap: var(--btob-space-xs);
  padding: 0 var(--btob-space-md);
  height: 36px;
  background: var(--btob-bg-white);
  border: 1px solid var(--btob-border);
  border-radius: var(--btob-radius-sm);
  font-size: var(--btob-font-size-sm);
  color: var(--btob-text);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--btob-transition-fast);
}

.btob-categories__filter:hover {
  border-color: var(--btob-primary);
}

.btob-categories__tab {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--btob-space-lg);
  height: 36px;
  background: var(--btob-bg-white);
  border: 1px solid var(--btob-border);
  border-radius: var(--btob-radius-pill);
  font-size: var(--btob-font-size-sm);
  color: var(--btob-text);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--btob-transition-fast);
}

.btob-categories__tab:hover {
  border-color: var(--btob-primary);
}

.btob-categories__tab.is-active {
  background: var(--btob-primary);
  border-color: var(--btob-primary);
  color: var(--btob-bg-white);
}

.btob-categories__count {
  margin-left: 2px;
}

/* ========================================
 * 結果バー
 * ======================================== */
.btob-result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--btob-space-md) var(--btob-space-lg);
  background: var(--btob-bg-white);
  border-bottom: 1px solid var(--btob-border-light);
}

.btob-result-bar__count {
  font-size: var(--btob-font-size-sm);
  color: var(--btob-text-secondary);
}

.btob-result-bar__count strong {
  color: var(--btob-primary);
  font-weight: var(--btob-font-weight-bold);
}

.btob-result-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--btob-space-md);
}

.btob-result-bar__toggles {
  display: flex;
  gap: var(--btob-space-xs);
}

.btob-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--btob-space-xs);
  padding: var(--btob-space-xs) var(--btob-space-sm);
  background: var(--btob-bg);
  border: 1px solid var(--btob-border);
  border-radius: var(--btob-radius-sm);
  font-size: var(--btob-font-size-xs);
  color: var(--btob-text-muted);
  cursor: pointer;
  transition: all var(--btob-transition-fast);
}

.btob-toggle-btn:hover {
  border-color: var(--btob-primary);
}

.btob-toggle-btn.is-active {
  background: var(--btob-primary-light);
  border-color: var(--btob-primary);
  color: var(--btob-primary);
}

.btob-result-bar__sort {
  height: 32px;
  padding: 0 var(--btob-space-md);
  border: 1px solid var(--btob-border);
  border-radius: var(--btob-radius-sm);
  font-size: var(--btob-font-size-sm);
  background: var(--btob-bg-white);
  cursor: pointer;
}

/* ========================================
 * 数量入力
 * ======================================== */
.btob-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--btob-border);
  border-radius: var(--btob-radius-sm);
  overflow: hidden;
}

.btob-qty__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--btob-touch-target);
  height: var(--btob-input-height);
  background: var(--btob-bg);
  border: none;
  font-size: var(--btob-font-size-lg);
  color: var(--btob-text);
  cursor: pointer;
  transition: background var(--btob-transition-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btob-qty__btn:hover {
  background: var(--btob-border);
}

.btob-qty__btn:active {
  background: var(--btob-border);
}

.btob-qty__input {
  width: 50px;
  height: var(--btob-input-height);
  padding: 0;
  border: none;
  border-left: 1px solid var(--btob-border);
  border-right: 1px solid var(--btob-border);
  text-align: center;
  font-size: var(--btob-font-size-md);
  font-weight: var(--btob-font-weight-medium);
  font-family: inherit;
  -moz-appearance: textfield;
}

.btob-qty__input::-webkit-outer-spin-button,
.btob-qty__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btob-qty__input:focus {
  outline: none;
  background: var(--btob-primary-light);
}

/* ========================================
 * セレクト
 * ======================================== */
.btob-select {
  height: var(--btob-input-height);
  padding: 0 var(--btob-space-xl) 0 var(--btob-space-md);
  border: 1px solid var(--btob-border);
  border-radius: var(--btob-radius-sm);
  background: var(--btob-bg-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
  font-size: var(--btob-font-size-md);
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.btob-select:focus {
  outline: none;
  border-color: var(--btob-primary);
}

/* ========================================
 * ボタン
 * ======================================== */
.btob-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--btob-space-xs);
  height: var(--btob-btn-height);
  padding: 0 var(--btob-space-xl);
  border: none;
  border-radius: var(--btob-radius-sm);
  font-size: var(--btob-font-size-md);
  font-weight: var(--btob-font-weight-bold);
  cursor: pointer;
  transition: all var(--btob-transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.btob-btn--primary {
  background: var(--btob-primary);
  color: var(--btob-bg-white);
}

.btob-btn--primary:hover {
  background: var(--btob-primary-hover);
  text-decoration: none;
}

.btob-btn--primary:active {
  background: var(--btob-primary-active);
}

.btob-btn--primary:disabled {
  background: var(--btob-border);
  color: var(--btob-text-muted);
  cursor: not-allowed;
}

.btob-btn--primary.is-loading {
  pointer-events: none;
}

.btob-btn--primary.is-loading .btob-btn__icon::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btob-spin 0.8s linear infinite;
}

.btob-btn--primary.is-loading .btob-btn__icon svg {
  display: none;
}

.btob-btn--primary.is-added {
  background: var(--btob-success);
}

.btob-btn--secondary {
  background: var(--btob-bg-white);
  border: 1px solid var(--btob-border);
  color: var(--btob-text);
}

.btob-btn--secondary:hover {
  border-color: var(--btob-primary);
  color: var(--btob-primary);
  text-decoration: none;
}

/* ========================================
 * バッジ
 * ======================================== */
.btob-badge {
  display: inline-block;
  padding: var(--btob-space-xs) var(--btob-space-sm);
  background: var(--btob-bg);
  border-radius: var(--btob-radius-sm);
  font-size: var(--btob-font-size-sm);
  color: var(--btob-text-secondary);
  line-height: 1.4;
}

.btob-badge--info {
  background: var(--btob-primary-light);
  color: var(--btob-primary);
}

/* ========================================
 * トースト通知
 * ======================================== */
.btob-toast {
  position: fixed;
  bottom: calc(var(--btob-footer-height) + var(--btob-space-lg));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: var(--btob-space-md) var(--btob-space-xl);
  background: var(--btob-text);
  border-radius: var(--btob-radius-md);
  color: var(--btob-bg-white);
  font-size: var(--btob-font-size-md);
  font-weight: var(--btob-font-weight-medium);
  box-shadow: var(--btob-shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all var(--btob-transition-normal);
  z-index: var(--btob-z-toast);
}

.btob-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.btob-toast--success {
  background: var(--btob-success);
}

.btob-toast--error {
  background: var(--btob-error);
}

/* ========================================
 * 固定フッター（一括カート追加）
 * ======================================== */
.btob-bulk-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--btob-space-lg);
  height: var(--btob-footer-height);
  padding: 0 var(--btob-space-lg);
  background: var(--btob-bg-white);
  border-top: 1px solid var(--btob-border);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(100%);
  transition: transform var(--btob-transition-normal);
  z-index: var(--btob-z-footer);
}

.btob-bulk-footer.is-visible {
  transform: translateY(0);
}

.btob-bulk-footer.is-loading {
  opacity: 0.9;
  pointer-events: none;
}

.btob-bulk-footer__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btob-bulk-footer__count {
  font-size: var(--btob-font-size-sm);
  color: var(--btob-text-secondary);
}

.btob-bulk-footer__total {
  font-size: var(--btob-font-size-lg);
  font-weight: var(--btob-font-weight-bold);
  color: var(--btob-primary);
}

.btob-bulk-footer__btn {
  flex-shrink: 0;
}
