/* ==========================================================================
   Cart Page Specific Styles
   Built to inherit from adhistrap.css and style.css variables
   ========================================================================== */

.woocommerce-cart {
  background-color: var(--doc-blue-3);
}

.cart-wrapper {
  flex-direction: column;
}

@media (min-width: 1024px) {
  .cart-wrapper {
    flex-direction: row;
  }
}

.cart-item-info {
  flex-direction: column;
}

@media (min-width: 768px) {
  .cart-item-info {
    flex-direction: row;
  }
}

.c-sidebar {
  flex-basis: 350px;
}

.woocommerce-cart .doc-vouchers-wrapper,
.woocommerce-checkout .doc-vouchers-wrapper {
  margin-top: 2rem;
}

.doc-shipping-progress-wrapper {
  background: #fff;
  border: 1px solid var(--doc-gray-4);
  border-radius: var(--doc-radius);
  font-size: var(--font-size-s);
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--doc-gray-4);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  transition: width 0.4s ease;
}

.cart-group {
  background: #fff;
  border-radius: var(--doc-radius);
  overflow: hidden;
  border: 1px solid var(--doc-gray-4);
}

.cart-rx-group .cart-group-header {
  background-color: var(--doc-blue-1);
}

.cart-group-header {
  background-color: var(--doc-gray-4);
}

.cart-rx-group .cart-group-header h2 {
  color: #fff;
}

.cart-normal-group .cart-group-header h2 {
  color: var(--doc-gray-1);
}

.cart-rx-group .cart-group-header .rx-badge {
  color: var(--doc-blue-1);
  background: #fff;
}

.cart-items>.cart-item {
  border-bottom: 1px dashed var(--doc-gray-3);
}

.cart-items>.cart-item.last-cart-item {
  border-bottom: none;
}

.cart-item-image {
  flex-basis: 60px;
}

.vouchers-header h2 {
  color: var(--doc-gray-1);
}

@media (min-width: 768px) {
  .cart-item-image {
    flex-basis: 80px;
  }
}

/* Product Images */
.cart-item-image img {
  object-fit: contain;
  border: 2px solid var(--doc-gray-4);
  border-radius: var(--doc-radius);
}

/* Typography & Titles */

.cart-item-details .product-name a {
  color: var(--doc-blue-1);
  transition: color 0.2s ease-in-out;
}

dd {
  font-size: var(--font-size-xxs);
  padding: 0.2rem 0.4rem;
  border: 1px dashed var(--doc-gray-1);
  border-radius: var(--doc-radius-s);
}

.woocommerce-cart .woocommerce-Price-amount,
.woocommerce-checkout .woocommerce-Price-amount {
  font-family: var(--font-ubuntu);
  font-weight: 600;
  color: var(--doc-blue-2);
  font-size: var(--font-size-l);
  display: flex;
}

.woocommerce-cart .order-total .woocommerce-Price-amount,
.woocommerce-checkout .order-total .woocommerce-Price-amount {
  color: var(--doc-blue-1);
}

@media (min-width: 1024px) {

  .woocommerce-cart .order-total,
  .woocommerce-checkout .order-total {
    padding-bottom: 2rem;
  }
}

.woocommerce-cart bdi,
.woocommerce-checkout bdi {
  display: flex;
}

.woocommerce-cart .woocommerce-Price-currencySymbol,
.woocommerce-checkout .woocommerce-Price-currencySymbol {
  font-size: 0.7rem;
  margin-top: 0.167rem;
  font-weight: var(--font-weight-ubuntu);
}

.woocommerce-cart .cart-totals .woocommerce-Price-amount,
.woocommerce-checkout .cart-totals .woocommerce-Price-amount {
  display: flex;
}

.cart-item-remove {
  padding-top: 0.2rem;
}

/* Remove Button styling */
.remove-item {
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  color: var(--doc-gray-1);
}

/* ==========================================
   Quantity Stepper Override
   (Similar to product.css stepper logic)
   ========================================== */

/* Coupon Input Restraint */
.cart-actions .coupon input {
  max-width: 220px;
}

/* ==========================================
   Cart Totals Sidebar (Right Column)
   ========================================== */
.cart-totals {
  background: #fff;
  border-radius: var(--doc-radius);
  border: 1px solid var(--doc-gray-4);
}

.cart-totals .doc-voucher-card {
  box-shadow: none;
  border-radius: 0;
}

