/* ==========================================================================
   Ndombele Medical — Loja Online
   Estilos com prefixo/âmbito .scm- para evitar conflitos dentro do Elementor
   ========================================================================== */

.scm-store {
  --scm-primary: #C8102E;
  --scm-primary-dark: #8E0B20;
  --scm-primary-light: #FCEBEC;
  --scm-accent: #111111;
  --scm-accent-dark: #000000;
  --scm-bg: #F7F7F7;
  --scm-card: #ffffff;
  --scm-text: #1a1a1a;
  --scm-text-muted: #6b6b6b;
  --scm-border: #e5e5e5;
  --scm-success: #2f9e5b;
  --scm-radius: 12px;
  --scm-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  --scm-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.14);

  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  color: var(--scm-text);
  background: var(--scm-bg);
  box-sizing: border-box;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.scm-store *,
.scm-store *::before,
.scm-store *::after {
  box-sizing: inherit;
}

.scm-store img { max-width: 100%; display: block; }
.scm-store button { font-family: inherit; cursor: pointer; }
.scm-store a { color: inherit; }

.scm-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.scm-header {
  background: linear-gradient(135deg, var(--scm-primary) 0%, var(--scm-primary-dark) 100%);
  color: #fff;
  padding: 16px 0 18px;
  position: relative;
}

.scm-header__search-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding-bottom: 10px;
}

.scm-header__controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.scm-cat-dropdown {
  flex: 0 0 auto;
  padding-bottom: 10px;
}

.scm-cat-select,
.scm-cat-dropdown select {
  padding: 11px 16px;
  border-radius: 20px;
  border: none;
  background: #fff;
  color: var(--scm-text);
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
  min-width: 220px;
  max-width: 100%;
}

.scm-search {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.scm-search input {
  width: 100%;
  padding: 13px 46px 13px 18px;
  border-radius: 20px;
  border: none;
  font-size: 14.5px;
  outline: none;
  background: #fff;
  color: var(--scm-text);
}

.scm-search__icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--scm-text-muted);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.scm-cart-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  transition: background .2s ease;
  white-space: nowrap;
}
.scm-cart-btn:hover { background: rgba(255,255,255,0.26); }

.scm-cart-count {
  background: var(--scm-accent);
  color: #fff;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Toolbar: resultados / ordenação ---------- */
.scm-toolbar {
  padding: 18px 0 6px;
}

.scm-toolbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.scm-results-count {
  font-size: 13.5px;
  color: var(--scm-text-muted);
}

.scm-sort select,
.scm-per-page select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--scm-border);
  background: #fff;
  font-size: 13.5px;
  color: var(--scm-text);
}

/* ---------- Grid de produtos ---------- */
.scm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding: 6px 0 28px;
}

.scm-card {
  background: var(--scm-card);
  border-radius: var(--scm-radius);
  border: 1px solid var(--scm-border);
  overflow: hidden;
  box-shadow: var(--scm-shadow);
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
  cursor: pointer;
}

.scm-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--scm-shadow-hover);
}

.scm-card__img-wrap {
  aspect-ratio: 1 / 1;
  background: var(--scm-primary-light);
  overflow: hidden;
  position: relative;
}

.scm-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}

.scm-card__cat {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15,110,124,0.9);
  color: #fff;
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 999px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scm-card__body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.scm-card__brand {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--scm-text-muted);
  font-weight: 600;
}

