/* ====================================================
   365Med Shopping Cart — cart.css
   ==================================================== */

/* ── Toast notification ─────────────────────────────── */
#med-cart-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  background: #1a3c6e;
  color: #fff;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  line-height: 1.5;
}
#med-cart-toast a { color: #7ecbff; text-decoration: underline; }
#med-cart-toast.med-toast--error { background: #c0392b; }

/* ── View Cart widget wrapper ────────────────────────── */
.med-cart-widget {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* ── Header cart button ──────────────────────────────── */
.med-cart-widget--header .med-view-cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #005eb8;
  border: none;
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: background 0.18s, box-shadow 0.18s;
  box-shadow: 0 2px 8px rgba(0,94,184,0.25);
  white-space: nowrap;
}
.med-cart-widget--header .med-view-cart-btn:hover {
  background: #004a93;
  transform: none;
  box-shadow: 0 4px 14px rgba(0,94,184,0.35);
  text-decoration: none;
  color: #fff;
}
.med-cart-widget--header .med-view-cart-label { display: inline; }

/* ── Default (non-floating) button ───────────────────── */
.med-view-cart-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #005eb8;
  border: none;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: background 0.18s, box-shadow 0.18s;
}
.med-view-cart-btn:hover {
  background: #004a93;
  color: #fff;
  text-decoration: none;
}
.med-view-cart-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
/* Hide label by default in header context */
.med-view-cart-label { display: none; }

/* ── Cart badge pill ─────────────────────────────────── */
.med-cart-badge {
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
  transition: transform 0.2s;
}
.med-view-cart-btn:hover .med-cart-badge,
.med-cart-widget:hover .med-cart-badge {
  background: #fff;
  color: #e74c3c;
}

/* Badge in header button: inline, no absolute positioning */
.med-cart-widget--header .med-cart-badge {
  position: static;
  min-width: 20px;
  height: 20px;
  font-size: 12px;
  border-radius: 10px;
  border: none;
  animation: none;
}
.med-cart-widget--header .med-view-cart-btn:hover .med-cart-badge {
  background: #fff;
  color: #e74c3c;
}

/* ── Cart dropdown panel ─────────────────────────────── */
.med-cart-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid #e8e8e8;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  pointer-events: none;
}
/* Arrow pointer (default: points up from top) */
.med-cart-dropdown::before {
  content: '';
  position: absolute;
  top: -7px;
  right: 22px;
  width: 13px;
  height: 13px;
  background: #fff;
  border-left: 1px solid #e8e8e8;
  border-top: 1px solid #e8e8e8;
  transform: rotate(45deg);
  border-radius: 2px 0 0 0;
}
/* Show on hover — both when hovering button and dropdown itself */
.med-cart-widget:hover .med-cart-dropdown,
.med-cart-dropdown:hover,
.med-cart-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Header widget: panel drops below the button ────── */
.med-cart-widget--header .med-cart-dropdown {
  top: calc(100% + 12px);
  right: 0;
  bottom: auto;
}
.med-cart-dropdown-inner {
  padding: 16px;
  max-height: 420px;
  overflow-y: auto;
}

/* ── Responsive: dropdown on mobile ──────────────────── */
@media (max-width: 768px) {
  .med-cart-dropdown {
    right: -8px;
    width: 300px;
    max-width: calc(100vw - 24px);
  }
  .med-cart-dropdown::before { right: 18px; }
}

/* ── Responsive: very small screens ─────────────────── */
@media (max-width: 400px) {
  .med-cart-dropdown {
    right: -16px;
    width: 280px;
    max-width: calc(100vw - 16px);
  }
}

