/* Site-owner overrides. Safe from template updates — add your own rules here. */

/* ==========================================================================
   帳號登入 — 右上角連結 + PChome 風格登入頁
   顏色沿用網站品牌變數（--ui-accent），維持全站一致而非 PChome 紅。
   ========================================================================== */

/* 右上角「登入 / 登出」文字連結：放在 header-actions，做成藥丸狀輕量按鈕 */
.header-actions .account-link {
  width: auto;
  height: 34px;
  padding: 0 .75rem;
  border: 1px solid var(--ui-accent);
  border-radius: 999px;
  color: var(--ui-accent);
  font-weight: 600;
  font-size: .8rem;
  line-height: 1;
  white-space: nowrap;
}
.header-actions .account-link:hover {
  background: var(--ui-accent);
  color: #fff;
}

/* ==========================================================================
   已登入帳號選單 — 頭像圓圈 + 下拉（仿 Google 帳號選單）
   ========================================================================== */

.account-menu {
  position: relative;
  display: inline-flex;
}

/* 頭像：品牌色圓底 + 名稱首字。當作按鈕，不用 icon-btn 的方形樣式。 */
.account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ui-accent);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  /* 對焦光暈沿用全站 accent ring，維持一致 */
  transition: box-shadow .15s, background .15s;
}
.account-avatar:hover {
  background: var(--ui-accent-hover, #005ad1);
}
.account-avatar:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ui-accent-ring, rgba(0, 111, 255, .35));
}
.account-avatar__initial {
  transform: translateY(.5px); /* 視覺置中：字母基線微調 */
}

/* 下拉卡片：貼齊頭像右緣，往下展開 */
.account-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 264px;
  padding: .5rem;
  background: var(--ui-surface, #fff);
  border: 1px solid var(--ui-line, rgba(0, 0, 0, .08));
  border-radius: 14px;
  box-shadow: var(--ui-shadow-3, 0 8px 28px rgba(0, 0, 0, .16));
}

