/* ============================================================
   Cart drawer (mini-cart) + cart count badge + search form
   Matches the Cielo design system (navy #335572 / sky #67A2D7).
   ============================================================ */

/* --- Cart count badge on the header cart button --- */
.icon-btn.cart-btn { position: relative; }
.cart-count {
  position: absolute; top: -4px; right: -4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: #67A2D7; color: #fff;
  font-size: 10px; font-weight: 500; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.9);
  pointer-events: none;
}

/* --- Drawer shell --- */
.cart-drawer {
  position: fixed; inset: 0; z-index: 1000;
  visibility: hidden; pointer-events: none;
}
.cart-drawer.open { visibility: visible; pointer-events: auto; }

.cart-drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(14,58,91,0.35);
  opacity: 0; transition: opacity 0.35s ease;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.cart-drawer.open .cart-drawer-backdrop { opacity: 1; }

.cart-drawer-panel {
  position: absolute; top: 0; right: 0; height: 100%;
  width: min(420px, 100%);
  background: #fff; display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(51,85,114,0.18);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
  will-change: transform;
}
.cart-drawer.open .cart-drawer-panel { transform: translateX(0); }

/* --- Head --- */
.cart-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px; border-bottom: 1px solid rgba(51,85,114,0.10);
  flex-shrink: 0;
}
.cart-drawer-head h2 {
  font-size: 18px; font-weight: 400; color: #335572; letter-spacing: -0.02em; margin: 0;
}
.cart-drawer-head .cd-count { color: rgba(51,85,114,0.5); font-size: 15px; }
.cart-drawer-close {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid rgba(51,85,114,0.15);
  background: none; cursor: pointer; color: #335572; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.cart-drawer-close:hover { background: rgba(51,85,114,0.05); border-color: #335572; }

/* --- Body / items --- */
.cart-drawer-body { flex: 1; overflow-y: auto; padding: 12px 24px; }

.cd-item {
  display: flex; gap: 14px; align-items: center;
  padding: 16px 0; border-bottom: 1px solid rgba(51,85,114,0.08);
}
.cd-item .cd-thumb {
  width: 64px; height: 64px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg,#E8EEF1,#F2F6F8);
  display: flex; align-items: center; justify-content: center;
  color: #335572; font-size: 11px; font-weight: 500; text-align: center; padding: 6px; line-height: 1.2;
}
.cd-item .cd-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
.cd-item .cd-meta { flex: 1; min-width: 0; }
.cd-item .cd-nm { font-size: 14px; font-weight: 400; color: #335572; line-height: 1.35; }
.cd-item .cd-at { font-size: 13px; color: rgba(51,85,114,0.6); margin-top: 2px; }
.cd-item .cd-pr { font-size: 14px; color: #335572; margin-top: 4px; }

.cd-qty { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; }
.cd-qty button {
  width: 26px; height: 26px; border-radius: 999px; border: 1px solid rgba(51,85,114,0.20);
  background: none; cursor: pointer; color: #335572; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: border-color 0.15s;
}
.cd-qty button:hover { border-color: #335572; }
.cd-qty .cd-n { min-width: 20px; text-align: center; font-size: 14px; color: #335572; }

.cd-remove {
  background: none; border: none; cursor: pointer; color: rgba(51,85,114,0.3);
  flex-shrink: 0; align-self: flex-start; padding: 2px; transition: color 0.15s;
}
.cd-remove:hover { color: #335572; }

/* --- Empty state --- */
.cd-empty { text-align: center; padding: 64px 20px; color: rgba(51,85,114,0.6); }
.cd-empty svg { color: rgba(51,85,114,0.18); margin-bottom: 16px; }
.cd-empty p { font-size: 15px; margin-bottom: 24px; }
.cd-empty .cd-btn { display: inline-flex; }

/* --- Foot --- */
.cart-drawer-foot {
  flex-shrink: 0; padding: 20px 24px; border-top: 1px solid rgba(51,85,114,0.10);
  display: flex; flex-direction: column; gap: 12px;
}
.cd-ship-note {
  font-size: 13px; color: rgba(51,85,114,0.7); text-align: center;
  background: rgba(103,162,215,0.08); border: 1px solid rgba(103,162,215,0.16);
  border-radius: 10px; padding: 8px 12px;
}
.cd-ship-note.free { color: #16a34a; background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.2); }
.cd-ship-note:empty { display: none; }
.cd-subtotal {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 16px; color: #335572;
}
.cd-subtotal span:last-child { font-size: 20px; letter-spacing: -0.02em; }
.cd-btn {
  display: flex; align-items: center; justify-content: center; height: 48px;
  border-radius: 999px; font-size: 15px; text-decoration: none; transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}
.cd-btn-primary { background: #335572; color: #fff; }
.cd-btn-primary:hover { opacity: 0.9; }
.cd-btn-ghost { background: transparent; color: #335572; border: 1.5px solid rgba(51,85,114,0.2); height: 44px; }
.cd-btn-ghost:hover { border-color: #335572; }

/* --- Search box as a <form> (unchanged look) --- */
.search-box { display: flex; align-items: center; gap: 12px; }
.search-box input { flex: 1; border: none; outline: none; background: transparent; }

/* ============================================================
   WooCommerce mini-cart inside the drawer (custom markup)
   Layout: [free-ship bar] · [scrolling item list] · [pinned foot]
   ============================================================ */
.cart-drawer-body--woo { flex: 1; display: flex; min-height: 0; padding: 0; }
.cart-drawer-body--woo .widget_shopping_cart_content {
  flex: 1; display: flex; flex-direction: column; min-height: 0; width: 100%;
}
.cart-drawer-panel.is-busy { pointer-events: none; }
.cart-drawer-panel.is-busy .widget_shopping_cart_content { opacity: 0.55; transition: opacity 0.15s; }

/* Free-shipping bar sits at the very top, never scrolls */
.cart-drawer-body--woo .cd-ship-progress { flex-shrink: 0; }

/* Scrolling item list */
.woocommerce-mini-cart {
  list-style: none; margin: 0; padding: 4px 24px 8px; flex: 1; overflow-y: auto; min-height: 0;
}
.woocommerce-mini-cart__empty-message {
  padding: 56px 24px; text-align: center; color: rgba(51,85,114,0.6); font-size: 15px; margin: 0;
}

/* Line item */
.woocommerce-mini-cart-item {
  list-style: none; padding: 16px 0; margin: 0; border-bottom: 1px solid rgba(51,85,114,0.08);
}
.cd-line { display: flex; align-items: flex-start; gap: 12px; position: relative; }
.cd-line-thumb { flex-shrink: 0; width: 60px; height: 60px; display: block; border-radius: 14px; overflow: hidden; }
.cd-line-thumb img {
  width: 60px; height: 60px; object-fit: cover; border-radius: 14px; display: block;
  background: linear-gradient(135deg,#E8EEF1,#F2F6F8);
}
.cd-line-main { flex: 1; min-width: 0; padding-right: 22px; }
.cd-line-name {
  display: block; color: #335572; font-size: 14px; line-height: 1.35; text-decoration: none; font-weight: 400;
}
.cd-line-name:hover { color: #67A2D7; }
.cd-line-attr { font-size: 12.5px; color: rgba(51,85,114,0.6); margin-top: 2px; }
.cd-line-attr p { margin: 0; }
.cd-line-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.cd-line-price { font-size: 14px; color: #335572; white-space: nowrap; }

/* Quantity stepper */
.cd-qty {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid rgba(51,85,114,0.18); border-radius: 999px; padding: 2px;
}
.cd-qty-btn {
  width: 26px; height: 26px; border: none; background: none; cursor: pointer; color: #335572;
  font-size: 15px; line-height: 1; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.cd-qty-btn:hover { background: rgba(51,85,114,0.07); }
.cd-qty-n { min-width: 24px; text-align: center; font-size: 14px; color: #335572; }
.cd-qty--fixed { padding: 4px 12px; }

/* Remove (×) top-right of the line */
.cart-drawer-body--woo .remove_from_cart_button {
  position: absolute; top: 0; right: 0; width: 22px; height: 22px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1;
  color: rgba(51,85,114,0.4) !important; text-decoration: none; border: 1px solid rgba(51,85,114,0.14);
  transition: color 0.15s, border-color 0.15s;
}
.cart-drawer-body--woo .remove_from_cart_button:hover { color: #335572 !important; border-color: #335572; }

/* ---------------- Pinned foot ---------------- */
.cd-foot-woo {
  flex-shrink: 0; padding: 16px 24px 20px; border-top: 1px solid rgba(51,85,114,0.10);
  display: flex; flex-direction: column; gap: 14px;
}

/* Trust badges */
.cd-trust { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.cd-trust-i {
  display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center;
  font-size: 10.5px; letter-spacing: 0.02em; color: rgba(51,85,114,0.75);
  padding: 10px 6px; border: 1px solid rgba(51,85,114,0.10); border-radius: 12px; background: rgba(51,85,114,0.02);
}

/* Coupon */
.cd-coupon { display: flex; flex-direction: column; gap: 8px; }
.cd-coupon-row { display: flex; gap: 8px; }
.cd-coupon-input {
  flex: 1; min-width: 0; height: 42px; border: 1.5px solid rgba(51,85,114,0.15); border-radius: 999px;
  padding: 0 16px; font-family: inherit; font-size: 14px; color: #335572; outline: none; background: #fff;
  transition: border-color 0.15s;
}
.cd-coupon-input:focus { border-color: #67A2D7; }
.cd-coupon-input::placeholder { color: rgba(51,85,114,0.4); }
.cd-coupon-apply {
  flex-shrink: 0; height: 42px; padding: 0 20px; border-radius: 999px; border: none; cursor: pointer;
  background: rgba(51,85,114,0.10); color: #335572; font-family: inherit; font-size: 14px; font-weight: 500;
  transition: background 0.15s;
}
.cd-coupon-apply:hover { background: rgba(51,85,114,0.16); }
.cd-coupon-msg { font-size: 12.5px; margin: 0; min-height: 0; }
.cd-coupon-msg:empty { display: none; }
.cd-coupon-msg.is-ok { color: #16a34a; }
.cd-coupon-msg.is-err { color: #dc2626; }
.cd-coupon-applied { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-coupon-tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #335572;
  background: rgba(103,162,215,0.12); border: 1px solid rgba(103,162,215,0.2); border-radius: 999px; padding: 4px 6px 4px 12px;
}
.cd-coupon-remove {
  width: 18px; height: 18px; border-radius: 999px; border: none; cursor: pointer; line-height: 1; font-size: 13px;
  background: rgba(51,85,114,0.10); color: #335572; display: flex; align-items: center; justify-content: center;
}
.cd-coupon-remove:hover { background: rgba(51,85,114,0.2); }

/* Subtotal */
.cd-subtotal { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; color: #335572; }
.cd-subtotal span:last-child { font-size: 20px; letter-spacing: -0.02em; }
.cd-subtotal .amount { font-size: 20px; }

/* Ship-today note */
.cd-ship-today {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 12.5px; color: rgba(51,85,114,0.75);
  background: rgba(103,162,215,0.08); border: 1px solid rgba(103,162,215,0.16);
  border-radius: 10px; padding: 9px 12px;
}
.cd-ship-today svg { color: #67A2D7; flex-shrink: 0; }

/* Checkout button with running total */
.cd-checkout-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px;
  border-radius: 999px; background: #335572; color: #fff; font-size: 15px; text-decoration: none;
  transition: opacity 0.15s;
}
.cd-checkout-btn:hover { opacity: 0.9; color: #fff; }
.cd-checkout-btn .amount { color: #fff; }

/* View full cart */
.cd-viewcart {
  text-align: center; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(51,85,114,0.7); text-decoration: none; transition: color 0.15s;
}
.cd-viewcart:hover { color: #335572; }

/* Payment icons */
.cd-payments { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin-top: 2px; }
.cd-pay { display: block; }

/* Disclaimer */
.cd-disclaimer { font-size: 11px; line-height: 1.5; color: rgba(51,85,114,0.55); text-align: center; margin: 0; }

/* Empty state (woo) reuses .cd-empty styling */
.cd-empty--woo { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