.cart-totals .doc-voucher-left {
  border-right: none;
  position: relative;
  padding: 0.25rem 0.75rem 0.25rem 0.5rem;
}

.cart-totals .doc-voucher-right {
  background: #fff;
  padding: 0 0 0 0;
  font-size: var(--font-size-s);
}

.cart-totals .doc-voucher-right::before,
.cart-totals .doc-voucher-card::after {
  display: none;
}

.cart-totals .doc-voucher-right .dash {
  font-weight: var(--font-weight-inter-semibold);
  color: var(--doc-gray-3);
}

.woocommerce-cart .cart-totals .doc-voucher-right .woocommerce-Price-amount {
  color: var(--doc-gray-3);
}

.cart-totals .doc-voucher-left::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 8px;
  background-color: #fff;
  border-radius: 50%;
  z-index: 2;
  right: -7px;
}

.cart-totals .doc-voucher-card::before {
  width: 10px;
  height: 8px;
  left: -7px;
}

.cart-totals .cart-discount {
  display: contents;
}

@media (hover: hover) and (pointer: fine) {
  .cart-totals .doc-voucher-card:hover {
    box-shadow: none !important;
    transform: none;
  }
}

.cart-totals-section .cart_totals h2 {
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-color, #eaeaea);
}

.sidebar-coupon-wrapper summary {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.cart-totals .totals-label {
  font-size: var(--font-size-s);
}

.cart-totals .order-total .totals-label {
  font-size: var(--font-size-l);
  font-weight: 600;
}

.cart-totals .totals-value>strong {
  display: contents;
}

/* Sidebar Coupon Accordion */
details.sidebar-coupon-details summary::-webkit-details-marker {
  display: none;
}

details[open] .doc-accordion-chevron {
  transform: rotate(180deg);
}

.cart-totals-section .checkout-button {
  width: 100%;
  display: block;
  text-align: center;
  padding: 1rem;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  border-radius: var(--border-radius, 8px);
}

.doc-best-voucher {
  background: var(--doc-red-2);
}

.doc-best-badge {
  position: absolute;
  top: 0px;
  left: 0px;
  background: var(--doc-red-1);
  color: #fff;
  font-size: 7px;
  font-weight: var(--font-weight-inter-semibold);
  padding: 0 5px;
  /* border-radius: 4px; */
  border-bottom-right-radius: 5px;
}

.doc-voucher-used {
  opacity: 0.45;
  pointer-events: none;
  background: #f5f5f5;
}

.doc-used-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #666;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ==========================================
   Inline Coupon Bar (Search Bar Style) 
   ========================================== */

/* 1. The wrapper acts as the "fake" input field */
.doc-inline-coupon-form {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #ced4da;
  /* Matches Bootstrap's default form border */
  border-radius: var(--doc-radius);
  padding: 0.25rem 0.25rem 0.25rem 0.8rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

/* 2. Highlight the whole wrapper when the user clicks inside to type */
.doc-inline-coupon-form:focus-within {
  border-color: var(--doc-blue-2);
  box-shadow: 0 0 0 4px rgba(79, 157, 212, 0.15);
  outline: none;
}

/* 3. Strip all styles from the actual input so it blends in */
.doc-inline-coupon-form input.form-control {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  flex-grow: 1;
  /* Pushes the Apply button to the far right */
  outline: 0;
  font-family: monospace;
  color: var(--doc-gray-2);
  font-weight: bold;
  letter-spacing: 0.5px;
}

.doc-inline-coupon-form input.form-control::placeholder {
  color: var(--doc-gray-3);
}

.sticky-action {
  flex-basis: 100%;
}

@media (min-width: 768px) {
  .sticky-action {
    flex-basis: calc(300px + 3rem);
  }
}

.sticky-info .sticky-total .woocommerce-Price-amount {
  font-size: 2.2rem;
  line-height: 1;
  color: #fff;
}

.sticky-info .sticky-total .woocommerce-Price-currencySymbol {
  font-size: 1rem;
}

.sticky-info .sticky-title {
  font-size: 1rem;
  color: #fff;
  line-height: 1;
}

.checkout-review-group-items .product-name {
  font-size: var(--font-size-s);
}

.checkout-review-group-items dd {
  font-size: var(--font-size-xxs);
  padding: 0.15rem 0.35rem;
  border-radius: 0.2rem;
  border-width: 0.5px;
}

.checkout-review-group-items .variation {
  display: inline-flex;
}

.checkout-review-products>c.heckout-product-item:last-child {
  border-bottom: 1px dashed var(--doc-gray-3);
}


/* ==============================================================
   CHECKOUT PHASE 1: ACF STYLE FLEXBOX GRID
   ============================================================== */

/* Turn the native WooCommerce wrappers into Flex containers */
.woocommerce-checkout .woocommerce-billing-fields__field-wrapper,
.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  /* Same gap as ACF */
}

/* Strip default WooCommerce padding/floats from the form rows */
.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row,
.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper .form-row {
  padding: 0;
  margin: 0;
  border: none;
  float: none;
}

/* Hide the last name field completely */
.woocommerce-checkout .form-row.doc-hidden-field {
  display: none !important;
}

/* Ensure WooCommerce Select2 dropdowns stretch fully inside our flex items */
.woocommerce-checkout .select2-container {
  width: 100% !important;
}

/* --- BILLING FIELDS ORDER --- */
#billing_first_name_field {
  order: 1;
}

