/* ==========================================================================
   Australian Spirulina — 購物車樣式
   接在 material-kit.css 與 main.css 之後載入，只補購物車自己需要的部分。
   品牌色沿用主站的 #007b5e。
   ========================================================================== */

:root {
  --asp-green: #007b5e;
  --asp-green-dark: #00614a;
  --asp-green-light: #e6f3ef;
  --asp-ink: #21332d;
  --asp-muted: #5c6e67; /* 對白底 5.4:1，原本的 #6b7d76 只有 4.0:1 不合格 */
  --asp-line: #dfe8e4;
  --asp-bg: #f7faf9;
  --asp-radius: 8px;
}

body.asp-cart {
  background: var(--asp-bg);
  color: var(--asp-ink);
  -webkit-text-size-adjust: 100%;
}

body.asp-cart p,
body.asp-cart li {
  color: var(--asp-ink);
}

/* ---------- 品牌導覽列 ---------------------------------------------------- */

/* 購物車沿用主站的深綠色品牌列，保留原本的 Cart 與數量提示。 */
body.asp-cart .navbar.bg-white {
  min-height: 96px;
  color: #fff;
  transition:
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}
body.asp-cart .navbar.bg-white:not(.navbar-transparent) {
  background-color: var(--asp-green) !important;
  box-shadow: 0 4px 18px rgba(0, 57, 43, 0.28);
}
body.asp-cart .navbar.bg-white.navbar-transparent {
  background-color: transparent !important;
  box-shadow: none;
}
body.asp-cart .navbar.bg-white .navbar-brand {
  height: 76px !important;
  padding: 6px 0;
}
body.asp-cart .navbar.bg-white .navbar-nav .nav-item .nav-link {
  color: #fff;
  font-weight: 500;
}
body.asp-cart .navbar.bg-white .navbar-nav .nav-item .nav-link:hover,
body.asp-cart .navbar.bg-white .navbar-nav .nav-item .nav-link:focus {
  background-color: rgba(255, 255, 255, 0.12);
}
body.asp-cart .navbar.bg-white .navbar-toggler .navbar-toggler-icon {
  background-color: #fff;
}

@media (max-width: 991px) {
  body.asp-cart .navbar.bg-white {
    min-height: 76px;
  }
  body.asp-cart .navbar.bg-white .navbar-brand {
    height: 60px !important;
  }
  body.asp-cart .navbar.bg-white .navbar-collapse {
    background-color: var(--asp-green);
  }
  body.asp-cart .navbar.bg-white .navbar-collapse::after {
    background-color: var(--asp-green);
  }
  body.asp-cart
    .navbar.bg-white
    .navbar-collapse
    .navbar-nav
    .nav-item
    .nav-link {
    color: #fff;
  }
  body.asp-cart .navbar.bg-white .navbar-collapse .navbar-nav .nav-item::after {
    background-color: rgba(255, 255, 255, 0.22);
  }
}

/* ---------- 頁首 ---------------------------------------------------------- */

.asp-hero {
  position: relative;
  padding: 150px 0 60px;
  background: #234 url("../../images/farm.JPG") center/cover no-repeat;
  color: #fff;
  text-align: center;
}
.asp-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 40, 30, 0.62),
    rgba(0, 40, 30, 0.78)
  );
}
.asp-hero > .container {
  position: relative;
  z-index: 1;
}
.asp-hero h1 {
  font-size: 2.6rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: #fff;
}
.asp-hero p {
  color: #fff !important;
  font-size: 1.05rem;
  margin: 0;
}

@media (max-width: 767px) {
  .asp-hero {
    padding: 110px 0 40px;
  }
  .asp-hero h1 {
    font-size: 1.85rem;
  }
  .asp-hero p {
    font-size: 0.98rem;
  }
}

/* ---------- 內容容器 ------------------------------------------------------ */

.asp-main {
  max-width: 1180px;
  margin: -40px auto 0;
  position: relative;
  z-index: 2;
  background: #fff;
  border-radius: var(--asp-radius);
  box-shadow: 0 16px 38px -12px rgba(0, 0, 0, 0.18);
  padding: 32px 28px 40px;
}
@media (max-width: 767px) {
  .asp-main {
    margin: -24px 12px 0;
    padding: 22px 16px 32px;
    border-radius: 6px;
  }
}

.asp-section-title {
  text-align: center;
  color: var(--asp-green);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 8px 0 6px;
}
.asp-section-sub {
  text-align: center;
  color: var(--asp-muted);
  margin: 0 0 28px;
  font-size: 0.98rem;
}
.asp-rule {
  border: 0;
  height: 1px;
  background: var(--asp-line);
  margin: 40px 0 32px;
}

