/* Figma GroupBuy 客戶2 visual overrides */
:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --surface-strong: rgba(227, 181, 0, 0.18);
  --ink: #000000;
  --muted: #8d8d8d;
  --line: #dfdfdf;
  --primary: #e3b500;
  --primary-strong: #c99f00;
  --shadow: 0 4px 8.9px rgba(0, 0, 0, 0.25);
}

body {
  background: var(--bg);
}

.brand-tagline {
  display: block;
}

.product-media {
  overflow: hidden;
  background: var(--primary);
}

.product-media,
.product-art {
  border-radius: 10px;
}

.product-image {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: center 42%;
}

.order-search-hint {
  margin: 0.65rem 0 0;
  color: #8d8d8d;
  font-size: 0.78rem;
  line-height: 1.5;
}

@media (max-width: 760px) {
  body {
    background: #f3f3f3;
    color: #000000;
  }

  .order-search-hint {
    text-align: center;
  }

  main,
  .shop-hero,
  .delivery-panel,
  .product-card,
  .order-panel,
  .shop-actions-bar {
    box-sizing: border-box;
  }

  .brand-block {
    min-height: 4.25rem;
    gap: 0.35rem;
    align-content: center;
  }

  .brand-title {
    color: #e3b500;
    font-size: 1.25rem;
    letter-spacing: 0.34em;
    line-height: 1.25;
    padding-left: 0.34em;
  }

  .brand-tagline {
    color: #ffffff;
    font-size: 0.75rem;
    letter-spacing: 0.48em;
    line-height: 1;
    padding-left: 0.48em;
  }

  .tabs {
    display: none;
  }

  .mobile-stepper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100vw;
    top: 4.25rem;
    height: 2.45rem;
    border-bottom: 1px solid #cfcfcf;
    background: #ffffff;
    box-shadow: 0 0 4.8px rgba(0, 0, 0, 0.25);
  }

  .mobile-stepper .step {
    gap: 0.55rem;
    min-height: 2.45rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #8d8d8d;
    font-size: 1rem;
    font-weight: 400;
  }

  .mobile-stepper .step.is-active {
    border-bottom: 2px solid #e3b500;
    color: #e3b500;
  }

  .mobile-stepper .step + .step {
    border-left: 0;
  }

  .mobile-stepper .step-index {
    width: 0.95rem;
    height: 0.95rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: transparent;
    color: currentColor;
    font-size: 0.5rem;
    font-weight: 800;
  }

  .mobile-stepper .step.is-active .step-index {
    border-color: #e3b500;
    background: #e3b500;
    color: #ffffff;
  }

  .mobile-stepper .step-label {
    font-size: 0.95rem;
  }

  main {
    width: 100vw;
    max-width: 402px;
    margin: 0;
    padding: 8.05rem 0 6.9rem;
  }

  #shopView {
    display: grid;
    justify-items: stretch;
  }

  #shopView .section-head {
    width: 100%;
    max-width: 350px;
    justify-self: start;
    margin-left: 26px;
    margin: 1.75rem 0 0.75rem;
    padding: 0;
  }

  #shopView .section-head h2 {
    font-size: 0.75rem;
  }

  .shop-hero,
  .delivery-panel {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr);
    align-items: center;
    width: min(350px, calc(100vw - 52px));
    max-width: none;
    min-height: 70px;
    margin-left: 26px;
    margin-right: 0;
    padding: 10px 19px;
    border: 0;
    border-radius: 15px;
    background: rgba(227, 181, 0, 0.06);
    box-shadow: 0 4px 8.9px rgba(0, 0, 0, 0.25);
  }

  .shop-hero {
    min-height: 85px;
    column-gap: 64px;
  }

  .shop-hero-icon,
  .delivery-panel-icon,
  .shop-actions-icon {
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    border-radius: 999px;
    background: rgba(227, 181, 0, 0.29);
    color: #e3b500;
  }

  .shop-hero-icon .icon-svg,
  .delivery-panel-icon .icon-svg,
  .shop-actions-icon .icon-svg {
    display: none;
  }

  .shop-hero-icon::before,
  .delivery-panel-icon::before,
  .shop-actions-icon::before {
    content: "";
    display: block;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
  }

  .shop-hero-icon::before {
    width: 20px;
    height: 20px;
    background-image: url("assets/figma/calendar-icon.svg");
  }

  .delivery-panel-icon::before {
    width: 25px;
    height: 21px;
    background-image: url("assets/figma/truck-icon.svg");
  }

  .shop-actions-icon::before {
    width: 30px;
    height: 30px;
    background-image: url("assets/figma/cart-icon.svg");
  }

  .shop-hero-copy::before {
    content: "本期團購";
    color: #000000;
    font-size: 0.75rem;
    font-weight: 500;
  }

  .shop-hero-dates {
    grid-template-columns: max-content max-content;
    gap: 20px;
  }

  .shop-hero-dates dt,
  .shop-hero-dates dd {
    color: #000000;
    font-size: 0.75rem;
    line-height: 1.25;
  }

  .shop-hero-dates dt {
    order: 2;
    font-weight: 600;
  }

  .shop-hero-dates dd {
    order: 1;
    font-weight: 400;
  }

  .catalog {
    width: min(350px, calc(100vw - 52px));
    max-width: none;
    margin-left: 26px;
    margin-right: 0;
    gap: 20px;
  }

  .product-card {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 17px;
    width: 100%;
    min-height: 134px;
    padding: 10px;
    border: 0;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: none;
    overflow: hidden;
  }

  .product-media,
  .product-art {
    width: 140px;
    height: 114px;
    min-height: 0;
    overflow: hidden;
    border-radius: 10px;
    background: #e3b500;
  }

  .product-image {
    transform: scale(1.22);
  }

  .product-body {
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 1fr;
    min-height: 114px;
    padding: 0;
  }

  .product-body h3 {
    margin: 0;
    color: #000000;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25;
  }

  .product-body p {
    margin: 12px 0 0;
    color: #8d8d8d;
    font-size: 0.625rem;
    line-height: 1.35;
  }

  .product-purchase-row {
    display: flex;
    align-items: center;
    gap: 22px;
    align-self: end;
  }

  .price {
    color: #000000;
    font-size: 0.75rem;
    font-weight: 700;
  }

  .qty-control {
    width: 99px;
    height: 24px;
    grid-template-columns: 28px 1fr 31px;
    border-color: #dfdfdf;
    border-radius: 7px;
  }

  .qty-control button,
  .qty-control input {
    min-height: 22px;
    color: #000000;
    font-size: 1rem;
    font-weight: 400;
  }

  .qty-control button:first-child {
    color: #969696;
  }

  .delivery-panel {
    column-gap: 35px;
    margin-top: 20px;
  }

  .delivery-panel-copy h3 {
    margin: 0 0 5px;
    color: #000000;
    font-size: 0.75rem;
    font-weight: 500;
  }

  .delivery-panel-copy p {
    margin: 0;
    color: #8d8d8d;
    font-size: 0.625rem;
    line-height: 1.2;
  }

  .delivery-panel-copy strong {
    color: inherit;
  }

  .order-panel {
    width: min(350px, calc(100vw - 52px));
    max-width: none;
    margin-left: 26px;
    margin-right: 0;
    margin-top: 20px;
    padding: 22px 10px;
    border-radius: 22px;
    background: #ffffff;
  }

  .order-panel h3 {
    margin-bottom: 19px;
    color: #000000;
    font-size: 1rem;
    font-weight: 400;
  }

  .order-panel label {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 27px;
    color: #000000;
    font-size: 0.75rem;
  }

  .order-panel input {
    min-height: 35px;
    border-color: #8d8d8d;
    border-radius: 8px;
    text-align: center;
  }

  .order-panel input::placeholder {
    color: #d6d6d6;
  }

  .mobile-order-items {
    margin-top: 19px;
    padding-top: 19px;
    border-top: 1px solid #f3f3f3;
  }

  .mobile-order-list {
    gap: 19px;
    padding: 10px;
    border-radius: 7px;
    background: #eeeeee;
  }

  .mobile-order-row {
    grid-template-columns: minmax(0, 100px) 65px 20px minmax(0, 1fr);
    gap: 19px;
    min-height: 15px;
    padding: 0;
    font-size: 0.75rem;
  }

  .order-summary {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    border: 0;
    background: transparent;
  }

  .order-summary > div:first-child,
  .shipping-hint {
    display: none;
  }

  .order-summary > div:nth-child(2) {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .order-summary span {
    color: #969696;
    font-size: 0.75rem;
    font-weight: 400;
  }

  .order-summary strong {
    color: #000000;
    font-size: 1rem;
    font-weight: 400;
  }

  .shop-actions-bar {
    position: static !important;
    z-index: 900;
    left: auto;
    right: auto;
    width: min(402px, 100vw);
    max-width: none;
    height: 70px;
    margin-top: 20px;
    transform: none;
    padding: 10px 30px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid #dedede;
    background: #ffffff;
    backdrop-filter: none;
    box-shadow: 0 -1px 4.45px rgba(0, 0, 0, 0.14);
  }

  .shop-actions-summary {
    gap: 13px;
  }

  .shop-actions-count {
    color: #000000;
    font-size: 0.75rem;
    font-weight: 500;
  }

  .shop-actions-total {
    color: #8d8d8d;
    font-size: 0.625rem;
  }

  .shop-actions-total strong {
    color: #e3b500;
    font-size: 1rem;
    font-weight: 500;
  }

  .shop-actions-bar .order-submit-button {
    width: 148px;
    min-width: 0;
    min-height: 35px;
    border-radius: 6px;
    background: #e3b500;
    color: #000000;
    font-size: 0.75rem;
    font-weight: 400;
  }

  .shop-actions-bar .order-submit-button::after {
    content: ">";
    margin-left: 10px;
  }

  .site-footer {
    max-width: 402px;
    min-height: 91px;
    border-top: 0;
    background: #f1eeee;
  }
}

