/* ============================================================
   WC ERP Catalog — Estilos
   Mobile first, adaptado a todos los dispositivos.
   ============================================================ */

:root {
	--erp-primary:      #1a1a2e;
	--erp-accent:       #e94560;
	--erp-accent-dark:  #c73652;
	--erp-bg:           #f5f5f7;
	--erp-surface:      #ffffff;
	--erp-border:       #e2e2e7;
	--erp-text:         #1a1a2e;
	--erp-text-muted:   #6b6b80;
	--erp-success:      #22c55e;
	--erp-radius:       12px;
	--erp-radius-sm:    8px;
	--erp-shadow:       0 2px 12px rgba(0,0,0,0.08);
	--erp-shadow-lg:    0 8px 32px rgba(0,0,0,0.16);
	--erp-cart-width:   380px;
	--erp-transition:   0.2s ease;
}

/* Reset */
.erp-catalog * { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================
   Layout principal
   ============================================================ */

.erp-catalog {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	background: var(--erp-bg);
	min-height: 100vh;
	padding: 0 0 80px;
	color: var(--erp-text);
}

/* ============================================================
   Header
   ============================================================ */

.erp-catalog-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--erp-primary);
	color: #fff;
	padding: 16px 20px;
	position: sticky;
	top: 0;
	z-index: 100;
	gap: 12px;
}

.erp-catalog-header-left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.erp-catalog-title {
	font-size: 20px;
	font-weight: 700;
	color: #fff;
	letter-spacing: -0.3px;
}

.erp-catalog-role-badge {
	background: var(--erp-accent);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 20px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.erp-catalog-header-right {
	display: flex;
	align-items: center;
	gap: 12px;
}

.erp-catalog-user {
	font-size: 13px;
	color: rgba(255,255,255,0.75);
	display: none;
}

@media (min-width: 480px) {
	.erp-catalog-user { display: block; }
}

/* ============================================================
   Botón carrito
   ============================================================ */

.erp-cart-toggle {
	position: relative;
	background: rgba(255,255,255,0.12);
	border: none;
	border-radius: 50%;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #fff;
	transition: background var(--erp-transition);
}

.erp-cart-toggle:hover { background: rgba(255,255,255,0.2); }

.erp-cart-count {
	position: absolute;
	top: -2px;
	right: -2px;
	background: var(--erp-accent);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	min-width: 18px;
	height: 18px;
	border-radius: 9px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
	border: 2px solid var(--erp-primary);
}

.erp-cart-count:empty,
.erp-cart-count[data-count="0"] { display: none; }

/* ============================================================
   Buscador
   ============================================================ */

.erp-catalog-filters {
	padding: 16px 16px 0;
	max-width: 1400px;
	margin: 0 auto;
}

.erp-search-wrap {
	position: relative;
}

.erp-search-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--erp-text-muted);
	pointer-events: none;
}

.erp-search-input {
	width: 100%;
	padding: 12px 16px 12px 44px;
	border: 1.5px solid var(--erp-border);
	border-radius: var(--erp-radius);
	font-size: 15px;
	background: var(--erp-surface);
	color: var(--erp-text);
	outline: none;
	transition: border-color var(--erp-transition), box-shadow var(--erp-transition);
}

.erp-search-input:focus {
	border-color: var(--erp-accent);
	box-shadow: 0 0 0 3px rgba(233,69,96,0.12);
}

/* ============================================================
   Categorías
   ============================================================ */

.erp-catalog-cats {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 14px 16px;
	max-width: 1400px;
	margin: 0 auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.erp-catalog-cats::-webkit-scrollbar { display: none; }

.erp-cat-btn {
	flex-shrink: 0;
	padding: 8px 18px;
	border: 1.5px solid var(--erp-border);
	border-radius: 40px;
	background: var(--erp-surface);
	color: var(--erp-text-muted);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all var(--erp-transition);
	white-space: nowrap;
}

.erp-cat-btn:hover {
	border-color: var(--erp-accent);
	color: var(--erp-accent);
}

.erp-cat-btn.active {
	background: var(--erp-accent);
	border-color: var(--erp-accent);
	color: #fff;
	font-weight: 600;
}

/* ============================================================
   Grid de productos
   ============================================================ */

.erp-products-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 14px;
	padding: 4px 16px 16px;
	max-width: 1400px;
	margin: 0 auto;
}

@media (min-width: 600px) {
	.erp-products-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
	.erp-products-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1200px) {
	.erp-products-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ============================================================
   Card de producto
   ============================================================ */

.erp-product-card {
	background: var(--erp-surface);
	border-radius: var(--erp-radius);
	box-shadow: var(--erp-shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: transform var(--erp-transition), box-shadow var(--erp-transition);
}

.erp-product-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--erp-shadow-lg);
}