.scm-card__name {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  min-height: 39px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scm-card__price {
  margin-top: auto;
  font-size: 16px;
  font-weight: 700;
  color: var(--scm-primary-dark);
}

.scm-card__price.is-muted {
  font-size: 13px;
  font-weight: 600;
  color: var(--scm-text-muted);
}

.scm-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.scm-btn {
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}

.scm-btn--primary {
  background: var(--scm-primary);
  color: #fff;
  flex: 1;
}
.scm-btn--primary:hover { background: var(--scm-primary-dark); }

.scm-btn--ghost {
  background: var(--scm-primary-light);
  color: var(--scm-primary-dark);
}
.scm-btn--ghost:hover { background: #d9ecec; }

.scm-btn--accent {
  background: var(--scm-accent);
  color: #fff;
}
.scm-btn--accent:hover { background: var(--scm-accent-dark); color: #fff; }

.scm-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--scm-text-muted);
}

/* ---------- Paginação ---------- */
.scm-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 40px;
  flex-wrap: wrap;
}

.scm-page-btn {
  border: 1px solid var(--scm-border);
  background: #fff;
  color: var(--scm-text);
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
}

.scm-page-btn:hover { border-color: var(--scm-primary); color: var(--scm-primary); }

.scm-page-btn.is-active {
  background: var(--scm-primary);
  border-color: var(--scm-primary);
  color: #fff;
}

.scm-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.scm-page-dots { color: var(--scm-text-muted); padding: 0 4px; }

/* ---------- Modal de detalhes ---------- */
.scm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 32, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 99999;
}

.scm-modal-overlay.is-open { display: flex; }

.scm-modal {
  background: #fff;
  border-radius: 16px;
  max-width: 880px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px) {
  .scm-modal { grid-template-columns: 1fr; }
}

.scm-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #fff;
  border: 1px solid var(--scm-border);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  z-index: 2;
}

.scm-modal__gallery {
  background: var(--scm-primary-light);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scm-modal__main-img {
  aspect-ratio: 1/1;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scm-modal__main-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
}

.scm-modal__thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scm-modal__thumbs img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  border: 2px solid transparent;
  padding: 4px;
}
.scm-modal__thumbs img.is-active { border-color: var(--scm-primary); }

.scm-modal__info {
  padding: 26px 26px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scm-modal__cat {
  align-self: flex-start;
  background: var(--scm-primary-light);
  color: var(--scm-primary-dark);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.scm-modal__title {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
}

.scm-modal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13px;
  color: var(--scm-text-muted);
}

.scm-modal__meta b { color: var(--scm-text); font-weight: 600; }

.scm-modal__price {
  font-size: 24px;
  font-weight: 800;
  color: var(--scm-primary-dark);
}

.scm-modal__desc {
  font-size: 13.5px;
  color: var(--scm-text);
  white-space: pre-line;
  border-top: 1px solid var(--scm-border);
  padding-top: 12px;
  max-height: 220px;
  overflow-y: auto;
}

.scm-modal__qty {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scm-qty-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--scm-border);
  border-radius: 8px;
  overflow: hidden;
}

.scm-qty-control button {
  background: var(--scm-primary-light);
  border: none;
  width: 32px;
  height: 32px;
  font-size: 16px;
  color: var(--scm-primary-dark);
}

.scm-qty-control input {
  width: 42px;
  text-align: center;
  border: none;
  font-size: 14px;
  height: 32px;
}

.scm-modal__actions { display: flex; gap: 10px; margin-top: 6px; }

/* ---------- Carrinho (drawer) ---------- */
.scm-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,30,32,0.5);
  display: none;
  z-index: 99998;
}
.scm-cart-overlay.is-open { display: block; }

.scm-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 100%;
  max-width: 400px;
  background: #fff;
  z-index: 99999;
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
}
.scm-cart-drawer.is-open { transform: translateX(0); }

.scm-cart-drawer__header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--scm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scm-cart-drawer__header h3 { margin: 0; font-size: 17px; }

.scm-cart-drawer__close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--scm-text-muted);
}

.scm-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scm-cart-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: center;
}

.scm-cart-item img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: var(--scm-primary-light);
  border-radius: 8px;
  padding: 4px;
}

.scm-cart-item__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.scm-cart-item__price { font-size: 12.5px; color: var(--scm-text-muted); }