/* ---------- 商品卡片格 ---------------------------------------------------- */

.asp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}
@media (max-width: 599px) {
  .asp-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

.asp-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--asp-line);
  border-radius: var(--asp-radius);
  overflow: hidden;
  transition:
    box-shadow 0.25s ease,
    transform 0.25s ease;
}
.asp-card:hover {
  box-shadow: 0 12px 26px -10px rgba(0, 0, 0, 0.22);
  transform: translateY(-2px);
}
/* 下架的商品：只把圖片變灰，不要對整張卡用 opacity —— 
   opacity 會連文字一起變淡，對比度直接不合格。 */
.asp-card.is-out .asp-card__media img {
  filter: grayscale(1);
  opacity: 0.55;
}
.asp-card.is-out .asp-card__price {
  color: var(--asp-muted);
}

.asp-card__media {
  position: relative;
  display: block;
  background: #f2f6f5;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
/* 舊瀏覽器沒有 aspect-ratio 時的退路 */
@supports not (aspect-ratio: 1 / 1) {
  .asp-card__media {
    height: 0;
    padding-bottom: 100%;
  }
  .asp-card__media img {
    position: absolute;
    top: 0;
    left: 0;
  }
}
.asp-card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  transition: transform 0.3s ease;
}
.asp-card:hover .asp-card__media img {
  transform: scale(1.04);
}

.asp-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--asp-green);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 20px;
  max-width: calc(100% - 20px);
  z-index: 10;
}
.asp-badge--grey {
  background: #5f6f69;
} /* 白字需要 4.5:1，原本的 #8a9a94 只有 2.9:1 */

.asp-card__body {
  padding: 16px 16px 6px;
  flex: 1 1 auto;
}
.asp-card__name {
  font-size: 1.12rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--asp-ink);
}
.asp-card__note {
  font-size: 0.86rem;
  color: var(--asp-muted);
  margin: 0 0 10px;
}
.asp-card__price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--asp-green);
  margin: 0;
  line-height: 1.2;
}
.asp-card__detail {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--asp-green);
  text-decoration: underline;
}

.asp-card__foot {
  padding: 10px 16px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- 數量選擇器 ---------------------------------------------------- */

.asp-qty {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--asp-line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.asp-qty button {
  width: 42px;
  min-height: 44px;
  border: 0;
  background: #f2f6f5;
  color: var(--asp-ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.asp-qty button:hover {
  background: var(--asp-green-light);
}
.asp-qty button:active {
  background: #d6e8e2;
}
.asp-qty input {
  width: 52px;
  min-height: 44px;
  text-align: center;
  border: 0;
  border-left: 1px solid var(--asp-line);
  border-right: 1px solid var(--asp-line);
  font-size: 1rem;
  font-weight: 600;
  color: var(--asp-ink);
  -moz-appearance: textfield;
}
.asp-qty input::-webkit-outer-spin-button,
.asp-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- 按鈕 ---------------------------------------------------------- */

.asp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--asp-green);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.2s,
    box-shadow 0.2s;
}
.asp-btn:hover,
.asp-btn:focus {
  background: var(--asp-green-dark);
  color: #fff;
  text-decoration: none;
}
.asp-btn:disabled,
.asp-btn.is-disabled {
  background: #b9c7c2;
  cursor: not-allowed;
  pointer-events: none;
}
.asp-btn--block {
  width: 100%;
}
.asp-btn--ghost {
  background: #fff;
  color: var(--asp-green);
  border-color: var(--asp-line);
}
.asp-btn--ghost:hover {
  background: var(--asp-green-light);
  color: var(--asp-green-dark);
}
.asp-btn--lg {
  min-height: 52px;
  font-size: 1.05rem;
  padding: 12px 28px;
}
.asp-btn--danger {
  background: #fff;
  color: #b5342c;
  border-color: #eccfcd;
}
.asp-btn--danger:hover {
  background: #fdf2f1;
  color: #8f271f;
}

.asp-card__foot .asp-btn {
  flex: 1 1 auto;
}

/* ---------- 運費區 -------------------------------------------------------- */

.asp-ship {
  background: var(--asp-green-light);
  border-radius: var(--asp-radius);
  padding: 22px;
}
@media (max-width: 599px) {
  .asp-ship {
    padding: 16px;
  }
}

.asp-ship__hint {
  background: #fff;
  border-left: 4px solid var(--asp-green);
  padding: 12px 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 0.93rem;
  color: var(--asp-ink);
}

.asp-region {
  background: #fff;
  border: 1px solid var(--asp-line);
  border-radius: 6px;
  margin-bottom: 14px;
  overflow: hidden;
}
.asp-region__head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: #fff;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  color: var(--asp-ink);
  min-height: 56px;
}
.asp-region__head:hover {
  background: #fafcfb;
}
.asp-region__head img {
  width: 200px;
  height: 40px;
  object-fit: contain;
  flex: none;
}
.asp-region__head .asp-chevron {
  margin-left: auto;
  transition: transform 0.25s;
  color: var(--asp-muted);
}
.asp-region.is-open .asp-chevron {
  transform: rotate(180deg);
}
.asp-region__body {
  display: none;
  padding: 4px 16px 16px;
  border-top: 1px solid var(--asp-line);
}
.asp-region.is-open .asp-region__body {
  display: block;
}

.asp-ship-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--asp-line);
  flex-wrap: wrap;
}
.asp-ship-row:last-child {
  border-bottom: 0;
}
.asp-ship-row__label {
  flex: 1 1 150px;
  font-size: 0.95rem;
}
.asp-ship-row__price {
  font-weight: 700;
  color: var(--asp-green);
  min-width: 64px;
}