#billing_phone_field {
  order: 2;
}

#billing_email_field {
  order: 3;
}

#billing_country_field {
  order: 4;
}

#billing_state_field {
  order: 5;
}

#billing_address_1_field {
  order: 6;
}

#billing_postcode_field {
  order: 7;
}

#billing_city_field {
  order: 8;
}

/* --- SHIPPING FIELDS ORDER --- */
#shipping_first_name_field {
  order: 1;
}

/* Shipping doesn't natively have phone/email, so we skip 2 and 3 to keep the mental map consistent */
#shipping_country_field {
  order: 4;
}

#shipping_state_field {
  order: 5;
}

#shipping_address_1_field {
  order: 6;
}

#shipping_postcode_field {
  order: 7;
}

#shipping_city_field {
  order: 8;
}


.doc-switch-option {
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  background: var(--doc-gray-5);
  cursor: pointer;
  transition: all 0.2s;
  font-size: var(--font-size-s);
}

.doc-switch-option:hover {
  background: #fff;
  border-color: var(--doc-blue-2) !important;
  box-shadow: 0 0 0 4px rgba(79, 157, 212, 0.15) !important;
  outline: none;
}

.doc-addresses {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-wrap: wrap;
}

.doc-rx-patient-section {
  margin-left: -1rem;
  margin-right: -1rem;
  border-top: 2px solid #bae6fd;
  border-bottom: 2px solid #bae6fd;
  background: #f0f9ff;
}

.doc-rx-patient-form {
  background: #fff;
  border-radius: var(--doc-radius);
  border: 1px solid #bae6fd;
}

@media (min-width: 768px) {
  .doc-addresses {
    flex-direction: row;
  }

  .doc-addresses>div {
    flex-basis: calc(50% - (1em / 2));
  }

  .doc-rx-patient-section {
    margin-left: 0;
    margin-right: 0;
    border-radius: var(--doc-radius);
    border: 2px solid #bae6fd;
  }
}

/* Completely hide the secondary shipping wrapper for first-time buyers */
.shipping-wrapper.doc-unified-address-form {
  display: none !important;
}

.delivery-group-header {
  background: var(--doc-gray-5);
}

.deliver-date-wrapper {
  border: 1px dashed var(--doc-gray-1);
  border-radius: var(--doc-radius);
}

.cart-totals .bb {
  border-bottom: 1px solid var(--doc-gray-3);
}

.delivery-not-available {
  font-weight: var(--font-weight-inter-semibold);
  color: var(--doc-red-1);
  font-size: var(--font-size-xs)
}

.doc-delivery-card {
  font-family: var(--font-ubuntu);
  font-weight: var(--font-weight-ubuntu);
  font-size: var(--font-size-s);
}

.free-delivery-message-wrapper {
  font-size: var(--font-size-xs);
  line-height: 1.6;
}

.free-delivery-message .woocommerce-Price-amount {
  display: inline-flex;
  vertical-align: middle;
  line-height: 1;
}

.free-delivery-message .woocommerce-Price-currencySymbol {
  margin-top: 0.06rem;
}

.free-delivery-message-wrapper strong {
  font-family: var(--font-ubuntu);
  font-weight: var(--font-weight-ubuntu);
  color: var(--doc-blue-1);
}

/* ==========================================================================
   Thank You Page Styling
   ========================================================================== */
.woocommerce-checkout .doc-thankyou-page {
  font-family: var(--font-inter);
}

.doc-thankyou-hero {
  background: var(--doc-blue-3);
  border: 1px solid #bae6fd;
}

