/*
 * Dynapharm Smart Checkout — checkout.css
 * Loaded only on cart + checkout pages.
 * Uses CSS custom properties from the Dynapharm theme.
 * Zero conflicts with WooCommerce core styles.
 */

/* ──────────────────────────────────────────────────────────
   SHARED CUSTOM PROPERTIES
   (fallback values if theme vars not present)
────────────────────────────────────────────────────────── */
:root {
  --dsc-green:       var(--c-green-600, #2e8b47);
  --dsc-green-dark:  var(--c-green-800, #1a5c2a);
  --dsc-green-light: var(--c-green-100, #e8f5ec);
  --dsc-gold:        var(--c-gold-500,  #c8971a);
  --dsc-red:         var(--c-red-600,   #d32f2f);
  --dsc-wa:          var(--c-wa-green,  #25d366);
  --dsc-wa-dark:     var(--c-wa-dark,   #128c47);
  --dsc-white:       #ffffff;
  --dsc-gray-50:     #f7f7f7;
  --dsc-gray-100:    #f0f0f0;
  --dsc-gray-200:    #e0e0e0;
  --dsc-gray-400:    #aaaaaa;
  --dsc-gray-600:    #666666;
  --dsc-gray-900:    #1a1a1a;
  --dsc-text:        #2d3748;
  --dsc-bg:          #f8faf8;
  --dsc-radius:      10px;
  --dsc-radius-sm:   6px;
  --dsc-radius-full: 9999px;
  --dsc-shadow:      0 2px 12px rgba(0,0,0,.08);
  --dsc-shadow-md:   0 4px 24px rgba(0,0,0,.10);
  --dsc-t:           .2s ease;
}

/* ──────────────────────────────────────────────────────────
   USD DISPLAY ROWS
────────────────────────────────────────────────────────── */
tr.dsc-usd-row th,
tr.dsc-usd-row td {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  border-top: 1px dashed var(--dsc-gray-200) !important;
  background: var(--dsc-green-light) !important;
}

tr.dsc-usd-row th {
  color: var(--dsc-green-dark) !important;
  font-weight: 700 !important;
  font-size: .84rem !important;
}

.dsc-usd-amount {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dsc-green-dark);
  background: var(--dsc-white);
  border: 1.5px solid var(--dsc-green);
  border-radius: var(--dsc-radius-sm);
  padding: 3px 10px;
  margin-right: 8px;
}

.dsc-usd-note {
  font-size: .72rem;
  color: var(--dsc-gray-600);
  font-style: italic;
}

/* Item-level USD */
.dsc-item-usd {
  display: block;
  font-size: .72rem;
  color: var(--dsc-green);
  margin-top: 2px;
  font-weight: 500;
}

/* ──────────────────────────────────────────────────────────
   CHECKOUT PROGRESS STEPS
   (Matches store.link cart reference)
────────────────────────────────────────────────────────── */
.dsc-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 20px 0 28px;
  border-bottom: 1px solid var(--dsc-gray-100);
  margin-bottom: 32px;
}

.dsc-step {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .84rem;
  font-weight: 500;
  color: var(--dsc-gray-400);
}

.dsc-step.active {
  color: var(--dsc-green);
  font-weight: 700;
}

.dsc-step.done {
  color: var(--dsc-green);
}

.dsc-step__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dsc-gray-200);
  flex-shrink: 0;
  transition: background var(--dsc-t);
}

.dsc-step.active .dsc-step__dot,
.dsc-step.done .dsc-step__dot {
  background: var(--dsc-green);
}

.dsc-step__line {
  width: 72px;
  height: 1px;
  background: var(--dsc-gray-200);
  margin: 0 8px;
}

/* ──────────────────────────────────────────────────────────
   MINIMAL CHECKOUT FORM
────────────────────────────────────────────────────────── */

/* Hide auto-filled / non-essential fields */
.dsc-hidden-field {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Pre-filled (like country) — shown but compact */
.dsc-prefilled-field {
  opacity: .7;
}

/* Form section titles */
.woocommerce-billing-fields h3,
.woocommerce-shipping-fields h3,
#order_review_heading {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--dsc-gray-900) !important;
  padding: 14px 0 8px !important;
  border-bottom: 2px solid var(--dsc-green-light) !important;
  margin-bottom: 20px !important;
  font-family: inherit !important;
}

/* Input fields — clean, consistent */
.woocommerce-checkout .form-row input[type="text"],
.woocommerce-checkout .form-row input[type="email"],
.woocommerce-checkout .form-row input[type="tel"],
.woocommerce-checkout .form-row input[type="number"],
.woocommerce-checkout .form-row select,
.woocommerce-checkout .form-row textarea {
  width: 100% !important;
  border: 1.5px solid var(--dsc-gray-200) !important;
  border-radius: var(--dsc-radius-sm) !important;
  padding: 11px 14px !important;
  font-size: .92rem !important;
  color: var(--dsc-text) !important;
  background: var(--dsc-white) !important;
  outline: none !important;
  transition: border-color var(--dsc-t), box-shadow var(--dsc-t) !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  box-shadow: none !important;
}

.woocommerce-checkout .form-row input:focus,
.woocommerce-checkout .form-row select:focus,
.woocommerce-checkout .form-row textarea:focus {
  border-color: var(--dsc-green) !important;
  box-shadow: 0 0 0 3px rgba(46,139,71,.1) !important;
}

/* Labels */
.woocommerce-checkout .form-row label {
  font-size: .82rem !important;
  font-weight: 600 !important;
  color: var(--dsc-gray-600) !important;
  margin-bottom: 5px !important;
  display: block !important;
}

/* Required star */
.woocommerce-checkout .form-row .required {
  color: var(--dsc-red) !important;
}

/* ──────────────────────────────────────────────────────────
   PLACE ORDER BUTTON — Full width, green
────────────────────────────────────────────────────────── */
#place_order,
.woocommerce-checkout #place_order {
  display: block !important;
  width: 100% !important;
  background: var(--dsc-green) !important;
  color: var(--dsc-white) !important;
  border: none !important;
  border-radius: var(--dsc-radius-sm) !important;
  padding: 15px !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  letter-spacing: .02em !important;
  cursor: pointer !important;
  transition: background var(--dsc-t), transform var(--dsc-t) !important;
  text-align: center !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  margin-top: 16px !important;
}

#place_order:hover,
.woocommerce-checkout #place_order:hover {
  background: var(--dsc-green-dark) !important;
  transform: translateY(-1px) !important;
}

/* ──────────────────────────────────────────────────────────
   ORDER REVIEW TABLE (right column)
────────────────────────────────────────────────────────── */
#order_review {
  background: var(--dsc-white) !important;
  border: 1.5px solid var(--dsc-gray-100) !important;
  border-radius: var(--dsc-radius) !important;
  padding: 20px !important;
  box-shadow: var(--dsc-shadow) !important;
}