@media (max-width: 390px) {
  main {
    padding-inline: 0.9rem;
  }

  #shopView .section-head,
  .shop-hero,
  .delivery-panel,
  .catalog,
  .order-panel {
    margin-left: 20px;
  }

  .product-card {
    grid-template-columns: minmax(110px, 40%) minmax(0, 1fr);
    gap: 12px;
  }

  .product-media,
  .product-art {
    width: 100%;
    height: 114px;
  }

  .product-purchase-row {
    gap: 12px;
  }

  .qty-control {
    width: 86px;
  }

  .shop-hero {
    column-gap: 36px;
  }

  .delivery-panel {
    column-gap: 24px;
  }
}

/*
 * Centre every panel in a single column on phones and small tablets.
 * Keep this block last: it replaces the fixed left margins used above.
 */
@media (max-width: 760px) {
  :root {
    --mobile-col: min(100% - 52px, 440px);
    --mobile-edge: max(26px, calc((100% - 440px) / 2));
  }

  main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }

  /* The shop view is a grid by ID, so hide it explicitly when another view is active. */
  #shopView:not(.is-active) {
    display: none;
  }

  #shopView > .shop-hero,
  #shopView > .section-head,
  #shopView > .catalog,
  #shopView > .delivery-panel,
  #shopView > .order-panel,
  #paymentView > .section-head,
  #paymentView > .payment-checkout,
  #orderView {
    box-sizing: border-box;
    width: var(--mobile-col);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    justify-self: center;
  }

  #adminView {
    box-sizing: border-box;
    width: min(100% - 32px, 720px);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }

  #shopView > .shop-actions-bar,
  .payment-actions-bar {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: var(--mobile-edge);
    padding-right: var(--mobile-edge);
  }

  /* Cards fill the column so their edges line up with the hero and delivery panels. */
  .catalog > .product-card {
    width: 100%;
    max-width: none;
    justify-self: stretch;
  }

  /* Without this the input padding hides the quantity on narrow phones. */
  .qty-control input {
    padding: 0;
  }

  .site-footer {
    width: 100%;
    max-width: none;
  }
}
