/**
 * 超商門市選擇器樣式
 *
 * @package AlphaBoltTest
 */

/* 門市選擇器容器 */
.abt-store-selector {
  margin-top: 10px;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

/* 選擇門市按鈕 */
.abt-select-store-btn,
.abt-change-store-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.abt-select-store-btn:hover,
.abt-change-store-btn:hover {
  background: #f0f0f0;
  border-color: #999;
}

.abt-select-store-btn::before {
  content: '\1F4CD';
  font-size: 16px;
}

.abt-change-store-btn {
  padding: 6px 12px;
  font-size: 13px;
}

/* 已選擇門市顯示 */
.abt-selected-store {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.abt-store-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.abt-store-label {
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

.abt-store-name-display {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.abt-store-address-display {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

/* Modal */
.abt-store-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.abt-store-modal-content {
  position: relative;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.abt-store-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  font-size: 24px;
  line-height: 1;
  color: #666;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.abt-store-modal-close:hover {
  color: #333;
}

/* 門市選項列表（PChomePay 內建選擇器） */
.abt-store-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.abt-store-list-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.abt-store-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.abt-store-option:hover {
  background: #e8f4fd;
  border-color: #2196f3;
}

.abt-store-option-name {
  font-weight: 600;
  color: #333;
}

.abt-store-option-address {
  font-size: 13px;
  color: #666;
}

/* Block Checkout 適配 */
.wc-block-components-shipping-rates-control .abt-store-selector {
  margin-top: 8px;
  margin-left: 28px;
}

/* 載入中狀態 */
.abt-store-selector.loading .abt-select-store-btn,
.abt-store-selector.loading .abt-change-store-btn {
  pointer-events: none;
  opacity: 0.6;
}

.abt-store-selector.loading .abt-select-store-btn::after,
.abt-store-selector.loading .abt-change-store-btn::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #ccc;
  border-top-color: #333;
  border-radius: 50%;
  animation: abt-spin 0.8s linear infinite;
  margin-left: 6px;
}

@keyframes abt-spin {
  to {
    transform: rotate(360deg);
  }
}

/* 驗證錯誤狀態 */
.abt-store-selector.has-error {
  border-color: #dc3545;
  background: #fff5f5;
}

.abt-store-selector.has-error .abt-select-store-btn {
  border-color: #dc3545;
  color: #dc3545;
}

/* RWD */
@media (max-width: 600px) {
  .abt-selected-store {
    flex-direction: column;
    gap: 10px;
  }

  .abt-change-store-btn {
    align-self: flex-start;
  }

  .abt-store-modal-content {
    width: 95%;
    padding: 16px;
  }
}