#order_review table.shop_table {
  border: none !important;
  width: 100% !important;
}

#order_review table.shop_table thead th {
  background: var(--dsc-green-light) !important;
  color: var(--dsc-green-dark) !important;
  font-size: .78rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .05em !important;
  padding: 8px 12px !important;
  border: none !important;
}

#order_review table.shop_table td,
#order_review table.shop_table th {
  border: none !important;
  border-bottom: 1px solid var(--dsc-gray-100) !important;
  padding: 10px 12px !important;
  font-size: .88rem !important;
}

#order_review table.shop_table tr:last-child td,
#order_review table.shop_table tr:last-child th {
  border-bottom: none !important;
  font-weight: 700 !important;
  font-size: .95rem !important;
  color: var(--dsc-gray-900) !important;
}

/* Total row highlighted */
#order_review .order-total th,
#order_review .order-total td {
  background: var(--dsc-green-light) !important;
  color: var(--dsc-green-dark) !important;
  font-size: 1rem !important;
  font-weight: 800 !important;
}

/* ──────────────────────────────────────────────────────────
   CART TABLE
────────────────────────────────────────────────────────── */
.woocommerce-cart-form table.cart {
  background: var(--dsc-white) !important;
  border-radius: var(--dsc-radius) !important;
  overflow: hidden !important;
  box-shadow: var(--dsc-shadow) !important;
  border: 1.5px solid var(--dsc-gray-100) !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
}