/* ---------- 購物車 / 結帳表格 --------------------------------------------- */

.asp-table {
  width: 100%;
  border-collapse: collapse;
}
.asp-table th {
  background: var(--asp-green-light);
  color: var(--asp-green);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 10px;
  text-align: left;
  border-bottom: 2px solid #cfe4dc;
}
.asp-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--asp-line);
  vertical-align: middle;
}
.asp-table .asp-num {
  text-align: right;
  white-space: nowrap;
}
.asp-table tfoot td {
  border-bottom: 0;
  padding-top: 16px;
}
.asp-table tfoot .asp-grand {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--asp-green);
}

.asp-line-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.asp-line-item img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  background: #f2f6f5;
  border-radius: 6px;
  flex: none;
  padding: 4px;
}
.asp-line-item__text {
  min-width: 0;
}
.asp-line-item__name {
  font-weight: 600;
  display: block;
}
.asp-line-item__sub {
  font-size: 0.84rem;
  color: var(--asp-muted);
}

/* 手機：表格改成堆疊卡片 */
@media (max-width: 767px) {
  .asp-table thead {
    display: none;
  }
  .asp-table,
  .asp-table tbody,
  .asp-table tr,
  .asp-table td {
    display: block;
    width: 100%;
  }
  .asp-table tr {
    border: 1px solid var(--asp-line);
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 12px;
    background: #fff;
  }
  .asp-table td {
    border: 0;
    padding: 6px 0;
  }
  .asp-table td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 92px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--asp-muted);
    font-weight: 700;
  }
  .asp-table td.asp-num {
    text-align: left;
  }
  .asp-table tfoot tr {
    border: 0;
    background: transparent;
    padding: 0;
  }
  .asp-table tfoot td {
    display: flex;
    justify-content: space-between;
    padding: 8px 4px;
  }
  .asp-table tfoot td:empty {
    display: none;
  }
}

.asp-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--asp-muted);
}
.asp-empty i {
  font-size: 3rem;
  color: #c8d8d2;
  display: block;
  margin-bottom: 14px;
}

/* ---------- 結帳表單 ------------------------------------------------------ */

.asp-form-card {
  background: #fff;
  border: 1px solid var(--asp-line);
  border-radius: var(--asp-radius);
  padding: 24px;
  margin-bottom: 22px;
}
@media (max-width: 599px) {
  .asp-form-card {
    padding: 18px 15px;
  }
}

.asp-form-card > h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--asp-green);
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--asp-line);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.asp-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 599px) {
  .asp-fields {
    grid-template-columns: 1fr;
  }
}
.asp-field--full {
  grid-column: 1 / -1;
}