.scm-cart-item__qty {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.scm-cart-item__qty button {
  width: 22px; height: 22px;
  border-radius: 5px;
  border: 1px solid var(--scm-border);
  background: #fff;
  font-size: 13px;
  line-height: 1;
}

.scm-cart-item__remove {
  background: none;
  border: none;
  color: #c0392b;
  font-size: 12px;
  text-decoration: underline;
  justify-self: end;
}

.scm-cart-drawer__footer {
  border-top: 1px solid var(--scm-border);
  padding: 16px 20px 20px;
}

.scm-cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.scm-cart-empty {
  text-align: center;
  color: var(--scm-text-muted);
  padding: 40px 10px;
  font-size: 14px;
}

/* ---------- Toast ---------- */
.scm-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--scm-primary-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 100000;
}
.scm-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Skeleton / lazy ---------- */
.scm-card__img-wrap img.scm-lazy {
  opacity: 0;
  transition: opacity .25s ease;
}
.scm-card__img-wrap img.scm-loaded {
  opacity: 1;
}

/* ---------- Responsivo ---------- */

/* Tablet */
@media (max-width: 900px) {
  .scm-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .scm-cat-select, .scm-cat-dropdown select { min-width: 180px; }
  .scm-search { max-width: none; }
}

/* Mobile */
@media (max-width: 600px) {
  .scm-header__controls-row { flex-direction: column; align-items: stretch; }
  .scm-cat-dropdown, .scm-search { max-width: none; width: 100%; }
  .scm-cat-select, .scm-cat-dropdown select { width: 100%; }
  .scm-cart-btn { width: 100%; justify-content: center; padding: 10px 12px; font-size: 13px; }

  .scm-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .scm-card__name { font-size: 13px; min-height: 34px; }
  .scm-modal__title { font-size: 18px; }

  .scm-card__actions { flex-direction: column; }
  .scm-btn--ghost, .scm-btn--primary { width: 100%; }

  .scm-toolbar__row { flex-direction: column; align-items: flex-start; }
}

/* Ecrãs muito pequenos */
@media (max-width: 360px) {
  .scm-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 10px; }
  .scm-card__body { padding: 10px 10px 12px; }
}

/* ---------- Popup de Checkout ---------- */
.scm-checkout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 32, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100001;
}
.scm-checkout-overlay.is-open { display: flex; }

.scm-checkout-modal {
  background: #fff;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 28px 26px 26px;
}

.scm-checkout-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--scm-bg);
  border: 1px solid var(--scm-border);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}

.scm-checkout-modal h3 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
}

.scm-checkout-sub {
  font-size: 13px;
  color: var(--scm-text-muted);
  margin: 0 0 16px;
}

.scm-checkout-summary {
  border: 1px solid var(--scm-border);
  border-radius: 10px;
  padding: 10px 12px;
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scm-checkout-summary__item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}
.scm-checkout-summary__item span:first-child { color: var(--scm-text); }
.scm-checkout-summary__item span:last-child { color: var(--scm-text-muted); white-space: nowrap; }

.scm-checkout-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 2px 18px;
  border-bottom: 1px solid var(--scm-border);
  margin-bottom: 16px;
}

.scm-checkout-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scm-checkout-form label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--scm-text);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.scm-checkout-form input,
.scm-checkout-form select,
.scm-checkout-form textarea {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 400;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--scm-border);
  color: var(--scm-text);
  resize: vertical;
  outline: none;
}
.scm-checkout-form input:focus,
.scm-checkout-form select:focus,
.scm-checkout-form textarea:focus {
  border-color: var(--scm-primary);
}

.scm-checkout-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.scm-checkout-actions .scm-btn { flex: 1; }

.scm-checkout-step[data-step="success"] {
  text-align: center;
  padding: 10px 4px 4px;
}

.scm-checkout-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--scm-primary-light);
  color: var(--scm-success);
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.scm-checkout-step[data-step="success"] .scm-btn {
  width: 100%;
  margin-top: 10px;
}
