/**
 * SDM - Bodegas Avanzadas (sdm_warehousestock) - estilos front
 *
 * @author    SEO DIGITAL MEDIA SAS
 * @copyright 2026 SEO DIGITAL MEDIA SAS. Todos los derechos reservados.
 * @license   Licencia propietaria SEO DIGITAL MEDIA SAS - ver archivo LICENSE
 */
.sdm-wh {
  --sdm-wh-accent: #005a8f;
  --sdm-wh-accent-soft: rgba(0, 90, 143, .08);
  --sdm-wh-border: #d9dee3;
  --sdm-wh-muted: #6b7480;
  --sdm-wh-ok: #1e7e45;
  --sdm-wh-low: #b26a00;
  --sdm-wh-out: #a3313a;
  display: block;
  clear: both;
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 100%;
  align-self: stretch;
  grid-column: 1 / -1;
  margin: 1rem 0 !important;
  padding: 0;
  float: none;
  text-align: left !important;
  box-sizing: border-box;
}
.sdm-wh__title, .sdm-wh__list, .sdm-wh__notice, .sdm-wh__feedback { text-align: left; }
.sdm-wh__qty { font-size: .9rem; font-weight: 600; color: #232323; }
.sdm-wh__qty.is-out { color: var(--sdm-wh-out); }
.sdm-wh__price { font-size: .9rem; color: #232323; }
.sdm-wh__price strong { font-size: 1rem; }
.sdm-wh__price-note { color: var(--sdm-wh-accent); font-size: .75rem; }
.sdm-wh *, .sdm-wh *::before, .sdm-wh *::after { box-sizing: border-box; }
.sdm-wh__title { font-weight: 700; margin: 0 0 .5rem; font-size: 1rem; }

.sdm-wh__list {
  display: grid;
  justify-content: start;
  justify-items: stretch;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .6rem;
}
.sdm-wh__card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin: 0;
  padding: .75rem .85rem;
  border: 1px solid var(--sdm-wh-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  width: auto;
}
.sdm-wh__body, .sdm-wh__body * { text-align: left; }
.sdm-wh__card:hover { border-color: var(--sdm-wh-accent); }
.sdm-wh__card.is-selected {
  border-color: var(--sdm-wh-accent);
  background: var(--sdm-wh-accent-soft);
  box-shadow: 0 0 0 1px var(--sdm-wh-accent) inset;
}
.sdm-wh__card.is-disabled { opacity: .55; cursor: not-allowed; }
.sdm-wh__radio { margin-top: .2rem; flex: 0 0 auto; accent-color: var(--sdm-wh-accent); }
.sdm-wh__radio:focus-visible { outline: 2px solid var(--sdm-wh-accent); outline-offset: 2px; }
.sdm-wh__body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1 1 auto; }
.sdm-wh__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem; }
.sdm-wh__name { font-weight: 700; color: #232323; overflow-wrap: anywhere; }
.sdm-wh__city, .sdm-wh__date { color: var(--sdm-wh-muted); font-size: .85rem; }
.sdm-wh__delivery { font-size: .9rem; }
.sdm-wh__badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--sdm-wh-ok);
  background: rgba(30, 126, 69, .1);
  white-space: nowrap;
}
.sdm-wh__badge--low { color: var(--sdm-wh-low); background: rgba(178, 106, 0, .12); }
.sdm-wh__badge--out { color: var(--sdm-wh-out); background: rgba(163, 49, 58, .1); }
.sdm-wh__select-wrap { max-width: 100%; }
.sdm-wh__select { width: 100%; max-width: 100%; }
.sdm-wh__notice {
  margin: .5rem 0 0;
  padding: .5rem .7rem;
  border-left: 3px solid var(--sdm-wh-low);
  background: rgba(178, 106, 0, .08);
  font-size: .85rem;
}
.sdm-wh__notice[hidden] { display: none; }
.sdm-wh__notice-title { margin: 0 0 .25rem; font-weight: 600; }
.sdm-wh__plan { margin: 0; padding-left: 1.1rem; }
.sdm-wh__plan li { margin: .1rem 0; }
.sdm-wh__plan li.is-backorder { color: var(--sdm-wh-low); }
.sdm-wh__feedback { margin: .35rem 0 0; font-size: .85rem; color: var(--sdm-wh-ok); min-height: 0; }
.sdm-wh__feedback:empty { display: none; }