/* Hide table headers for clean minimal look */
.woocommerce-cart-form table.cart thead {
  background: var(--dsc-green-light) !important;
}

.woocommerce-cart-form table.cart thead th {
  color: var(--dsc-green-dark) !important;
  font-size: .75rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
  padding: 10px 16px !important;
  border: none !important;
}

.woocommerce-cart-form table.cart td {
  padding: 16px !important;
  border: none !important;
  border-bottom: 1px solid var(--dsc-gray-100) !important;
  vertical-align: middle !important;
}

.woocommerce-cart-form table.cart tr:last-child td {
  border-bottom: none !important;
}

/* Cart product thumbnail */
.woocommerce-cart-form .product-thumbnail {
  width: 72px !important;
  padding-right: 0 !important;
}

.woocommerce-cart-form .product-thumbnail img {
  width: 64px !important;
  height: 64px !important;
  object-fit: cover !important;
  border-radius: var(--dsc-radius-sm) !important;
  border: 1.5px solid var(--dsc-gray-100) !important;
}

/* Product name in cart */
.woocommerce-cart-form .product-name {
  font-size: .9rem !important;
  font-weight: 600 !important;
  color: var(--dsc-gray-900) !important;
}

.woocommerce-cart-form .product-name a {
  color: var(--dsc-gray-900) !important;
  text-decoration: none !important;
}
.woocommerce-cart-form .product-name a:hover {
  color: var(--dsc-green) !important;
}

/* Price in cart */
.woocommerce-cart-form .product-price,
.woocommerce-cart-form .product-subtotal {
  font-weight: 700 !important;
  color: var(--dsc-red) !important;
  font-size: .95rem !important;
}

/* Remove button */
.woocommerce-cart-form a.remove {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  background: var(--dsc-gray-100) !important;
  color: var(--dsc-gray-600) !important;
  font-size: .85rem !important;
  text-decoration: none !important;
  transition: all var(--dsc-t) !important;
  line-height: 1 !important;
}
.woocommerce-cart-form a.remove:hover {
  background: var(--dsc-red) !important;
  color: var(--dsc-white) !important;
}

/* Quantity control */
.woocommerce .quantity {
  display: flex !important;
  align-items: center !important;
  border: 1.5px solid var(--dsc-gray-200) !important;
  border-radius: var(--dsc-radius-sm) !important;
  overflow: hidden !important;
  width: fit-content !important;
  background: var(--dsc-white) !important;
}

.woocommerce .quantity input.qty {
  width: 44px !important;
  text-align: center !important;
  border: none !important;
  padding: 7px 4px !important;
  font-size: .9rem !important;
  font-weight: 700 !important;
  color: var(--dsc-gray-900) !important;
  background: transparent !important;
  -moz-appearance: textfield !important;
  -webkit-appearance: none !important;
}

.woocommerce .quantity input.qty::-webkit-outer-spin-button,
.woocommerce .quantity input.qty::-webkit-inner-spin-button { display: none !important; }

/* Qty +/- buttons injected by JS */
.dsc-qty-btn {
  background: none !important;
  border: none !important;
  padding: 6px 10px !important;
  cursor: pointer !important;
  color: var(--dsc-gray-600) !important;
  transition: color var(--dsc-t), background var(--dsc-t) !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}
.dsc-qty-btn:hover {
  color: var(--dsc-green) !important;
  background: var(--dsc-green-light) !important;
}