.erp-product-card.hidden { display: none; }

.erp-product-img-wrap {
	aspect-ratio: 1;
	overflow: hidden;
	background: #f9f9f9;
}

.erp-product-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.erp-product-card:hover .erp-product-img { transform: scale(1.04); }

.erp-product-body {
	padding: 10px 12px 8px;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.erp-product-sku {
	font-size: 10px;
	color: var(--erp-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.erp-product-name {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--erp-text);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.erp-product-desc {
	font-size: 11px;
	color: var(--erp-text-muted);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	line-height: 1.4;
}

.erp-product-price {
	margin-top: auto;
	padding-top: 6px;
}

.erp-product-price .woocommerce-Price-amount {
	font-size: 16px;
	font-weight: 700;
	color: var(--erp-accent);
}

.erp-product-footer {
	padding: 8px 12px 12px;
	display: flex;
	align-items: center;
	gap: 8px;
	border-top: 1px solid var(--erp-border);
}

/* ============================================================
   Cantidad
   ============================================================ */

.erp-qty-wrap {
	display: flex;
	align-items: center;
	border: 1.5px solid var(--erp-border);
	border-radius: var(--erp-radius-sm);
	overflow: hidden;
	flex-shrink: 0;
}

.erp-qty-btn {
	width: 30px;
	height: 32px;
	border: none;
	background: transparent;
	color: var(--erp-text);
	font-size: 16px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--erp-transition);
}

.erp-qty-btn:hover { background: var(--erp-bg); }

.erp-qty-input {
	width: 36px;
	height: 32px;
	border: none;
	border-left: 1.5px solid var(--erp-border);
	border-right: 1.5px solid var(--erp-border);
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	color: var(--erp-text);
	background: transparent;
	outline: none;
	-moz-appearance: textfield;
}

.erp-qty-input::-webkit-outer-spin-button,
.erp-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ============================================================
   Botones
   ============================================================ */

.erp-add-btn {
	flex: 1;
	height: 34px;
	background: var(--erp-primary);
	color: #fff;
	border: none;
	border-radius: var(--erp-radius-sm);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--erp-transition);
	white-space: nowrap;
}

.erp-add-btn:hover { background: #2d2d4e; }

.erp-add-btn.added {
	background: var(--erp-success);
	animation: erp-pop 0.25s ease;
}

@keyframes erp-pop {
	0%   { transform: scale(1); }
	50%  { transform: scale(0.95); }
	100% { transform: scale(1); }
}

.erp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 24px;
	border-radius: var(--erp-radius-sm);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	border: none;
	transition: all var(--erp-transition);
	width: 100%;
	text-decoration: none;
}

.erp-btn-primary {
	background: var(--erp-accent);
	color: #fff;
}

.erp-btn-primary:hover { background: var(--erp-accent-dark); }

.erp-btn-secondary {
	background: var(--erp-bg);
	color: var(--erp-text);
	border: 1.5px solid var(--erp-border);
}

.erp-btn-secondary:hover { background: var(--erp-border); }

/* ============================================================
   Panel del carrito
   ============================================================ */

.erp-cart-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.4);
	z-index: 200;
	backdrop-filter: blur(2px);
}

.erp-cart-overlay.visible { display: block; }

.erp-cart-panel {
	position: fixed;
	top: 0;
	right: 0;
	width: min(var(--erp-cart-width), 100vw);
	height: 100vh;
	background: var(--erp-surface);
	z-index: 201;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
	box-shadow: var(--erp-shadow-lg);
}

.erp-cart-panel.open { transform: translateX(0); }

.erp-cart-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px;
	border-bottom: 1px solid var(--erp-border);
	background: var(--erp-primary);
	color: #fff;
}

.erp-cart-header h2 {
	font-size: 18px;
	font-weight: 700;
	color: #fff;
}

.erp-cart-close {
	background: rgba(255,255,255,0.15);
	border: none;
	color: #fff;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	font-size: 16px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--erp-transition);
}

.erp-cart-close:hover { background: rgba(255,255,255,0.25); }

.erp-cart-items {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.erp-cart-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: var(--erp-text-muted);
	text-align: center;
	gap: 8px;
	padding: 40px 20px;
}

/* ============================================================
   Ítem del carrito
   ============================================================ */

.erp-cart-item {
	display: grid;
	grid-template-columns: 56px 1fr auto;
	gap: 10px;
	align-items: start;
	padding: 10px;
	border: 1px solid var(--erp-border);
	border-radius: var(--erp-radius-sm);
	background: var(--erp-bg);
}

.erp-cart-item-img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 6px;
}

.erp-cart-item-name {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	margin-bottom: 4px;
}

.erp-cart-item-price {
	font-size: 12px;
	color: var(--erp-text-muted);
}