.doc-thankyou-hero.failed {
  border-color: #fecaca;
  background: #fef2f2;
}

.doc-thankyou-card {
  background: #fff;
  border: 1px solid var(--doc-gray-4);
  border-radius: var(--doc-radius);
  padding: 1.5rem;
  box-shadow: var(--box-shadow-4);
}

.doc-thankyou-card .card-title {
  font-family: var(--font-ubuntu);
  font-weight: var(--font-weight-ubuntu);
  color: var(--doc-blue-1);
}

/* Details Grid */
.details-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.details-grid .grid-item {
  flex-basis: calc(50% - 0.75rem);
  display: flex;
  flex-direction: column;
}

@media (max-width: 576px) {
  .details-grid .grid-item {
    flex-basis: 100%;
  }
}

.details-grid .label {
  font-size: var(--font-size-xxs);
  color: var(--doc-gray-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.details-grid .value {
  font-weight: 600;
  color: var(--doc-gray-1);
  font-size: var(--font-size-s);
}

/* Stepper Timeline */
.doc-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 2rem;
  margin-top: 1rem;
}

.doc-timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 11px;
  width: 2px;
  background: var(--doc-gray-4);
}

.timeline-step {
  position: relative;
  padding-bottom: 2rem;
}

.timeline-step:last-child {
  padding-bottom: 0;
}

.timeline-step .step-bullet {
  position: absolute;
  left: -29px;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--doc-gray-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--doc-gray-2);
  z-index: 2;
}

.timeline-step.completed .step-bullet {
  background: var(--doc-green-1);
  border-color: var(--doc-green-1);
  color: #fff;
}

.timeline-step.active .step-bullet {
  background: var(--doc-blue-2);
  border-color: var(--doc-blue-2);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(79, 157, 212, 0.15);
}

.timeline-step.active .step-title {
  color: var(--doc-blue-2);
}

.timeline-step .step-content {
  margin-left: 0.5rem;
}

.timeline-step .step-title {
  font-size: var(--font-size-s);
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--doc-gray-1);
}

.timeline-step .step-desc {
  font-size: var(--font-size-xs);
  color: var(--doc-gray-2);
  margin-bottom: 0;
  line-height: 1.4;
}

/* Purchased Items Styling */
.purchased-item:last-child {
  border-bottom: none !important;
}

.order-total-row .totals-label {
  font-weight: bold;
  color: var(--doc-gray-1) !important;
}

/* Actions styling */
.doc-thankyou-actions .single_add_to_cart_button {
  min-width: 200px;
}

/* ==========================================================================
   Empty Cart State
   ========================================================================== */
.doc-empty-cart-wrapper {
  background: #fff;
  border-radius: var(--doc-radius, 8px);
  border: 1px solid var(--doc-gray-4, #e2e8f0);
  padding: 4rem 2rem;
  max-width: 600px;
  margin: 2rem auto 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--box-shadow-4, 0 4px 6px -1px rgba(0, 0, 0, 0.05));
}

.doc-empty-cart-wrapper .empty-cart-icon {
  background: var(--doc-blue-3, #f0f9ff);
  border-radius: 50%;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.doc-empty-cart-wrapper .empty-cart-icon svg {
  width: 64px;
  height: 64px;
}

.doc-empty-cart-wrapper h2 {
  font-family: var(--font-ubuntu, sans-serif);
  font-weight: 600;
  color: var(--doc-blue-1, #1e3a8a);
  margin-bottom: 0.5rem;
}

.doc-empty-cart-wrapper p {
  color: var(--doc-gray-2, #64748b);
  max-width: 400px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.doc-empty-cart-wrapper .button {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-family: var(--font-inter, sans-serif);
  font-weight: 600;
  border-radius: var(--doc-radius, 8px);
  transition: all 0.3s ease;
  background: linear-gradient(180deg, #cb3b45 0%, #8f1e26 100%) !important;
  border: 1px solid #6b151b !important;
  color: #fff !important;
  display: inline-block;
  text-decoration: none;
  box-shadow: var(--box-shadow-3, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.doc-empty-cart-wrapper .button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  background: linear-gradient(180deg, #db4a54 0%, #ad2831 100%) !important;
}

/* ==========================================================================
   404 Not Found State (Inherits .doc-empty-cart-wrapper styles above)
   ========================================================================== */
.error404 {
  background-color: var(--doc-blue-3, #edf7ff);
}

.doc-404-wrapper .empty-cart-icon svg {
  width: 72px;
  height: 72px;
}