/* ──────────────────────────────────────────────────────────
   CART TOTALS BOX
────────────────────────────────────────────────────────── */
.cart_totals {
  background: var(--dsc-white) !important;
  border: 1.5px solid var(--dsc-gray-100) !important;
  border-radius: var(--dsc-radius) !important;
  padding: 22px !important;
  box-shadow: var(--dsc-shadow) !important;
}

.cart_totals h2 {
  font-size: 1rem !important;
  font-weight: 700 !important;
  margin-bottom: 18px !important;
  padding-bottom: 10px !important;
  border-bottom: 1px solid var(--dsc-gray-100) !important;
  color: var(--dsc-gray-900) !important;
  font-family: inherit !important;
}

.cart_totals table {
  width: 100% !important;
  border-collapse: collapse !important;
}

.cart_totals table th,
.cart_totals table td {
  padding: 9px 0 !important;
  border: none !important;
  border-bottom: 1px solid var(--dsc-gray-100) !important;
  font-size: .88rem !important;
}

.cart_totals table tr:last-child th,
.cart_totals table tr:last-child td {
  border-bottom: none !important;
  font-weight: 700 !important;
  font-size: .98rem !important;
  padding-top: 12px !important;
}

.cart_totals .shipping td {
  color: var(--dsc-gray-400) !important;
  font-style: italic !important;
}

/* Checkout / Proceed button */
.wc-proceed-to-checkout .checkout-button,
.wc-proceed-to-checkout a.checkout-button {
  display: block !important;
  width: 100% !important;
  background: var(--dsc-green) !important;
  color: var(--dsc-white) !important;
  border: none !important;
  border-radius: var(--dsc-radius-sm) !important;
  padding: 14px !important;
  font-size: .95rem !important;
  font-weight: 700 !important;
  text-align: center !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: background var(--dsc-t) !important;
  margin-top: 14px !important;
  letter-spacing: .02em !important;
}
.wc-proceed-to-checkout .checkout-button:hover {
  background: var(--dsc-green-dark) !important;
  color: var(--dsc-white) !important;
}

/* Continue shopping */
.dsc-continue-shopping {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--dsc-green);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  margin-top: 12px;
  padding: 6px 0;
  transition: color var(--dsc-t);
}
.dsc-continue-shopping:hover { color: var(--dsc-green-dark); }

/* ──────────────────────────────────────────────────────────
   LOCATION DETECTION UI
────────────────────────────────────────────────────────── */
.dsc-location-detect {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--dsc-green-light);
  border: 1px solid rgba(46,139,71,.2);
  border-radius: var(--dsc-radius-sm);
  margin-bottom: 8px;
  font-size: .82rem;
  color: var(--dsc-green-dark);
  cursor: pointer;
  transition: background var(--dsc-t);
}
.dsc-location-detect:hover { background: #d4edda; }
.dsc-location-detect svg { width: 16px; height: 16px; flex-shrink: 0; }

.dsc-location-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(46,139,71,.3);
  border-top-color: var(--dsc-green);
  border-radius: 50%;
  animation: dsc-spin .7s linear infinite;
  flex-shrink: 0;
}

@keyframes dsc-spin {
  to { transform: rotate(360deg); }
}

.dsc-location-error {
  color: var(--dsc-red);
  font-size: .78rem;
  margin-top: 4px;
}

/* ──────────────────────────────────────────────────────────
   PAYPAL UI ENHANCEMENT
────────────────────────────────────────────────────────── */
.dsc-paypal-note {
  background: var(--dsc-green-light);
  border: 1px solid rgba(46,139,71,.2);
  border-radius: var(--dsc-radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: .8rem;
  color: var(--dsc-green-dark);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.dsc-paypal-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

/* ──────────────────────────────────────────────────────────
   WHATSAPP ORDER OPTION
────────────────────────────────────────────────────────── */
.dsc-wa-checkout {
  background: var(--dsc-white);
  border: 1.5px solid var(--dsc-gray-100);
  border-radius: var(--dsc-radius);
  padding: 18px;
  margin-top: 20px;
  box-shadow: var(--dsc-shadow);
}

.dsc-wa-checkout__title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--dsc-gray-900);
  margin-bottom: 6px;
}

