/* Cart Page Styles */

/* ===== WooCommerce Block Overrides ===== */
/* Reset WC block defaults for dark theme */
.wp-block-woocommerce-cart,
.wp-block-woocommerce-cart .wc-block-components-sidebar-layout {
  background: transparent !important;
  color: var(--text-muted) !important;
  --wp--preset--color--base: transparent !important;
  --wp--preset--color--contrast: #fff !important;
}

.wp-block-woocommerce-cart .wc-block-components-sidebar-layout {
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Fix WC block button defaults */
.wp-block-woocommerce-cart .wc-block-components-button {
  background-color: var(--primary) !important;
  color: var(--bg) !important;
  border: none !important;
}

/* Fix WC block text colors */
.wp-block-woocommerce-cart .wc-block-formatted-money-amount,
.wp-block-woocommerce-cart .wc-block-components-product-price,
.wp-block-woocommerce-cart .wc-block-components-formatted-money-amount {
  color: #fff !important;
}

/* Fix empty cart message */
.wp-block-woocommerce-empty-cart-block,
.wc-block-cart__empty-cart__title,
.wp-block-woocommerce-empty-cart-block p,
.wp-block-woocommerce-empty-cart-block .wc-block-cart__empty-cart__title {
  color: #fff !important;
}

.wp-block-woocommerce-empty-cart-block a.wp-element-button,
.wp-block-woocommerce-empty-cart-block a.wc-block-components-button {
  background-color: var(--primary) !important;
  color: var(--bg) !important;
  border-radius: 0.75rem !important;
  font-weight: 700 !important;
  padding: 1rem 2rem !important;
}

/* Fix WC block notice styles */
.wp-block-woocommerce-cart .wc-block-components-notices .wc-block-components-notice-banner {
  background: var(--surface-light) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* Fix WC loading skeleton */
.wp-block-woocommerce-cart .wc-block-components-loading-mask {
  background: transparent !important;
}

/* Remove WC block's own border/shadow */
.wp-block-woocommerce-cart .wp-block-woocommerce-filled-cart-block,
.wp-block-woocommerce-cart .wp-block-woocommerce-cart-items-block,
.wp-block-woocommerce-cart .wp-block-woocommerce-cart-totals-block,
.wp-block-woocommerce-cart .wp-block-woocommerce-cart-order-summary-block {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Fix coupon input field in sidebar */
.wp-block-woocommerce-cart .wc-block-components-totals-coupon__form input {
  background: var(--surface) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
  border-radius: 0.5rem !important;
  padding: 0.75rem 1rem !important;
  height: 48px !important;
}

.wp-block-woocommerce-cart .wc-block-components-totals-coupon__form input::placeholder {
  color: rgba(255, 255, 255, 0.3) !important;
}

.wp-block-woocommerce-cart .wc-block-components-totals-coupon__form button {
  background: var(--primary) !important;
  color: var(--bg) !important;
  border: none !important;
  border-radius: 0.5rem !important;
  font-weight: 600 !important;
}

/* ===== Layout & Grid ===== */

/* Layout & Grid */
.wc-block-components-sidebar-layout {
  display: grid;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .wc-block-components-sidebar-layout {
    grid-template-columns: 1fr 380px;
    align-items: start;
  }
}

/* Main Content Area */
.wc-block-cart__main {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 1rem;
  padding: 1.5rem;
}

/* Cart Table */
.wc-block-cart-items {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.wc-block-cart-items caption {
  margin-bottom: 1rem;
  text-align: left;
}

.wc-block-cart-items h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-main);
}

/* Table Header */
.wc-block-cart-items__header th {
  text-align: left;
  padding: 1rem 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.wc-block-cart-items__header-total {
  text-align: right !important;
}

/* Table Rows */
.wc-block-cart-items__row td {
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}

.wc-block-cart-items__row:last-child td {
  border-bottom: none;
}

/* Product Image */
.wc-block-cart-item__image {
  width: 120px;
  padding-right: 1.5rem !important;
}

.wc-block-cart-item__image a {
  display: block;
}

.wc-block-cart-item__image img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 0.75rem;
  background: var(--surface-light);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Product Details */
.wc-block-cart-item__wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wc-block-components-product-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  transition: color 0.2s;
  line-height: 1.4;
}

.wc-block-components-product-name:hover {
  color: var(--primary);
}

/* Prices */
.wc-block-cart-item__prices {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.95rem;
}

.wc-block-components-product-price__regular {
  color: var(--text-muted);
  text-decoration: line-through;
  font-size: 0.9em;
}

.wc-block-components-product-price__value.is-discounted {
  color: #fff;
  font-weight: 700;
}

/* Savings Badge */
.wc-block-components-sale-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: 0.375rem;
  background: rgba(52, 211, 153, 0.1);
  color: var(--primary);
  width: fit-content;
  border: 1px solid rgba(52, 211, 153, 0.2);
}

/* Description */
.wc-block-components-product-metadata__description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.5;
}

