/* ==========================================================================
   Shared buttons
   ========================================================================== */

.button--primary {
    background: #c95a5a;
    border: 1px solid #c95a5a;
    color: #fff;
}

.button--primary:hover {
    background: #b14949;
    border-color: #b14949;
}

.button--dark {
    background: #111;
    color: #fff;
    text-decoration: none;
}

.button--dark:hover {
    background: #000;
}

.button--small {
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
}

.button--disabled,
.button--disabled:hover {
    opacity: 0.45;
    cursor: not-allowed;
}


/* ==========================================================================
   Shared product gallery structure
   Size is defined per page context below.
   ========================================================================== */

.product-gallery {
    display: flex;
    gap: 14px;
    align-items: center;
}

.product-gallery__thumbs-wrap {
    width: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.product-gallery__nav {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
}

.product-gallery__nav:hover {
    color: #111;
}

.product-gallery__thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.product-gallery__thumb {
    width: 52px;
    height: 72px;
    border: 1px solid #d8d8d8;
    background: #fff;
    padding: 0;
    cursor: pointer;
    box-sizing: border-box;
    overflow: hidden;
    display: block;
}

.product-gallery__thumb.is-active {
    border-color: #111;
}

.product-gallery__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-gallery__main {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-gallery__main img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-gallery__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    background: #f5f5f5;
    color: #666;
    box-sizing: border-box;
}


/* ==========================================================================
   Shop list page
   ========================================================================== */

.shop {
    padding: 32px 0 60px;
}

.shop__inner {
    width: min(1400px, calc(100% - 4rem));
    margin: 0 auto;
}

.shop__title {
    margin: 0 0 28px 0;
    font-size: 1.8rem;
}

.shop-list {
    display: flex;
    flex-direction: column;
    gap: 48px;
    width: 100%;
}

.product-card {
    display: flex;
    gap: 40px;
    width: 100%;
}

.product-card--horizontal {
    margin: 0 auto;
}

.product-card__media {
    flex: 0 0 360px;
}

.product-card__content {
    flex: 1;
    max-width: 760px;
}

.product-card__title {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.product-card__subtitle {
    margin: 0 0 12px 0;
    color: #444;
}

.product-card__desc {
    font-size: 0.85rem;
    line-height: 1.5;
}

.product-card__price {
    margin: 16px 0 10px 0;
    font-size: 1rem;
}

.product-card__meta {
    margin: 0 0 18px 0;
    font-size: 0.82rem;
    color: #444;
}

.product-card__actions {
    display: flex;
    gap: 14px;
    align-items: end;
    flex-wrap: wrap;
    margin-top: 20px;
}

.product-card__buy-form {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.product-card__qty-label {
    font-size: 0.75rem;
}

.product-card__qty-input {
    width: 64px;
    padding: 8px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

.shop .product-gallery__thumbs {
    max-height: 240px;
}

.shop .product-gallery__main {
    width: 300px;
    height: 400px;
}

.shop .product-gallery__placeholder {
    width: 300px;
    min-height: 400px;
}

@media (max-width: 900px) {
    .shop__inner {
        width: min(100% - 2rem, 680px);
    }

    .product-card {
        flex-direction: column;
    }

    .product-card__media {
        flex: none;
    }

    .shop .product-gallery__main {
        width: min(100%, 320px);
        height: 426px;
    }
}


/* ==========================================================================
   Product detail page
   ========================================================================== */

.product-detail-page {
    padding: 32px 0 60px;
}

.product-detail-page__inner {
    width: min(1600px, calc(100% - 4rem));
    margin: 0 auto;
}

.product-detail {
    display: grid;
    grid-template-columns: minmax(620px, 1.35fr) minmax(380px, 0.85fr);
    gap: 56px;
    align-items: flex-start;
}

.product-detail__media {
    width: 100%;
}

.product-detail__content {
    max-width: 300px;
}

.product-detail__breadcrumb {
    margin: 0 0 16px 0;
    font-size: 0.78rem;
}

.product-detail__breadcrumb a {
    color: #444;
    text-decoration: none;
}

.product-detail__breadcrumb a:hover {
    text-decoration: underline;
}

.product-detail__title {
    margin: 0 0 10px 0;
    font-size: 1.8rem;
    line-height: 1.2;
}

.product-detail__subtitle {
    margin: 0 0 18px 0;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
}

.product-detail__price {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.product-detail__meta {
    margin: 0 0 22px 0;
    font-size: 0.82rem;
    color: #444;
}

.product-detail__description {
    font-size: 0.9rem;
    line-height: 1.7;
}

.product-detail__actions {
    margin-top: 28px;
}

.product-detail__buy-form {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
}

.product-detail__qty-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-detail__qty-block label {
    font-size: 0.78rem;
}

.product-detail__qty-input {
    width: 72px;
    padding: 10px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

.product-detail-page .product-gallery {
    align-items: flex-start;
}

.product-detail-page .product-gallery__thumbs {
    max-height: 620px;
}

.product-detail-page .product-gallery__main {
    width: 100%;
    max-width: 760px;
    height: 800px;
}

.product-detail-page .product-gallery__placeholder {
    width: 100%;
    max-width: 760px;
    min-height: 940px;
}

@media (max-width: 1200px) {
    .product-detail {
        grid-template-columns: 1fr;
    }

    .product-detail-page .product-gallery__main {
        max-width: 720px;
        height: 900px;
    }
}

@media (max-width: 760px) {
    .product-detail-page__inner {
        width: min(100% - 2rem, 680px);
    }

    .product-detail-page .product-gallery {
        flex-direction: column-reverse;
    }

    .product-detail-page .product-gallery__thumbs-wrap {
        width: 100%;
        flex-direction: row;
        justify-content: center;
    }

    .product-detail-page .product-gallery__thumbs {
        flex-direction: row;
        max-width: 100%;
        max-height: none;
    }

    .product-detail-page .product-gallery__main {
        width: 100%;
        height: auto;
        aspect-ratio: 3 / 4;
    }
}


/* ==========================================================================
   Cart
   ========================================================================== */

.container--narrow {
    max-width: 980px;
}

.cart-message {
    margin: 1.5rem 0 2rem;
    padding: 1rem 1.25rem;
    border: 1px solid #e2e2e2;
    background: #fff;
}

.cart-message--error {
    border-color: #b00020;
    background: #fff0f2;
    color: #7a0015;
    font-weight: 500;
}

.cart-actions-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.cart-table-wrapper {
    overflow-x: auto;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th,
.cart-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #d9d9d9;
    text-align: left;
    vertical-align: middle;
}

.cart-table th {
    font-weight: 500;
    color: #555;
}

.cart-row--error {
    background: #fff5f5;
}

.cart-row--error td {
    border-top: 1px solid #d64541;
    border-bottom: 1px solid #d64541;
}

.cart-line-error {
    margin-top: 0.35rem;
    color: #b00020;
    font-size: 0.9rem;
    font-weight: 600;
}

.cart-remove-cell {
    width: 44px;
}

.cart-remove-button {
    border: none;
    background: none;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}

.cart-product {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cart-product__image {
    width: 44px;
    height: 44px;
    object-fit: cover;
    display: block;
    border: 1px solid #ddd;
}

.cart-product__title {
    font-weight: 500;
}

.cart-quantity-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-quantity-input {
    width: 70px;
    padding: 0.45rem 0.5rem;
}

.cart-update-button {
    padding: 0.45rem 0.65rem;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
}

.cart-summary {
    max-width: 340px;
    margin-left: auto;
    margin-top: 2rem;
}

.cart-summary__line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.cart-summary__actions {
    display: flex;
    justify-content: flex-end;
}

.cart-empty {
    padding: 2rem 0;
}

@media (max-width: 760px) {
    .cart-summary {
        max-width: none;
        margin-left: 0;
    }

    .cart-actions-top,
    .cart-summary__actions {
        justify-content: stretch;
    }

    .cart-actions-top .button,
    .cart-summary__actions .button {
        width: 100%;
        text-align: center;
    }
}


/* ==========================================================================
   Checkout
   ========================================================================== */

.checkout-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 2rem;
    margin-top: 2rem;
}

.checkout-block {
    border: 1px solid #ddd;
    padding: 1.5rem;
    background: #fff;
    margin-bottom: 1.5rem;
}

.checkout-block h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.checkout-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.checkout-form input[type="email"],
.checkout-form input[type="text"] {
    width: 100%;
    padding: 0.7rem 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
}

.checkout-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.9rem 0;
    border-top: 1px solid #eee;
    cursor: pointer;
}

.checkout-choice:first-of-type {
    border-top: none;
}

.checkout-choice input[type="radio"] {
    margin-top: 0.2rem;
}

.checkout-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
}

.checkout-summary-line--total {
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    font-size: 1.1rem;
}

.checkout-summary-preview__rates ul {
    margin: 0.5rem 0 1.5rem;
    padding-left: 1.2rem;
}

.checkout-submit {
    width: 100%;
    text-align: center;
}

.checkout-back-button {
    display: block;
    text-align: center;
    margin-top: 1rem;
}

.checkout-error {
    border: 1px solid #d64541;
    color: #a93226;
    background: #fff6f6;
    padding: 1rem 1.2rem;
    margin-top: 1.5rem;
}

.review-items {
    display: grid;
    gap: 1rem;
}

.review-item {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 1rem;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.review-item:first-child {
    border-top: none;
    padding-top: 0;
}

.review-item__image {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 1px solid #ddd;
}

.review-item__content h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
}

.review-item__content p {
    margin: 0.2rem 0;
}

.review-item__total {
    font-weight: 600;
}

.checkout-address-list {
    margin-bottom: 1.5rem;
}

.checkout-address-empty {
    margin-bottom: 1.2rem;
}

.checkout-address-add {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.checkout-address-add h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.checkout-address-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkout-block__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.checkout-block__header h2 {
    margin: 0;
}

.checkout-address-empty-state {
    padding: 1rem 0 0.5rem;
}

.checkout-address-helper {
    margin-top: 1rem;
    color: #555;
}

@media (max-width: 900px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .checkout-address-form__row {
        grid-template-columns: 1fr;
    }
}

.checkout-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.checkout-card,
.delivery-mode-card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 22px;
  padding: 1.5rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.06);
}

.checkout-card h1,
.checkout-card h2,
.delivery-mode-card h2 {
  margin-top: 0;
}

.checkout-contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.delivery-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.delivery-mode-card {
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.delivery-mode-card.is-selected {
  border-color: #111;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.delivery-mode-price {
  position: absolute;
  top: 1rem;
  right: 1rem;
  min-width: 4.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.delivery-mode-header {
  display: flex;
  gap: 0.75rem;
  padding-right: 5.5rem;
  cursor: pointer;
}

.delivery-mode-header strong {
  display: block;
  font-size: 1.1rem;
}

.delivery-mode-header small {
  display: block;
  margin-top: 0.35rem;
  color: #666;
  line-height: 1.35;
}

.checkout-field {
  margin-top: 1rem;
}

.checkout-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.checkout-field input,
.checkout-field select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  background: #fff;
}

.checkout-help {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.4;
}

.checkout-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.checkout-submit {
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.4rem;
  background: #111;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.checkout-secondary-link {
  color: #444;
  text-decoration: none;
}

@media (max-width: 900px) {
  .checkout-contact-grid,
  .delivery-card-grid {
    grid-template-columns: 1fr;
  }
}