.erp-cart-item-subtotal {
	font-size: 14px;
	font-weight: 700;
	color: var(--erp-accent);
}

.erp-cart-item-qty {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 6px;
}

.erp-cart-qty-input {
	width: 44px;
	height: 28px;
	border: 1.5px solid var(--erp-border);
	border-radius: 6px;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	outline: none;
	-moz-appearance: textfield;
}

.erp-cart-qty-input::-webkit-outer-spin-button,
.erp-cart-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.erp-cart-item-remove {
	background: none;
	border: none;
	color: var(--erp-text-muted);
	cursor: pointer;
	font-size: 16px;
	padding: 4px;
	line-height: 1;
	border-radius: 4px;
	transition: color var(--erp-transition);
}

.erp-cart-item-remove:hover { color: var(--erp-accent); }

/* ============================================================
   Footer del carrito
   ============================================================ */

.erp-cart-footer {
	padding: 16px 20px;
	border-top: 1px solid var(--erp-border);
	background: var(--erp-surface);
}

.erp-cart-total {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 14px;
	font-size: 16px;
}

.erp-cart-total strong {
	font-size: 22px;
	font-weight: 700;
	color: var(--erp-accent);
}

.erp-cart-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.erp-cart-actions textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1.5px solid var(--erp-border);
	border-radius: var(--erp-radius-sm);
	font-size: 13px;
	resize: none;
	outline: none;
	transition: border-color var(--erp-transition);
}

.erp-cart-actions textarea:focus { border-color: var(--erp-accent); }

#erp-confirm-msg {
	font-size: 13px;
	text-align: center;
	padding: 6px;
	border-radius: var(--erp-radius-sm);
}

/* ============================================================
   Login requerido / Sin acceso
   ============================================================ */

.erp-catalog-login-required,
.erp-catalog-no-access {
	min-height: 60vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
	background: var(--erp-bg);
}

.erp-catalog-login-box {
	background: var(--erp-surface);
	border-radius: var(--erp-radius);
	padding: 40px 32px;
	text-align: center;
	max-width: 400px;
	box-shadow: var(--erp-shadow-lg);
}

.erp-catalog-login-box h2 {
	font-size: 22px;
	font-weight: 700;
	margin-bottom: 12px;
	color: var(--erp-text);
}

.erp-catalog-login-box p {
	color: var(--erp-text-muted);
	margin-bottom: 24px;
	line-height: 1.5;
}

.erp-catalog-login-box .erp-btn {
	width: auto;
	padding: 12px 32px;
}

/* ============================================================
   Modal éxito del pedido
   ============================================================ */

.erp-order-success {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.5);
	z-index: 300;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.erp-order-success-box {
	background: var(--erp-surface);
	border-radius: var(--erp-radius);
	padding: 40px 32px;
	text-align: center;
	max-width: 480px;
	width: 100%;
	box-shadow: var(--erp-shadow-lg);
	animation: erp-slide-up 0.3s ease;
}

@keyframes erp-slide-up {
	from { opacity: 0; transform: translateY(20px); }
	to   { opacity: 1; transform: translateY(0); }
}

.erp-success-icon {
	width: 64px;
	height: 64px;
	background: var(--erp-success);
	color: #fff;
	border-radius: 50%;
	font-size: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 20px;
}

.erp-order-success-box h2 {
	font-size: 24px;
	font-weight: 700;
	margin-bottom: 10px;
	color: var(--erp-text);
}

.erp-order-success-box > p {
	color: var(--erp-text-muted);
	margin-bottom: 16px;
}

.erp-order-number {
	background: var(--erp-bg);
	border-radius: var(--erp-radius-sm);
	padding: 12px 16px;
	font-size: 16px;
	margin-bottom: 20px;
	color: var(--erp-text-muted);
}

.erp-order-number strong {
	color: var(--erp-accent);
	font-size: 20px;
}

.erp-order-summary {
	text-align: left;
	background: var(--erp-bg);
	border-radius: var(--erp-radius-sm);
	padding: 12px 16px;
	margin-bottom: 20px;
	max-height: 200px;
	overflow-y: auto;
}

.erp-order-summary-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 6px 0;
	border-bottom: 1px solid var(--erp-border);
	font-size: 13px;
}

.erp-order-summary-item:last-child { border-bottom: none; }

.erp-order-summary-total {
	display: flex;
	justify-content: space-between;
	padding-top: 10px;
	font-weight: 700;
	font-size: 15px;
}

/* ============================================================
   Sin resultados / Estado vacío
   ============================================================ */

.erp-empty-state,
.erp-no-results {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 20px;
	color: var(--erp-text-muted);
}

/* ============================================================
   Animación de entrada de cards
   ============================================================ */

.erp-product-card {
	animation: erp-fade-in 0.3s ease backwards;
}

@keyframes erp-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}