.asp-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--asp-muted);
  margin-bottom: 5px;
}
.asp-field label .req {
  color: #c0392b;
}
.asp-field input[type="text"],
.asp-field input[type="tel"],
.asp-field input[type="email"],
.asp-field select,
.asp-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--asp-line);
  border-radius: 6px;
  background: #fff;
  color: var(--asp-ink);
  font-size: 1rem; /* 16px：避免 iPhone 聚焦時自動放大 */
  font-family: inherit;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.asp-field textarea {
  min-height: 110px;
  resize: vertical;
}
.asp-field input:focus,
.asp-field select:focus,
.asp-field textarea:focus {
  outline: 0;
  border-color: var(--asp-green);
  box-shadow: 0 0 0 3px rgba(0, 123, 94, 0.14);
}
.asp-field input.is-error,
.asp-field select.is-error,
.asp-field textarea.is-error {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}
.asp-field .asp-hint {
  font-size: 0.8rem;
  color: var(--asp-muted);
  margin-top: 4px;
}
.asp-field .asp-err {
  font-size: 0.82rem;
  color: #c0392b;
  margin-top: 4px;
  display: none;
}
.asp-field .asp-err.is-on {
  display: block;
}

.asp-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--asp-green-light);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  min-height: 48px;
}
.asp-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--asp-green);
}

.asp-paylogos {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.asp-paylogos img {
  height: 26px;
  width: auto;
}

/* ---------- 手機底部固定列 ------------------------------------------------ */

.asp-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid var(--asp-line);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.09);
}
.asp-bar.is-visible {
  display: flex;
}
.asp-bar__info {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}
.asp-bar__info small {
  display: block;
  color: var(--asp-muted);
  font-size: 0.78rem;
}
.asp-bar__info strong {
  font-size: 1.15rem;
  color: var(--asp-green);
}
.asp-bar .asp-btn {
  flex: none;
}
body.asp-cart.has-bar {
  padding-bottom: 84px;
}

@media (min-width: 768px) {
  .asp-bar {
    display: none !important;
  }
}

/* ---------- 導覽列購物車 --------------------------------------------------- */

.asp-navcart {
  position: relative;
}
.asp-navcart .asp-count {
  position: absolute;
  top: 2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #c0392b;
  color: #fff;
  border-radius: 9px;
  font-size: 0.7rem;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
}

/* ---------- 提示訊息 ------------------------------------------------------ */

.asp-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 16px);
  background: var(--asp-ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 0.93rem;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s;
  max-width: 90vw;
  text-align: center;
}
.asp-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 頁尾 ---------------------------------------------------------- */

.asp-foot {
  text-align: center;
  padding: 34px 16px 44px;
  color: var(--asp-muted);
  font-size: 0.9rem;
  margin-bottom: -74px;
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}
.asp-foot a {
  color: var(--asp-green);
}

/* ---------- 完成頁 -------------------------------------------------------- */

.asp-done {
  text-align: center;
  padding: 20px 0 10px;
}
.asp-done__icon {
  width: 84px;
  height: 84px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--asp-green-light);
  color: var(--asp-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
}
.asp-done h1 {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--asp-green);
  margin: 0 0 10px;
}
.asp-done p {
  font-size: 1.02rem;
  margin: 0 auto 10px;
  max-width: 560px;
}

.asp-notice {
  background: #fdf6e7;
  border-left: 4px solid #d99e22;
  padding: 14px 16px;
  border-radius: 4px;
  margin: 24px auto;
  max-width: 620px;
  text-align: left;
  font-size: 0.94rem;
}

.asp-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 26px;
  text-align: left;
}
.asp-info-grid section {
  background: #fff;
  border: 1px solid var(--asp-line);
  border-radius: 8px;
  padding: 18px;
  margin: 0;
}
.asp-info-grid h4 {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--asp-green);
  margin: 0 0 10px;
  font-weight: 700;
}
.asp-info-grid p,
.asp-info-grid dl {
  font-size: 0.92rem;
  margin: 0;
}
.asp-info-grid dt {
  color: var(--asp-muted);
  font-weight: 600;
  font-size: 0.8rem;
}
.asp-info-grid dd {
  margin: 0 0 8px;
}

.asp-order-box {
  background: #fff;
  border: 1px solid var(--asp-line);
  border-radius: 8px;
  padding: 18px;
  text-align: left;
  margin-top: 8px;
}

@media print {
  .asp-hero,
  .asp-bar,
  .navbar,
  .asp-noprint {
    display: none !important;
  }
  .asp-main {
    box-shadow: none;
    margin: 0;
    padding: 0;
  }
}

/* B7：內文裡的連結不能只靠顏色區分，要有底線（按鈕類除外） */
.asp-main p a:not(.asp-btn),
.asp-foot a,
.asp-ship__hint a {
  text-decoration: underline;
}
.asp-main p a:not(.asp-btn):hover,
.asp-foot a:hover {
  text-decoration: underline;
  color: var(--asp-green-dark);
}
