/**
 * Pedidos POS — Estilos del editor.
 * Hereda gran parte del look del gxc-panel.
 * Variables locales encapsuladas para no chocar.
 */

/* === Icono de nav 'receipt' (para que aparezca en la barra) ===
   El resto de iconos viene de frontend.css. Aquí solo añadimos el
   nuevo. */
.gxc-nav__icon--receipt {
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 2v20l3-2 3 2 3-2 3 2 3-2 3 2V2'/%3E%3Cline x1='8' y1='8' x2='16' y2='8'/%3E%3Cline x1='8' y1='12' x2='16' y2='12'/%3E%3Cline x1='8' y1='16' x2='13' y2='16'/%3E%3C/svg%3E");
}

/* === Buscador en el header === */
.ppo-search-input {
	height: 38px;
	padding: 0 14px;
	border: 1px solid #d0d4dc;
	border-radius: 8px;
	font: inherit;
	font-size: 14px;
	min-width: 220px;
	transition: border-color .15s ease;
}
.ppo-search-input:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

/* === Botón extra pequeño (CAMBIAR cliente) === */
.gxc-btn--xs {
	padding: 4px 10px !important;
	font-size: 11px !important;
	min-height: 0 !important;
}

/* === Fila de meta del pedido (cliente / estado / total) === */
.ppo-meta {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	padding: 16px;
	margin-bottom: 16px;
}
.ppo-meta__row {
	display: grid;
	grid-template-columns: 1.5fr 1fr 1fr;
	gap: 18px;
	align-items: end;
}
.ppo-meta__cell {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.ppo-meta__cell > label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: #64748b;
}
.ppo-customer-display {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	background: #fff;
	border: 1px solid #d0d4dc;
	border-radius: 8px;
	min-height: 38px;
}
.ppo-customer-name {
	flex: 1;
	font-weight: 600;
	color: #0f172a;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ppo-total-display {
	font-size: 20px;
	font-weight: 700;
	color: #15803d;
	padding: 6px 12px;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 8px;
	text-align: right;
}

/* === Tabla de items (editables) === */
.ppo-items-table tbody tr {
	transition: background-color .12s ease;
}
.ppo-items-table tbody tr:hover {
	background: #f8fafc;
}
.ppo-items-table input.ppo-qty,
.ppo-items-table input.ppo-price {
	width: 100%;
	height: 32px;
	padding: 0 8px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font: inherit;
	font-size: 13px;
	background: #fff;
	text-align: right;
}
.ppo-items-table input.ppo-qty:focus,
.ppo-items-table input.ppo-price:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}
.ppo-items-table input.ppo-price {
	font-variant-numeric: tabular-nums;
}
.ppo-items-table .ppo-subtotal {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* === Botones de acción por línea === */
.ppo-row-actions {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}
.ppo-row-btn {
	padding: 5px 10px;
	border: 1px solid #d0d4dc;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .3px;
	transition: all .12s ease;
}
.ppo-row-btn:hover {
	background: #f1f5f9;
}
.ppo-row-btn--replace {
	color: #1d4ed8;
	border-color: #93c5fd;
}
.ppo-row-btn--replace:hover {
	background: #dbeafe;
}
.ppo-row-btn--delete {
	color: #b91c1c;
	border-color: #fca5a5;
}
.ppo-row-btn--delete:hover {
	background: #fee2e2;
}

/* === Footer del editor === */
.ppo-edit-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	margin-top: 16px;
	gap: 12px;
	flex-wrap: wrap;
}
.ppo-edit-footer__right {
	display: flex;
	gap: 10px;
}

/* === Lista de pedidos === */
.ppo-status-pill {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .3px;
}
.ppo-status-pill--completed { background: #dcfce7; color: #166534; }
.ppo-status-pill--processing { background: #dbeafe; color: #1e40af; }
.ppo-status-pill--on-hold    { background: #fef3c7; color: #92400e; }
.ppo-status-pill--cancelled  { background: #fee2e2; color: #991b1b; }
.ppo-status-pill--refunded   { background: #f1f5f9; color: #475569; }
.ppo-status-pill--pending    { background: #ede9fe; color: #5b21b6; }

.ppo-origin {
	display: inline-block;
	padding: 2px 7px;
	border-radius: 4px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .5px;
	margin-left: 4px;
	vertical-align: middle;
}
.ppo-origin--pos { background: #1e293b; color: #fff; }
.ppo-origin--web { background: #e2e8f0; color: #334155; }

.ppo-table-actions {
	display: flex;
	gap: 6px;
}
.ppo-table-btn {
	padding: 4px 10px;
	border: 1px solid #d0d4dc;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
}
.ppo-table-btn:hover { background: #f1f5f9; }
.ppo-table-btn--edit  { color: #1d4ed8; border-color: #93c5fd; }
.ppo-table-btn--print { color: #0f766e; border-color: #5eead4; }

/* === Selector de cliente default === */
.ppo-customer-default {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px dashed #cbd5e1;
	text-align: center;
}

/* =====================================================
 * RESPONSIVE: tablets y móvil
 * ===================================================== */
@media (max-width: 768px) {
	.ppo-meta__row {
		grid-template-columns: 1fr;
		gap: 12px;
	}
	.ppo-edit-footer {
		flex-direction: column;
		align-items: stretch;
	}
	.ppo-edit-footer__right {
		flex-direction: column;
	}
	.ppo-edit-footer__right .gxc-btn {
		width: 100%;
	}
	.gxc-panel__actions {
		flex-direction: column;
		align-items: stretch;
	}
	.ppo-search-input {
		min-width: 0;
		width: 100%;
	}
	/* Tabla principal: ocultar columnas menos críticas */
	#ppo-table th:nth-child(4), /* ITEMS */
	#ppo-table td:nth-child(4),
	#ppo-table th:nth-child(6), /* CAJERO */
	#ppo-table td:nth-child(6) {
		display: none;
	}
	/* Tabla items en modal: ocultar SKU */
	.ppo-items-table th:nth-child(2),
	.ppo-items-table td:nth-child(2) {
		display: none;
	}
}

@media (max-width: 480px) {
	#ppo-table th:nth-child(7),  /* ESTADO */
	#ppo-table td:nth-child(7) {
		display: none;
	}
	.ppo-row-actions {
		justify-content: center;
	}
}
