/* NINIPA 購物車工具（鎖稿分享 §3、§4）：只用 .nct-* 自己的 class；例外只有檔尾「前台第一批」那幾條（使用者指定的購物車外觀修正）。 */

/* §4 多選刪除＋勾選結帳（使用者 11/7：勾選框、全選一直顯示；叉叉那格改放勾選框） */
.nct-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.nct-top { justify-content: space-between; flex-wrap: wrap; }
.nct-top-r { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.nct-bottom { justify-content: flex-end; margin: 10px 0 14px; }
.nct-bar .button { margin: 0; min-height: 40px; line-height: 1.2; padding: 8px 16px; }
.nct-all { display: inline-flex; margin: 0 auto 0 0; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; min-height: 40px; }
.nct-all input { width: 20px; height: 20px; margin: 0; }
.nct-check { display: inline-block; margin: 0; padding: 6px; cursor: pointer; }
.nct-check input { width: 22px; height: 22px; margin: 0; vertical-align: middle; }
.nct-bottom, .woocommerce-cart-form .nct-bottom { display: none; }
.woocommerce-cart-form.nct-editing .nct-bottom { display: flex; }
.woocommerce-cart-form[data-nct="1"] td.product-remove a.remove { display: none !important; }
.woocommerce-cart-form.nct-editing .nct-edit { visibility: hidden; }
.nct-del:not([disabled]) { background: var(--nnp-danger, #B3261E); border-color: var(--nnp-danger, #B3261E); color: #fff; }
.nct-del[disabled] { opacity: .5; cursor: not-allowed; }
/* 每列右邊「刪除」文字鈕 */
.nct-row-del { display: block; margin: 6px 0 0 auto; padding: 0 4px; min-height: 36px; background: none; border: 0; color: var(--nnp-danger, #B3261E); font-size: 14px; font-weight: 400; text-decoration: underline; text-transform: none; letter-spacing: 0; cursor: pointer; box-shadow: none; }
.nct-row-del:hover { color: var(--nnp-danger, #B3261E); filter: brightness(.8); background: none; }
/* 前往結帳上方：已勾選 N 件／請勾選要結帳的商品 */
.nct-sum { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.nct-sum-empty { color: var(--nnp-danger, #B3261E); }
/* 沒全勾：藏整台車的總計表，只留「已勾選 N 件，商品小計」（使用者 11/7） */
.cart_totals.nct-partial table.shop_table { display: none !important; }
.cart_totals.nct-partial .nct-sum { font-size: 18px; color: var(--nnp-ink, #222); margin: 12px 0; }
.wc-proceed-to-checkout a.checkout-button.nct-disabled { opacity: .5; cursor: not-allowed; }
/* 2 秒自動消失的小提示 */
.nct-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 99999; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px; background: rgba(34, 34, 34, .92); color: #fff; font-size: 15px; line-height: 1.4; text-align: center; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); pointer-events: none; }

/* 網站風格確認框（取代瀏覽器內建 confirm；使用者 11/7） */
.nct-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .45); }
.nct-modal-box { width: 100%; max-width: 360px; background: #fff; border-radius: 14px; padding: 22px 20px 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.nct-modal-t { margin: 0 0 18px; font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--nnp-ink, #222); word-break: break-word; }
.nct-modal-btns { display: flex; gap: 10px; justify-content: flex-end; }
.nct-modal-btns button { min-height: 44px; min-width: 96px; padding: 0 18px; border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer; margin: 0; text-transform: none; letter-spacing: 0; }
.nct-modal-no { background: #fff; color: var(--nnp-ink, #222); border: 1px solid var(--nnp-line-strong, #ccc); }
.nct-modal-ok { background: var(--nnp-danger, #B3261E); color: #fff; border: 1px solid var(--nnp-danger, #B3261E); }
.nct-modal-no:hover { background: var(--nnp-stone, #f3f3f3); }
.nct-modal-ok:hover { background: var(--nnp-danger, #B3261E); border-color: var(--nnp-danger, #B3261E); filter: brightness(.85); }

/* §3 輸入稿件編號 */
.nct-codes { margin: 12px 0; }
.nct-codes-link { cursor: pointer; color: inherit; text-decoration: underline; display: inline-block; padding: 6px 0; list-style: none; }
.nct-codes-link::-webkit-details-marker { display: none; }
.nct-codes-body { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; max-width: 520px; }
.nct-codes-body textarea { width: 100%; min-height: 80px; box-sizing: border-box; font-family: monospace; text-transform: uppercase; }
.nct-codes-body .nct-load { align-self: flex-start; margin: 0; min-height: 40px; }

/* §3 稿件預覽區（沒有東西時伺服器根本不輸出） */
.nct-preview { margin: 16px 0; padding: 12px; border: 1px dashed var(--nnp-line-strong, #c3c4c7); border-radius: 6px; }
.nct-preview-title { font-size: 1rem; margin: 0 0 4px; }
.nct-preview-sub { font-size: .85em; color: var(--nnp-text, #666); margin: 0 0 10px; }
.nct-pv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.nct-pv-item { display: flex; gap: 10px; align-items: center; border: 1px solid var(--nnp-line, #e3e3e3); border-radius: 6px; padding: 8px; background: #fff; flex: 1 1 280px; min-width: 0; margin: 0; }
.nct-pv-item img { width: 56px; height: auto; max-height: 120px; border: 1px solid var(--nnp-line, #ddd); border-radius: 4px; -webkit-touch-callout: none; user-select: none; }
.nct-pv-noimg { width: 56px; height: 100px; background: var(--nnp-stone, #eee); border-radius: 4px; }
.nct-pv-meta { flex: 1; min-width: 0; font-size: .9em; word-break: break-all; }
.nct-pv-acts { display: flex; flex-direction: column; gap: 6px; }
.nct-pv-acts .button { margin: 0; font-size: .85em; padding: 6px 10px; min-height: 36px; }

/* 前台第一批（使用者指定修購物車外觀；以下是少數刻意覆蓋 Flatsome／WooCommerce 原本樣式的地方，只在購物車頁載入） */
/* #10：iPhone Safari 對字級 <16px 的輸入框一點就放大整頁 → 購物車頁所有輸入框（數量、稿件編號、折價券、搜尋）至少 16px */
body.woocommerce-cart input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=hidden]):not([type=image]),
body.woocommerce-cart textarea,
body.woocommerce-cart select { font-size: 16px !important; }
/* #21：「購物車總計」標題被畫成四邊框、像輸入框 → 只留下底線（跟「折價券」標題一樣的分隔線）；Flatsome 樣板有 style="border-width:3px" 所以要 !important */
.cart_totals table thead th { border-width: 0 0 3px !important; border-style: solid !important; border-color: var(--nnp-line, #ececec) !important; background: none; box-shadow: none; padding-left: 0; padding-right: 0; }
/* #21：iPhone／iPad 1px 橫向捲動——側欄「使用折價券」按鈕（input.is-form.expand）寬 100% 又帶 margin-right 1em，超出欄位約 0.5px，整頁變 391／821 寬 */
.cart-sidebar .coupon .is-form.expand, .cart-collaterals .coupon .is-form.expand { margin-right: 0; }

@media (max-width: 549px) {
  .nct-bar .button { min-height: 44px; }
  .nct-top .button { padding: 8px 12px; }
  /* A19 #5（使用者 11/8）：上方三顆（複製稿件編號／分享購物車／管理購物車）手機排一整行、等寬；「全選」在上一行 */
  .nct-top-r { width: 100%; flex-wrap: nowrap; gap: 6px; }
  .nct-top-r .button { flex: 1 1 0; min-width: 0; padding: 8px 4px; font-size: clamp(12px, 3.6vw, 14px); letter-spacing: 0; white-space: nowrap; }
  .nct-row-del { min-height: 44px; }
  .nct-bottom .button { flex: 1 1 0; }
  .nct-codes-body { max-width: none; }
}

/* 手機版購物車：每件商品排成一張卡片（左邊勾選框，右邊預覽圖＋商品資料，下面數量與按鈕）。老闆 11/8 17:57 要求重排 */
@media (max-width: 849px) {
  form.woocommerce-cart-form table.cart thead { display: none; }
  form.woocommerce-cart-form table.cart tr.cart_item { display: flex; flex-wrap: wrap; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--nnp-line, #eee); }
  form.woocommerce-cart-form table.cart tr.cart_item > td { display: block; border: 0; padding: 0; }
  form.woocommerce-cart-form table.cart tr.cart_item > td::before { display: none !important; }
  form.woocommerce-cart-form table.cart td.product-remove { width: 36px; flex: 0 0 36px; padding-top: 4px; }
  /* 老闆 11/11 04:11：有稿件的列不放商品圖（中間已有稿件預覽）；現貨商品照常在左邊放商品圖 */
  form.woocommerce-cart-form table.cart tr.ninipa-ed-has-design td.product-thumbnail { display: none !important; }
  form.woocommerce-cart-form table.cart tr.cart_item:not(.ninipa-ed-has-design) td.product-thumbnail { flex: 0 0 88px; width: 88px; margin-right: 12px; }
  form.woocommerce-cart-form table.cart tr.cart_item:not(.ninipa-ed-has-design) td.product-thumbnail img { width: 88px; max-width: 88px; height: auto; margin: 0; }
  form.woocommerce-cart-form table.cart td.product-price,
  form.woocommerce-cart-form table.cart td.product-subtotal { display: none !important; }
  form.woocommerce-cart-form table.cart td.product-name { flex: 1 1 0; min-width: 0 !important; text-align: left !important;
    display: grid !important; grid-template-columns: 88px 1fr; grid-template-areas: "pv title" "pv meta" "btn btn"; column-gap: 12px; align-items: start; }
  form.woocommerce-cart-form table.cart tr.cart_item:not(.ninipa-ed-has-design) td.product-name { grid-template-columns: 1fr; grid-template-areas: "title" "meta" "btn"; }
  td.product-name > a { grid-area: title; font-size: 15px; line-height: 1.4; font-weight: 600; }
  td.product-name > .ninipa-ed-cart-preview { grid-area: pv; margin: 0; }
  td.product-name > .ninipa-ed-cart-preview img { max-width: 88px; max-height: 120px; margin: 0; }
  td.product-name > dl.variation { grid-area: meta; display: grid; grid-template-columns: auto 1fr; gap: 2px 6px; margin: 6px 0 0; font-size: 13px; line-height: 1.45; color: var(--nnp-text, #666); }
  td.product-name > dl.variation dt, td.product-name > dl.variation dd { margin: 0; padding: 0; float: none; font-weight: normal; }
  td.product-name > dl.variation dd p { margin: 0; word-break: break-all; }
  td.product-name > .ninipa-ed-cart-btns { grid-area: btn; flex-direction: row; max-width: none; margin: 10px 0 0; gap: 8px; }
  td.product-name > .ninipa-ed-cart-btns .cart-design-button { flex: 1 1 0; min-height: 40px; display: flex; align-items: center; justify-content: center; padding: 0 8px; line-height: 1.2; }
  form.woocommerce-cart-form table.cart td.product-quantity { flex: 0 0 100%; display: flex !important; align-items: center; justify-content: space-between; padding: 10px 0 0 36px; }
  form.woocommerce-cart-form table.cart td.product-quantity .quantity { margin: 0; }
}
.nct-all-n { font-weight: 400; color: var(--nnp-text, #666); }   /* 老闆 11/10：全選旁「（已選 N 件商品）」 */
