/**
 * TouchCart Side Cart — Styles for the slide-out cart panel.
 * Part of the TouchCart Search Plus plugin.
 *
 * Accent colours are injected via CSS custom properties on #tcSideCart
 * by initTouchCartSearch(). Fallbacks: white header, black text.
 */

/* ── Side cart shim & CSS variables ────────────────────── */
/* Fully self-contained — no Bootstrap modal classes or JS.
   Visibility toggles via .show class (classList.add/remove). */
#tcSideCart {
  --tc-sc-accent: #000;
  --tc-sc-accent-text: #fff;
  position: fixed;
  inset: 0;
  z-index: 10000002;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s 0.3s;
}
#tcSideCart.show {
  visibility: visible;
  pointer-events: auto;
  transition: visibility 0s 0s;
}

/* Suppress Neto's native "item added to cart" popup while side cart is open */
#tcSideCart.show ~ .npopup,
#tcSideCart.show ~ .anpopup {
  display: none !important;
}

/* Fallback X close button for Neto's .npopup (in case the sprite image is missing).
   Uses a CSS-drawn × so the close button is always visible. */
.npopup-btn-close {
  background: #000 !important;
  border: 2px solid #fff !important;
  border-radius: 50% !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.npopup-btn-close::before {
  content: "\00d7";
  font-size: 22px;
  line-height: 1;
  color: #fff;
  font-family: Arial, sans-serif;
  font-weight: 400;
}

/* ── Backdrop ─────────────────────────────────────────── */
#tcSideCart .tc-sc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}
#tcSideCart.show .tc-sc-backdrop {
  opacity: 1;
}

/* ── Fullscreen modal at small breakpoints ────────────── */
@media (max-width: 575.98px) {
  .tc-sidecart-fullscreen {
    padding: 0 !important;
  }
  .tc-sidecart-fullscreen .tc-sidecart-dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
  }
  .tc-sidecart-fullscreen .tc-sidecart-content {
    height: 100%;
    border: 0;
    border-radius: 0;
  }
}

/* ── Slide-in from right ──────────────────────────────── */
.tc-sidecart-pane-right .tc-sidecart-dialog {
  max-width: 380px;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  transform: translate(100%, 0);
  margin: 0 0 0 auto;
  transition: transform 0.3s ease;
}

.tc-sidecart-pane-right.show .tc-sidecart-dialog {
  transform: translate(0, 0);
}

.tc-sidecart-pane-right .tc-sidecart-content {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  max-height: 100vh;
  max-height: -webkit-fill-available;
}

/* ── Content layout ───────────────────────────────────── */
.tc-sidecart-content {
  display: flex;
  flex-direction: column;
  background: #fff;
  position: relative;
}

/* ── Header ───────────────────────────────────────────── */
.tc-sidecart-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  background: var(--tc-sc-accent);
  color: var(--tc-sc-accent-text);
  position: relative;
}

.tc-sidecart-heading {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tc-sidecart-close-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--tc-sc-accent-text);
  display: flex;
  align-items: center;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.tc-sidecart-close-btn:hover {
  opacity: 1;
}

/* Badge — hidden in header, used for Neto badge sync only */
.tc-sidecart-badge {
  position: absolute;
  top: -999px;
  left: -999px;
  font-size: 0;
  pointer-events: none;
}

/* ── Body ─────────────────────────────────────────────── */
.tc-sidecart-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

/* ── Footer ───────────────────────────────────────────── */
.tc-sidecart-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
}

/* ── Checkout button ──────────────────────────────────── */
.tc-sidecart-checkout-btn {
  background: var(--tc-sc-checkout-bg, var(--tc-sc-accent));
  color: var(--tc-sc-checkout-text, var(--tc-sc-accent-text));
  border: 1px solid var(--tc-sc-checkout-border, var(--tc-sc-checkout-bg, var(--tc-sc-accent)));
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15px;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  cursor: pointer;
  transition:
    background 0.15s,
    opacity 0.15s;
  line-height: 1;
}
.tc-sidecart-checkout-btn svg {
  color: inherit;
  fill: currentColor;
}
.tc-sidecart-checkout-btn:hover {
  background: var(--tc-sc-checkout-bg-hover, var(--tc-sc-checkout-bg, var(--tc-sc-accent)));
  color: var(--tc-sc-checkout-text, var(--tc-sc-accent-text));
  opacity: 0.95;
}