.dsc-wa-checkout__sub {
  font-size: .78rem;
  color: var(--dsc-gray-600);
  margin-bottom: 12px;
}

.dsc-wa-checkout__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--dsc-wa);
  color: var(--dsc-white);
  border: none;
  border-radius: var(--dsc-radius-sm);
  padding: 12px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dsc-t);
}
.dsc-wa-checkout__btn:hover { background: var(--dsc-wa-dark); color: var(--dsc-white); }
.dsc-wa-checkout__btn svg { width: 20px; height: 20px; }

/* ──────────────────────────────────────────────────────────
   WC NOTICES — styled to match theme
────────────────────────────────────────────────────────── */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
  border-radius: var(--dsc-radius-sm) !important;
  border-left: 4px solid var(--dsc-green) !important;
  background: var(--dsc-green-light) !important;
  padding: 12px 18px !important;
  margin-bottom: 20px !important;
  font-size: .88rem !important;
  color: var(--dsc-gray-900) !important;
  list-style: none !important;
  box-shadow: none !important;
}

.woocommerce-error {
  border-left-color: var(--dsc-red) !important;
  background: #fff0f0 !important;
}

/* ──────────────────────────────────────────────────────────
   PAYMENT METHODS LIST
────────────────────────────────────────────────────────── */
#payment {
  background: var(--dsc-white) !important;
  border-radius: var(--dsc-radius) !important;
  overflow: hidden !important;
  border: 1.5px solid var(--dsc-gray-100) !important;
}

#payment ul.payment_methods {
  padding: 0 !important;
  margin: 0 !important;
  list-style: none !important;
}

#payment ul.payment_methods li {
  padding: 14px 18px !important;
  border-bottom: 1px solid var(--dsc-gray-100) !important;
}

#payment ul.payment_methods li:last-child {
  border-bottom: none !important;
}

#payment ul.payment_methods li label {
  font-weight: 600 !important;
  color: var(--dsc-gray-900) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

#payment .payment_box {
  background: var(--dsc-gray-50) !important;
  border-radius: var(--dsc-radius-sm) !important;
  padding: 12px 16px !important;
  margin-top: 8px !important;
  font-size: .84rem !important;
  color: var(--dsc-gray-600) !important;
}

#payment .place-order {
  padding: 18px !important;
  background: var(--dsc-green-light) !important;
}

/* ──────────────────────────────────────────────────────────
   RESPONSIVE
────────────────────────────────────────────────────────── */
@media screen and (max-width: 768px) {
  .dsc-steps {
    gap: 0;
    padding: 14px 0 20px;
  }

  .dsc-step__line { width: 32px; }
  .dsc-step { font-size: .75rem; gap: 5px; }

  /* Cart items — hide price column on small screens */
  .woocommerce-cart-form table.cart .product-price { display: none; }

  /* Stack checkout form + summary vertically on mobile */
  .woocommerce-checkout form.woocommerce-checkout {
    display: block !important;
  }

  /* Full-width qty controls */
  .dsc-wa-checkout { margin-top: 16px; }

  /* Reduce padding on cart table cells */
  .woocommerce-cart-form table.cart td {
    padding: 12px 8px !important;
  }

  .dsc-usd-amount { font-size: .9rem; }
}

@media screen and (max-width: 480px) {
  .dsc-steps { display: none; } /* hide steps on very small screens */

  .woocommerce-cart-form table.cart .product-thumbnail {
    width: 50px !important;
  }
  .woocommerce-cart-form .product-thumbnail img {
    width: 46px !important;
    height: 46px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   PRINT — hide interactive elements
────────────────────────────────────────────────────────── */
@media print {
  .dsc-wa-checkout,
  .dsc-location-detect,
  .dsc-steps { display: none !important; }
}