/* 頂部使用者資訊列 */
.account-dropdown__head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .6rem .8rem;
  border-bottom: 1px solid var(--ui-line, rgba(0, 0, 0, .07));
  margin-bottom: .4rem;
}
.account-avatar--lg {
  width: 44px;
  height: 44px;
  font-size: 1.15rem;
  flex: 0 0 auto;
  cursor: default;
}
.account-avatar--lg:hover { background: var(--ui-accent); }
.account-dropdown__id {
  min-width: 0; /* 允許長字串以 ellipsis 收斂 */
}
.account-dropdown__name {
  display: block;
  font-size: .95rem;
  color: var(--ui-ink, #1f2328);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-dropdown__email {
  display: block;
  font-size: .8rem;
  color: var(--ui-ink-3, #6b7280);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 選單項目 */
.account-dropdown__item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .6rem;
  border-radius: 9px;
  color: var(--ui-ink, #333);
  font-size: .9rem;
  text-decoration: none;
}
.account-dropdown__item svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--ui-ink-3, #6b7280);
}
.account-dropdown__item:hover {
  background: var(--ui-accent-soft, rgba(0, 111, 255, .08));
  color: var(--ui-accent);
}
.account-dropdown__item:hover svg { color: var(--ui-accent); }
.account-dropdown__item--logout:hover {
  background: rgba(220, 38, 38, .08);
  color: #dc2626;
}
.account-dropdown__item--logout:hover svg { color: #dc2626; }

/* 登入頁：置中卡片，內容區給淺灰底襯托卡片（模擬 PChome 版面） */
.pchome-login {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(2rem, 6vw, 4rem) 1rem;
  background: var(--ui-surface-2);
}
.pchome-login__card {
  width: 100%;
  max-width: 400px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  box-shadow: var(--ui-shadow-2);
  padding: 2.5rem 2rem;
}
.pchome-login__title {
  margin: 0 0 .5rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
}
.pchome-login__register {
  margin: 0 0 1.75rem;
  text-align: center;
  font-size: .9rem;
  color: var(--ui-ink-2);
}
.pchome-login__register a {
  color: var(--ui-accent);
  font-weight: 600;
  text-decoration: none;
}
.pchome-login__register a:hover { text-decoration: underline; }

.pchome-login__field { margin-bottom: 1rem; }
.pchome-login__input {
  width: 100%;
  padding: .8rem 1rem;
  border: 1px solid var(--ui-line-strong);
  background: var(--ui-surface);
  color: var(--ui-ink);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.pchome-login__input:focus {
  outline: none;
  border-color: var(--ui-accent);
  box-shadow: var(--ui-accent-ring, rgba(0, 111, 255, .35)) 0 0 0 3px;
}

.pchome-login__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: .25rem 0 1.5rem;
  font-size: .9rem;
}
.pchome-login__remember {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  cursor: pointer;
  color: var(--ui-ink);
}
.pchome-login__forgot {
  color: var(--ui-accent);
  text-decoration: none;
}
.pchome-login__forgot:hover { text-decoration: underline; }

.pchome-login__submit {
  width: 100%;
  padding: .85rem;
  border: none;
  border-radius: 8px;
  background: var(--ui-accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.pchome-login__submit:hover { background: var(--ui-accent-hover, #005ad1); }

.pchome-login__terms {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--ui-ink-3);
}

/* 無障礙：隱藏 label 但保留給螢幕報讀器（避免依賴外部框架的同名類別） */
.pchome-login .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 結帳付款方式：說明文字、分期下拉、提交按鈕排同一列，下拉不撐滿整列 */
.hikashop_checkout_payment_description { display: inline-block; vertical-align: middle; }
.hikashop_checkout_payment_custom { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .5rem; vertical-align: middle; margin-left: 1rem; }
.hikashop_checkout_payment_custom .taishin_install_period { margin-left: 0 !important; display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.hikashop_checkout_payment_custom select { width: auto; min-width: 8rem; }
.hikashop_checkout_payment_custom .hikashop_checkout_payment_submit { display: inline-block; }

/* 結帳地址清單（覆寫 html/com_hikashop/checkout/address_view.php）
   編輯／刪除原本只有 16px 圖示、沒有文字，在這個樣板上幾乎看不見，補上文字並拉開間距。 */
.uistore-address-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-left: .75rem;
  white-space: nowrap;
  text-decoration: none;
}
.uistore-address-btn:first-child { margin-left: 0; }
.uistore-address-btn img { width: 16px; height: 16px; }

/* 缺必填欄位、不能拿來結帳的那筆 */
.uistore-address-incomplete {
  margin-top: .4rem;
  padding: .45rem .6rem;
  border-left: 3px solid var(--ui-red);
  background: color-mix(in srgb, var(--ui-red) 10%, var(--ui-surface));
  color: var(--ui-red);
  font-size: .9em;
  line-height: 1.5;
}

/* 結帳頁的登入／註冊畫面（html/com_hikashop/checkout/show_block_login.php）：
   一次只顯示一個表單，置中卡片；換畫面走 checkout&auth=login|register 整頁連結 */
.hikashop_checkout_login .uistore-auth {
  max-width: 460px;
  margin: 1rem auto 2rem;
  padding: 2rem 1.75rem;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  box-shadow: var(--ui-shadow-2);
}
.hikashop_checkout_login .uistore-auth--register { max-width: 620px; }
.hikashop_checkout_login .uistore-auth__title {
  margin: 0 0 .5rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
}
.hikashop_checkout_login .uistore-auth__switch {
  margin: 0 0 .35rem;
  text-align: center;
  font-size: .95rem;
  color: var(--ui-ink-2);
}
.hikashop_checkout_login .uistore-auth__switch a {
  color: var(--ui-accent);
  font-weight: 600;
  text-decoration: none;
}
.hikashop_checkout_login .uistore-auth__switch a:hover { text-decoration: underline; }
.hikashop_checkout_login .uistore-auth__hint {
  margin: 0 0 1.5rem;
  text-align: center;
  font-size: .85rem;
  color: var(--ui-ink-3);
}
/* HikaShop 表單欄位：標籤在上、輸入框滿版（原本是左右各佔 4／8 欄，卡片內太窄） */
.hikashop_checkout_login .uistore-auth .hkform-group { margin-bottom: 1rem; }
.hikashop_checkout_login .uistore-auth [class*="hkc-sm-"] { width: 100%; max-width: 100%; flex: 0 0 100%; float: none; }
.hikashop_checkout_login .uistore-auth .hkcontrol-label { text-align: left; margin-bottom: .3rem; }
.hikashop_checkout_login .uistore-auth input[type="text"],
.hikashop_checkout_login .uistore-auth input[type="password"],
.hikashop_checkout_login .uistore-auth input[type="email"],
.hikashop_checkout_login .uistore-auth select {
  width: 100%;
  padding: .7rem .9rem;
  border: 1px solid var(--ui-line-strong);
  background: var(--ui-surface);
  color: var(--ui-ink);
  border-radius: 8px;
  font-size: 1rem;
}
.hikashop_checkout_login .uistore-auth button[type="submit"],
.hikashop_checkout_login .uistore-auth .hikabtn_checkout_login_form,
.hikashop_checkout_login .uistore-auth #hikashop_register_form_button {
  width: 100%;
  padding: .85rem;
  border: none;
  border-radius: 8px;
  background: var(--ui-accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}
/* Passkey 登入鈕：核心給的 SVG 沒有尺寸，會撐成幾百 px 的大圖 */
.hikashop_checkout_login .uistore-auth .plg_system_webauthn_login_button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
}
.hikashop_checkout_login .uistore-auth .plg_system_webauthn_login_button svg,
.hikashop_checkout_login .uistore-auth .plg_system_webauthn_login_button img {
  width: 1.4rem;
  height: 1.4rem;
  flex: 0 0 auto;
}