/* ── Preview: empty state ────────────────────────────── */
.med-preview-empty {
  text-align: center;
  padding: 24px 16px;
  color: #888;
}
.med-preview-empty-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.med-preview-empty p    { font-size: 0.9rem; margin-bottom: 12px; }
.med-preview-shop-link  { font-size: 0.85rem; color: #005eb8; text-decoration: underline; }

/* ── Preview: items list ─────────────────────────────── */
.med-preview-items {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.med-preview-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f3f3f3;
}
.med-preview-item:last-child { border-bottom: none; }
.med-preview-item-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.med-preview-item-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.med-preview-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1a3c6e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.med-preview-item-meta {
  font-size: 0.75rem;
  color: #999;
}
.med-preview-item-line {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1a3c6e;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Preview: shipping nudge ─────────────────────────── */
.med-preview-shipping-nudge {
  font-size: 0.75rem;
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #795548;
  border-radius: 6px;
  padding: 7px 10px;
  margin-bottom: 12px;
  text-align: center;
}
.med-preview-shipping-nudge--free {
  background: #e8f5e9;
  border-color: #a5d6a7;
  color: #2e7d32;
}

/* ── Preview: total row ──────────────────────────────── */
.med-preview-totals {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-top: 2px solid #f0f0f0;
  margin-bottom: 14px;
}
.med-preview-label       { font-size: 0.85rem; color: #555; font-weight: 600; }
.med-preview-total-amount { font-size: 1.1rem; font-weight: 700; color: #1a3c6e; }

/* ── Preview: action buttons ─────────────────────────── */
.med-preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.med-preview-btn {
  display: block;
  text-align: center;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.18s;
  font-family: inherit;
}
.med-preview-btn--outline {
  border: 2px solid #005eb8;
  color: #005eb8;
  background: #fff;
}
.med-preview-btn--outline:hover {
  background: #f0f6ff;
  text-decoration: none;
  color: #003d78;
}
.med-preview-btn--primary {
  background: #005eb8;
  color: #fff;
  border: 2px solid #005eb8;
}
.med-preview-btn--primary:hover {
  background: #003d78;
  border-color: #003d78;
  text-decoration: none;
  color: #fff;
}

/* ── Empty cart ─────────────────────────────────────── */
.med-cart-empty {
  text-align: center;
  padding: 64px 24px;
}
.med-cart-empty-icon { font-size: 64px; margin-bottom: 16px; }
.med-cart-empty h2   { font-size: 1.6rem; margin-bottom: 8px; color: #1a3c6e; }
.med-cart-empty p    { color: #666; margin-bottom: 24px; }

/* ── Shipping banner ────────────────────────────────── */
.med-shipping-banner {
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #5d4037;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 24px;
  text-align: center;
}
.med-shipping-banner--free {
  background: #e8f5e9;
  border-color: #a5d6a7;
  color: #2e7d32;
}

/* ── Cart layout ────────────────────────────────────── */
.med-cart-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 768px) {
  .med-cart-layout { grid-template-columns: 1fr; }
}

/* ── Cart table ─────────────────────────────────────── */
.med-cart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.med-cart-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid #e0e0e0;
  color: #555;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.med-cart-table td {
  padding: 16px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.med-cart-row--removing { opacity: 0.4; pointer-events: none; }

.col-price, .col-subtotal { white-space: nowrap; }
.col-remove { width: 40px; }
.col-qty { width: 130px; }

.med-cart-product {
  display: flex;
  align-items: center;
  gap: 12px;
}
.med-cart-product-icon { font-size: 28px; }
.med-cart-product-name { font-weight: 600; color: #1a3c6e; }
.med-cart-product-sku  { font-size: 0.8rem; color: #999; margin-top: 2px; }
.med-p-badge { background: #005EB8; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; letter-spacing: 0.03em; vertical-align: middle; }
.med-qty-limit { font-size: 11px; color: #999; text-align: center; margin-top: 4px; }

/* ── Quantity control ───────────────────────────────── */
.med-qty-control {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  width: 110px;
}
.med-qty-btn {
  background: #f5f5f5;
  border: none;
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}
.med-qty-btn:hover { background: #e0e0e0; }
.med-qty-input {
  width: 40px;
  text-align: center;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  padding: 6px 4px;
  font-size: 0.9rem;
  -moz-appearance: textfield;
}
.med-qty-input::-webkit-inner-spin-button,
.med-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── Remove button ──────────────────────────────────── */
.med-remove-btn {
  background: none;
  border: 1px solid #ddd;
  color: #999;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.med-remove-btn:hover { background: #fee; color: #c0392b; border-color: #c0392b; }

/* ── Cart actions ───────────────────────────────────── */
.med-cart-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-start;
}

/* ── Cart summary box ───────────────────────────────── */
.med-cart-summary {
  background: #f8f9fb;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 24px;
}
.med-cart-summary h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a3c6e;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e0e0e0;
}
.med-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.95rem;
  color: #555;
}
.med-summary-total {
  font-weight: 700;
  font-size: 1.1rem;
  color: #1a3c6e;
  border-top: 2px solid #e0e0e0;
  margin-top: 8px;
  padding-top: 12px;
}
.med-summary-note {
  font-size: 0.78rem;
  color: #999;
  margin: 8px 0 20px;
}
.btn-block { width: 100%; display: block; text-align: center; }
.med-trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}
.med-trust-badges span {
  font-size: 0.75rem;
  background: #e8f0ff;
  color: #1a3c6e;
  padding: 4px 8px;
  border-radius: 20px;
}

/* ── Products Grid ──────────────────────────────────── */
.med-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
  margin-top: 24px;
}
.med-product-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}
.med-product-card:hover {
  box-shadow: 0 6px 24px rgba(26,60,110,0.12);
  transform: translateY(-2px);
}
.med-product-badge {
  background: #e8f0ff;
  color: #1a3c6e;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 12px;
}
.med-product-icon {
  font-size: 48px;
  text-align: center;
  padding: 20px 0 8px;
}
.med-product-body {
  padding: 0 16px 12px;
  flex: 1;
}
.med-product-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a3c6e;
  margin-bottom: 6px;
  line-height: 1.35;
}
.med-product-desc {
  font-size: 0.82rem;
  color: #666;
  line-height: 1.5;
}
.med-product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 16px;
  border-top: 1px solid #f0f0f0;
}
.med-product-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a3c6e;
}
.med-out-of-stock {
  font-size: 0.8rem;
  color: #999;
  font-style: italic;
}

/* ── Checkout Layout ────────────────────────────────── */
.med-checkout-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  align-items: start;
}
@media (max-width: 900px) {
  .med-checkout-layout { grid-template-columns: 1fr; }
}
.med-checkout-section {
  margin-bottom: 32px;
}
.med-checkout-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a3c6e;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e8e8e8;
}
.med-form-row--2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .med-form-row--2col { grid-template-columns: 1fr; }
}
.med-form-field {
  margin-bottom: 16px;
}
.med-form-field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}
.med-form-field input,
.med-form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #333;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.med-form-field input:focus,
.med-form-field textarea:focus {
  outline: none;
  border-color: #1a3c6e;
  box-shadow: 0 0 0 3px rgba(26,60,110,0.1);
}
.req { color: #c0392b; }

.med-checkout-section--notice {
  background: #fff8e1;
  border-left: 4px solid #ffc107;
  padding: 14px 16px;
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
  color: #5d4037;
}

.med-payment-notice {
  background: #f0f4ff;
  border: 1px solid #c5d5f0;
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 0.9rem;
  color: #1a3c6e;
}
.med-payment-notice p { margin: 4px 0; }

/* ── Checkout Summary ───────────────────────────────── */
.med-checkout-summary {
  background: #f8f9fb;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 24px;
}
.med-checkout-summary h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a3c6e;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}
.med-checkout-items { margin-bottom: 16px; }
.med-checkout-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid #f0f0f0;
  gap: 12px;
}
.med-checkout-item-name { color: #333; flex: 1; }
.med-checkout-item-qty  { color: #999; font-size: 0.82rem; }
.med-checkout-item-price { white-space: nowrap; font-weight: 600; color: #1a3c6e; }

.med-checkout-totals { margin-top: 12px; }
.med-edit-cart-link {
  display: block;
  text-align: center;
  font-size: 0.85rem;
  color: #1a3c6e;
  margin-top: 14px;
  text-decoration: underline;
}

/* ── Alert box ──────────────────────────────────────── */
.med-alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}
.med-alert--error {
  background: #fee;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

/* ── Order Confirmed ────────────────────────────────── */
.med-order-confirmed { max-width: 760px; margin: 0 auto; }

.med-order-success-banner {
  background: linear-gradient(135deg, #1a3c6e 0%, #005eb8 100%);
  color: #fff;
  text-align: center;
  padding: 40px 32px;
  border-radius: 12px;
  margin-bottom: 32px;
}
.med-order-success-icon { font-size: 48px; margin-bottom: 12px; }
.med-order-success-banner h2 { font-size: 1.6rem; margin-bottom: 8px; }
.med-order-success-banner p  { opacity: 0.9; margin: 6px 0; }
.med-order-ref   { font-size: 1.05rem; font-weight: 700; margin-top: 16px !important; }
.med-order-email-note { font-size: 0.88rem; opacity: 0.8 !important; }

.med-order-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}
@media (max-width: 600px) {
  .med-order-details { grid-template-columns: 1fr; }
}

.med-order-section {
  background: #f8f9fb;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
}
.med-order-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1a3c6e;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}
.med-order-items-table {
  width: 100%;
  font-size: 0.88rem;
  border-collapse: collapse;
}
.med-order-items-table th,
.med-order-items-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}
.med-order-items-table thead th { font-weight: 700; color: #555; }
.med-order-items-table tfoot td { padding-top: 8px; font-size: 0.85rem; color: #666; }
.med-order-total-row td { font-size: 0.95rem !important; color: #1a3c6e !important; }

.med-order-next-steps {
  background: #e8f0ff;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
}
.med-order-next-steps h3 { color: #1a3c6e; margin-bottom: 12px; }
.med-order-next-steps ol { padding-left: 20px; }
.med-order-next-steps li { margin-bottom: 6px; color: #444; font-size: 0.95rem; }
.med-order-next-steps p  { margin-top: 14px; font-size: 0.9rem; color: #555; }