/* Botón "Ver detalle" */
.sdm-wh__detail-src[hidden] { display: none !important; }
.sdm-wh__detail-btn {
  display: inline-flex; align-items: center; gap: .3rem; align-self: flex-start;
  margin-top: .35rem; padding: .2rem .55rem; border: 1px solid var(--sdm-wh-accent);
  border-radius: 999px; background: #fff; color: var(--sdm-wh-accent);
  font-size: .78rem; font-weight: 600; line-height: 1.3; cursor: pointer;
}
.sdm-wh__detail-btn:hover, .sdm-wh__detail-btn:focus-visible { background: var(--sdm-wh-accent); color: #fff; outline: none; }

/* Popup de detalle: estilos en SDM_embed.css (se cargan en todas las páginas). */

/* Carrito: estilos de la bodega por línea en SDM_embed.css (también se usan en la ventana «Producto añadido»). */

/* Checkout: resumen por bodega */
.sdm-wh-co-data[hidden] { display: none !important; }
.sdm-wh-co-placed { max-width: 100%; }
.sdm-wh-co-block {
  margin: .75rem 0; padding: .7rem .8rem; border-radius: 8px;
  background: rgba(0, 90, 143, .06); border: 1px solid rgba(0, 90, 143, .15);
  font-size: .85rem; line-height: 1.4; text-align: left;
}
.sdm-wh-co-block__title { display: flex; align-items: center; gap: .35rem; margin: 0 0 .5rem; font-weight: 700; color: #003a5c; }
.sdm-wh-co-block__title svg { color: #005a8f; }
.sdm-wh-co-block__group { --sdm-wh-c: #005a8f; padding: .45rem 0 .45rem .6rem; border-left: 4px solid var(--sdm-wh-c); margin-bottom: .45rem; background: #fff; border-radius: 0 6px 6px 0; }
.sdm-wh-co-block__group.is-backorder { --sdm-wh-c: #b26a00; }
.sdm-wh-co-block__group:last-child { margin-bottom: 0; }
.sdm-wh-co-block__head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding-right: .6rem; }
.sdm-wh-co-block__units { white-space: nowrap; font-weight: 700; color: #fff; background: var(--sdm-wh-c); padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; }
.sdm-wh-co-block__delivery { color: #5b6570; font-size: .8rem; padding-right: .6rem; }
.sdm-wh-co-block__items { list-style: none; margin: .25rem 0 0; padding: 0 .6rem 0 0; font-size: .8rem; color: #3b434b; }
.sdm-wh-co-block__items li { display: flex; justify-content: space-between; gap: .5rem; }
.sdm-wh-co-block__x { white-space: nowrap; font-weight: 600; }

/* Detalle de pedido (cuenta del cliente) */
.sdm-wh-order__title { font-size: 1.1rem; margin-bottom: .75rem; }
.sdm-wh-order__table { width: 100%; overflow-x: auto; }

@media (max-width: 575px) {
  .sdm-wh__list { grid-template-columns: 1fr; }
  .sdm-wh__card { padding: .7rem; }
  .sdm-wh-order table thead { display: none; }
  .sdm-wh-order table, .sdm-wh-order tbody, .sdm-wh-order tr, .sdm-wh-order td { display: block; width: 100%; }
  .sdm-wh-order tr { border-bottom: 1px solid #e5e5e5; padding: .4rem 0; }
  .sdm-wh-order td { border: 0 !important; padding: .2rem .5rem !important; }
  .sdm-wh-order td::before { content: attr(data-label) ": "; font-weight: 600; }
}

/* Selector en vista compacta: una línea por bodega */
html .sdm-wh--compact .sdm-wh__list { grid-template-columns: 1fr; gap: .4rem; }
html .sdm-wh--compact .sdm-wh__card { align-items: center; padding: .5rem .75rem; }
html .sdm-wh--compact .sdm-wh__radio { margin-top: 0; }
html .sdm-wh--compact .sdm-wh__body { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .2rem .9rem; }
html .sdm-wh--compact .sdm-wh__head { flex: 0 0 auto; justify-content: flex-start; gap: .4rem; }
html .sdm-wh--compact .sdm-wh__qty, html .sdm-wh--compact .sdm-wh__delivery, html .sdm-wh--compact .sdm-wh__price, html .sdm-wh--compact .sdm-wh__city { font-size: .85rem; white-space: nowrap; }
html .sdm-wh--compact .sdm-wh__date { display: none; }
html .sdm-wh--compact .sdm-wh__detail-btn { margin: 0 0 0 auto; }
@media (max-width: 575px) {
  html .sdm-wh--compact .sdm-wh__qty, html .sdm-wh--compact .sdm-wh__delivery, html .sdm-wh--compact .sdm-wh__price { white-space: normal; }
  html .sdm-wh--compact .sdm-wh__detail-btn { margin-left: 0; }
}

/* Color propio de la bodega */
html .sdm-wh .sdm-wh__card.has-color { border-left: 4px solid var(--sdm-wh-accent); }
