/* Pedido del visitante: botón del encabezado, control en la ficha y panel lateral */

/* ---------- Botón del encabezado ---------- */
.order-open-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--theme-header-text, currentColor);
  cursor: pointer;
}

.order-count {
  position: absolute;
  top: 0;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  box-sizing: border-box;
  background: var(--theme-primary-color, #0000FF);
  color: var(--theme-primary-text, #FFFFFF);
  font-size: 11px;
  font-weight: 500;
  line-height: 18px;
  text-align: center;
}

.order-count[hidden] {
  display: none;
}

/* ---------- Control en la ficha del producto ---------- */
.order-control {
  margin-bottom: 16px;
  min-height: 64px;
}

.order-add-btn {
  min-width: 240px;
  border-radius: 6px;
}

.order-control-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.order-control-info {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 300;
  cursor: pointer;
  text-align: left;
}

.order-control-info:hover {
  text-decoration: underline;
}

.order-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 182px;
  height: 64px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 2px;
  box-sizing: border-box;
}

.order-stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.order-stepper-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.order-stepper-value {
  min-width: 32px;
  text-align: center;
  font-weight: 300;
}

.order-icon {
  display: inline-flex;
}

.product-detail .contact-secondary {
  margin-bottom: 16px;
}

.link-contact-whatsapp {
  font-weight: 300;
  text-decoration: underline;
}

/* ---------- Panel lateral ---------- */
.order-drawer {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.order-drawer[hidden] {
  display: none;
}

.order-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.order-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 600px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 24px 28px;
  background: #ffffff;
  color: #000000;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.order-drawer.is-open .order-drawer-backdrop {
  opacity: 1;
}

.order-drawer.is-open .order-drawer-panel {
  transform: translateX(0);
}

.order-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}

.order-drawer-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
}

.order-drawer-close {
  display: inline-flex;
  padding: 4px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.order-drawer-body {
  flex: 1;
  overflow-y: auto;
}

.order-drawer-label {
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 15px;
}

.order-drawer-empty {
  padding: 32px 0;
  font-weight: 300;
  text-align: center;
}

.order-drawer-empty[hidden],
.order-drawer-total[hidden],
.order-drawer-footer[hidden] {
  display: none;
}

.order-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.order-line {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 22px 0 0;
}

.order-line-image img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: cover;
}

.order-line-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15px;
  font-weight: 300;
  line-height: 20px;
}

.order-line-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-top: 12px;
  font-size: 15px;
  font-weight: 300;
}

.order-line-price small {
  font-size: inherit;
  opacity: 0.55;
}

.order-line .order-stepper {
  height: 60px;
}

.order-drawer-total {
  display: flex;
  justify-content: flex-end;
  gap: 52px;
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 16px;
}

.order-drawer-total span,
.order-drawer-total strong {
  font-weight: 500;
}

.order-drawer-footer {
  display: flex;
  justify-content: center;
  padding-top: 24px;
}

.order-checkout-btn {
  min-width: 240px;
  border-radius: 6px;
}

@media (max-width: 640px) {
  .order-drawer-panel {
    padding: 20px 16px;
  }

  .order-line {
    grid-template-columns: 48px 1fr;
  }

  .order-line .order-stepper {
    grid-column: 2;
    height: 48px;
    width: 160px;
  }

  .order-add-btn,
  .order-checkout-btn {
    width: 100%;
  }
}

.order-drawer-notice {
  margin: 20px 0 0;
  padding: 14px 16px;
  border-radius: 6px;
  background: #E8F7EE;
  color: #14532D;
  font-weight: 300;
  line-height: 1.4;
}

.order-drawer-notice.is-error {
  background: #FDECEC;
  color: #7F1D1D;
}

.order-drawer-notice[hidden] {
  display: none;
}

.order-checkout-btn:disabled {
  opacity: 0.7;
  cursor: progress;
}