/* ── Quote button ─────────────────────────────────────── */
.tc-sidecart-quote-btn {
  background: var(--tc-sc-quote-bg, #666);
  color: var(--tc-sc-quote-text, #000);
  border: 1px solid var(--tc-sc-quote-border, var(--tc-sc-quote-bg, #666));
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15px;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  cursor: pointer;
  transition:
    background 0.15s,
    opacity 0.15s;
  line-height: 1;
  margin-top: 8px;
}
.tc-sidecart-quote-btn svg {
  color: inherit;
  fill: currentColor;
}
.tc-sidecart-quote-btn:hover {
  background: var(--tc-sc-quote-bg-hover, var(--tc-sc-quote-bg, #555));
  color: var(--tc-sc-quote-text, #000);
  opacity: 0.95;
}

/* ── Loader overlay ───────────────────────────────────── */
.tc-sidecart-loader {
  background-color: rgba(255, 255, 255, 0.6);
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
}

.tc-sidecart-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--tc-sc-accent);
  border-radius: 50%;
  animation: tcSidecartSpin 0.6s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -16px;
  margin-left: -16px;
}

@keyframes tcSidecartSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Messages (error/info) ────────────────────────────── */
.tc-sc-messages-top:empty,
.tc-sc-messages-top:not(:has(.alert, .text-danger, p, span)) {
  display: none;
}
.tc-sc-messages-top {
  padding: 10px 16px;
  font-size: 13px;
  color: #dc3545;
  background: #fff5f5;
  border-bottom: 1px solid #fde8e8;
}

.tc-sc-messages-bottom {
  display: none !important;
}

.tc-sc-coupon-note {
  padding: 8px 16px;
  font-size: 13px;
  color: #28a745;
  border-bottom: 1px solid #e5e7eb;
}

/* ── Item card ────────────────────────────────────────── */
.tc-sc-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.tc-sc-item-img {
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  border-radius: 6px;
  overflow: hidden;
  background: #f9f9f9;
}
.tc-sc-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tc-sc-item-details {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 0;
  column-gap: 6px;
}

/* Brand: grid col 1, row 1 */
.tc-sc-item-brand {
  grid-column: 1;
  grid-row: 1;
}

/* Delete: grid col 2, spans brand + name rows, top-aligned */
.tc-sc-item-delete {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: start;
}

/* Product name: grid col 1, row 2 */
.tc-sc-item-name {
  grid-column: 1;
  grid-row: 2;
}

/* Everything else spans full width */
.tc-sc-item-extra,
.tc-sc-item-badge,
.tc-sc-item-bottom-row {
  grid-column: 1 / -1;
}

.tc-sc-item-brand {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tc-sc-item-delete {
  color: #999;
  padding: 2px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.tc-sc-item-delete:hover {
  color: #dc3545;
}

/* Product name */
.tc-sc-item-name {
  font-size: 13px;
  font-weight: 500;
  color: #222;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}
.tc-sc-item-name:hover {
  color: #000;
  text-decoration: underline;
}

/* Extras / badges */
.tc-sc-item-extra {
  font-size: 11px;
  color: #888;
  margin: 0;
}

.tc-sc-item-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
  margin-top: 2px;
  justify-self: start;
}
.tc-sc-badge-gift {
  background: #d4edda;
  color: #155724;
}
.tc-sc-badge-preorder {
  background: #fff3cd;
  color: #856404;
}

/* Bottom row: price + qty picker */
.tc-sc-item-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 6px;
}

.tc-sc-item-pricing {
  display: flex;
  flex-direction: column;
}

.tc-sc-item-unit-price {
  font-size: 11px;
  color: #555;
}

.tc-sc-item-discount {
  font-size: 11px;
  color: #555;
  font-style: italic;
}

.tc-sc-item-total {
  font-size: 15px;
  font-weight: 600;
  color: #111;
}

/* ── Quantity picker ──────────────────────────────────── */
.tc-sc-qty-picker {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.tc-sc-qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #fff;
  color: #333;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
  border: none;
  padding: 0;
  line-height: 1;
}
.tc-sc-qty-btn:hover {
  background: #f5f5f5;
  text-decoration: none;
  color: #333;
}

.tc-sc-qty-input {
  width: 34px;
  height: 32px;
  text-align: center;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  background: #fff;
  padding: 0;
  -moz-appearance: textfield;
}
.tc-sc-qty-input::-webkit-outer-spin-button,
.tc-sc-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tc-sc-qty-input:focus {
  outline: none;
  box-shadow: none;
}

/* ── Row updating animation ───────────────────────────── */
.tc-row-updating {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Section (coupon / shipping) ──────────────────────── */
.tc-sc-section {
  border-top: 1px solid #e5e7eb;
}

.tc-sc-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: #f7f7f8;
  border: none;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  text-align: left;
}
.tc-sc-collapse-btn:hover {
  background: #f0f0f1;
}
.tc-sc-collapse-btn::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid #666;
  border-bottom: 2px solid #666;
  transform: rotate(45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.tc-sc-collapse-btn:not(.collapsed)::after {
  transform: rotate(-135deg);
}

.tc-sc-collapse-body {
  padding: 12px 16px 14px;
}

/* ── Coupon input row ─────────────────────────────────── */
.tc-sc-coupon-row {
  display: flex;
  gap: 8px;
}
.tc-sc-coupon-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.tc-sc-coupon-input:focus {
  border-color: var(--tc-sc-accent);
}
.tc-sc-coupon-apply-btn {
  padding: 8px 14px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.1s;
}
.tc-sc-coupon-apply-btn:hover {
  background: #eee;
  text-decoration: none;
  color: #333;
}

/* ── Shipping calculator ──────────────────────────────── */
.tc-sc-shipping-calc {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.tc-sc-field-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tc-sc-field-label {
  font-size: 12px;
  font-weight: 500;
  color: #666;
}
.tc-sc-field-select,
.tc-sc-field-input {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #fff;
}
.tc-sc-field-select:focus,
.tc-sc-field-input:focus {
  border-color: var(--tc-sc-accent);
}

.tc-sc-calc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: var(--tc-sc-accent);
  color: var(--tc-sc-accent-text);
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.tc-sc-calc-btn:hover {
  opacity: 0.9;
  text-decoration: none;
  color: var(--tc-sc-accent-text);
}

/* ── Shipping methods ─────────────────────────────────── */
.tc-sc-shipping-methods {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tc-sc-shipping-option {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}
.tc-sc-shipping-option input[type="radio"] {
  margin-top: 2px;
}
.tc-sc-shipping-label {
  font-weight: 500;
  color: #333;
}
.tc-sc-shipping-cost {
  margin-left: auto;
  font-weight: 600;
  color: #222;
}
.tc-sc-shipping-eta {
  width: 100%;
  padding-left: 20px;
  font-size: 11px;
  color: #999;
}

.tc-sc-shipping-desc {
  width: 100%;
  padding-left: 20px;
  font-size: 11px;
  color: #888;
  line-height: 1.35;
}

.tc-sc-shipping-unavail {
  font-size: 12px;
  color: #dc3545;
  margin: 4px 0 0;
}
.tc-sc-shipping-hint {
  font-size: 12px;
  color: #999;
  margin: 4px 0 0;
}

/* ── Totals ───────────────────────────────────────────── */
.tc-sc-totals {
  padding: 14px 16px;
  border-top: 1px solid #e5e7eb;
}

.tc-sc-totals-table {
  width: 100%;
  border-collapse: collapse;
}

.tc-sc-totals-table th,
.tc-sc-totals-table td {
  padding: 3px 0;
  font-size: 14px;
  text-align: left;
}
.tc-sc-totals-table td {
  text-align: right;
}

.tc-sc-totals-small th,
.tc-sc-totals-small td {
  font-size: 12px;
  font-weight: 400;
  color: #666;
}

.tc-sc-totals-grand th,
.tc-sc-totals-grand td {
  padding-top: 8px;
  font-size: 16px;
  font-weight: 700;
  border-top: 1px solid #e5e7eb;
}

.tc-sc-item-count {
  font-size: 12px;
  color: #999;
  margin: 6px 0 0;
}

/* ── Empty cart state ─────────────────────────────────── */
.tc-sc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #aaa;
  gap: 12px;
}
.tc-sc-empty p {
  font-size: 15px;
  margin: 0;
  color: #999;
}

/* ── Mobile input zoom prevention (iOS) ───────────────── */
@media (max-width: 575.98px) {
  .tc-sc-coupon-input,
  .tc-sc-field-input,
  .tc-sc-field-select,
  .tc-sc-qty-input {
    font-size: 16px;
  }
}