.wc-block-components-product-metadata__description p {
  margin: 0;
}

/* Quantity & Remove Actions */
.wc-block-cart-item__quantity {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.wc-block-components-quantity-selector {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  padding: 0.25rem;
}

.wc-block-components-quantity-selector__input {
  width: 2.5rem;
  background: transparent;
  border: none;
  color: #fff;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  -moz-appearance: textfield;
}

.wc-block-components-quantity-selector__input::-webkit-outer-spin-button,
.wc-block-components-quantity-selector__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.wc-block-components-quantity-selector__button {
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: transparent;
  border-radius: 0.35rem;
  font-size: 1rem;
  transition: all 0.2s;
  cursor: pointer;
}

.wc-block-components-quantity-selector__button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.wc-block-components-quantity-selector__button:disabled {
  opacity: 0.3;
  cursor: default;
}

.wc-block-cart-item__remove-link {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
  background: none;
  border: none;
  cursor: pointer;
}

.wc-block-cart-item__remove-link:hover {
  color: #f87171;
  border-bottom-color: #f87171;
}

/* Row Total */
.wc-block-cart-item__total {
  vertical-align: top;
  text-align: right;
}

.wc-block-cart-item__total-price-and-sale-badge-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.wc-block-cart-item__total .price {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
}

/* Sidebar (Totals) */
.wc-block-cart__sidebar {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 1rem;
  padding: 1.5rem;
  position: sticky;
  top: 7rem;
  height: fit-content;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.wc-block-cart__totals-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1rem;
}

/* Coupons Section */
.wc-block-components-totals-wrapper {
  margin-bottom: 1.5rem;
}

.wc-block-components-panel__button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
  font-weight: 500;
}

.wc-block-components-panel__button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.wc-block-components-panel__button-icon {
  fill: currentColor;
  opacity: 0.7;
}

/* Totals Rows */
.wc-block-components-totals-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.wc-block-components-totals-item__value {
  color: #fff;
  font-weight: 600;
}

/* Footer Total (Estimated Total) */
.wc-block-components-totals-footer-item {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0;
}

.wc-block-components-totals-footer-item
  .wc-block-components-totals-item__label {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
}

.wc-block-components-totals-footer-item
  .wc-block-components-totals-item__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  background: linear-gradient(to right, #fff, #e2e8f0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Checkout Button */
.wc-block-cart__submit {
  margin-top: 2rem;
}

.wc-block-cart__submit-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1.125rem;
  background: var(--primary);
  color: var(--bg);
  font-weight: 700;
  border-radius: 0.75rem;
  font-size: 1rem;
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(52, 211, 153, 0.25);
  text-decoration: none;
}

.wc-block-cart__submit-button:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(52, 211, 153, 0.4);
}

.wc-block-components-button__text {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Responsive */
@media (max-width: 768px) {
  .wc-block-cart-items thead {
    display: none; /* Hide header on mobile for simpler view */
  }

  .wc-block-cart-items__row td {
    display: block;
    width: 100%;
    padding: 0.5rem 0;
    border: none;
  }

  .wc-block-cart-items__row {
    display: block;
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .wc-block-cart-item__image {
    width: 100%;
    padding-right: 0 !important;
    margin-bottom: 1rem;
  }

  .wc-block-cart-item__image img {
    width: 80px;
    height: 80px;
  }

  .wc-block-cart-item__total {
    text-align: left;
    margin-top: 1rem;
    padding-top: 1rem !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.1) !important;
  }

  .wc-block-cart-item__total-price-and-sale-badge-wrapper {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
}
