/* ============================================================================
   qo-premium.css
   Polished /pedido-rapido/ page (quick order by SKU or free text).
   ============================================================================ */

/* --- Layout: main table + sidebar with breathing ---------------------- */
.qo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: flex-start;
  margin-top: 8px;
}
@media (max-width: 900px) {
  .qo-layout { grid-template-columns: 1fr; }
}

/* --- Mode tabs: refined pill toggle ---------------------------------- */
.qo-modes {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 16px;
}
.qo-mode-btn {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.qo-mode-btn:hover { color: #0f172a; }
.qo-mode-btn.is-active,
.qo-mode-btn[aria-selected="true"] {
  background: #ffffff;
  color: var(--primary, #2563eb);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* --- Mode panel card -------------------------------------------------- */
.qo-mode-panel {
  background: #ffffff;
  border: 1px solid #eef2f6;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

/* --- Hint row (Si conoces los SKU...) --------------------------------- */
.qo-mode-panel > p:first-child,
.qo-mode-panel > p[class*="hint"] {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.5;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #eef2f6;
  border-radius: 8px;
}

/* --- SKU table: clean scannable rows ---------------------------------- */
.qo-sku-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  margin: 0 0 14px;
}
.qo-sku-table thead th {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #475569;
  text-align: left;
  padding: 0 10px 6px;
  border: 0;
  background: transparent;
}
.qo-sku-table thead th:last-child { text-align: right; }

.qo-sku-table tbody tr {
  background: #f8fafc;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.qo-sku-table tbody tr:hover {
  background: #ffffff;
  box-shadow: 0 2px 6px -1px rgba(15, 23, 42, 0.06);
}
.qo-sku-table tbody td {
  padding: 10px;
  vertical-align: middle;
  border: 0;
  background: transparent;
}
.qo-sku-table tbody tr td:first-child {
  border-radius: 10px 0 0 10px;
}
.qo-sku-table tbody tr td:last-child {
  border-radius: 0 10px 10px 0;
}

/* SKU input */
.qo-sku-input,
.qo-sku-table input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px solid transparent;
  background: #ffffff;
  border-radius: 8px;
  font-family: ui-monospace, SF Mono, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: 0.2px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.qo-sku-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Qty input */
.qo-qty-input,
.qo-sku-table input[type="number"] {
  width: 72px;
  box-sizing: border-box;
  padding: 10px 10px;
  border: 1.5px solid transparent;
  background: #ffffff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
  -moz-appearance: textfield;
}
.qo-qty-input::-webkit-outer-spin-button,
.qo-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qo-qty-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Product name column (resolved product once SKU valid) */
.qo-col-name {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}

/* Remove row button */
.qo-sku-remove-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.qo-sku-remove-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.22);
}

/* Subtotal column value */
.qo-sku-table .qo-col-subtotal,
.qo-sku-table td[class*="subtotal"] {
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Stepper buttons (−/+) between qty and remove */
.qo-sku-table .qo-qty-step-btn,
.qo-sku-table button[class*="step"] {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.qo-sku-table .qo-qty-step-btn:hover {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #ffffff;
}

/* --- Bottom action row: Añadir fila + Validar ------------------------- */
.qo-sku-add-row,
.qo-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}
.qo-mode-panel .btn.btn--accent {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border: none;
  color: #ffffff;
  padding: 11px 22px;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 4px 12px -3px rgba(16, 185, 129, 0.4);
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.qo-mode-panel .btn.btn--accent:hover {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 8px 18px -3px rgba(16, 185, 129, 0.45);
}
.qo-mode-panel .btn.btn--ghost {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  color: #475569;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 16px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.qo-mode-panel .btn.btn--ghost:hover {
  background: rgba(37, 99, 235, 0.04);
  border-color: var(--primary, #2563eb);
  border-style: solid;
  color: var(--primary, #2563eb);
}

/* --- Running total floating card ------------------------------------ */
.qo-running-total {
  position: sticky;
  bottom: 16px;
  margin-top: 16px;
}
.qo-running-total__inner {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #f1f5f9;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  gap: 16px;
}
.qo-running-total__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25);
  animation: qo-dot-pulse 1.4s ease-in-out infinite;
}
@keyframes qo-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25); }
  50%      { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.12); }
}
.qo-running-total__stats {
  display: flex;
  gap: 22px;
  flex: 1;
  min-width: 0;
}
.qo-running-total__items,
.qo-running-total__sub,
.qo-running-total__iva,
.qo-running-total__total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  color: rgba(241, 245, 249, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.qo-running-total__items strong,
.qo-running-total__sub strong,
.qo-running-total__iva strong,
.qo-running-total__total strong {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  text-transform: none;
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
}
.qo-running-total__total strong {
  font-size: 20px;
  color: #34d399;
}

/* --- Sidebar: Cómo funciona + Ejemplo -------------------------------- */
.qo-tips {
  background: #ffffff;
  border: 1px solid #eef2f6;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  position: sticky;
  top: 24px;
}
.qo-tips__title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #334155;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.qo-tips__list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: qotips;
}
.qo-tips__list li {
  position: relative;
  padding: 4px 0 4px 36px;
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
  counter-increment: qotips;
}
.qo-tips__list li::before {
  content: counter(qotips);
  position: absolute;
  left: 0;
  top: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary, #2563eb);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Example code block */
.qo-tips__example {
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 10px;
  padding: 14px 16px;
  font-family: ui-monospace, SF Mono, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  border: 1px solid #1e293b;
  margin-top: 4px;
}
.qo-tips__example::before {
  content: "EJEMPLO";
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
  font-family: inherit;
}

/* --- Textarea free-text mode ----------------------------------------- */
.qo-mode-panel textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 180px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-family: ui-monospace, SF Mono, Menlo, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  color: #0f172a;
  resize: vertical;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.qo-mode-panel textarea:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
