/* =============================================
   LISTADO — Página de listado completo
   =============================================
   Barra de búsqueda, tabla de artículos, badges
   de disponibilidad, botones de compra y responsive.
   ============================================= */


/* ── Variables locales de color ── */

:root {
	--azul: #0000cc;
	--azul2: #003399;
	--verde: #99ffcc;
	--verde2: #00cc88;
	--amarillo: #ffffcc;
	--gris: #e8e8e8;
	--texto: #111;
	--shadow: 0 2px 8px rgba(0, 0, 0, .15);
}


/* ── Barra de búsqueda ── */

#barra-busqueda {
	background: linear-gradient(135deg, #003399 0%, #0066cc 100%);
	padding: 18px 20px;
	position: sticky;
	top: 0;
	z-index: 100;
	box-shadow: 0 3px 10px rgba(0, 0, 102, .35);
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

#barra-busqueda label {
	color: #fff;
	font-weight: bold;
	font-size: 1.05em;
	white-space: nowrap;
}

#buscar {
	flex: 1 1 260px;
	padding: 9px 14px;
	font-size: 1em;
	border: none;
	border-radius: 6px;
	box-shadow: inset 0 1px 4px rgba(0, 0, 0, .25);
	outline: none;
}

#buscar:focus {
	box-shadow: 0 0 0 3px #99ffcc;
}

#limpiar-btn {
	padding: 9px 18px;
	background: #ff4444;
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-weight: bold;
	font-size: .95em;
	transition: background .2s;
}

#limpiar-btn:hover {
	background: #cc0000;
}

#contador {
	color: #cceeff;
	font-size: .9em;
	margin-left: auto;
	white-space: nowrap;
}


/* ── Tabla de artículos ── */

#contenedor-tabla {
	padding: 16px;
	overflow-x: auto;
}

#tabla-articulos {
	width: 100%;
	border-collapse: collapse;
	font-size: 15px;
	background: #fff;
	box-shadow: var(--shadow);
	border-radius: 8px;
	overflow: hidden;
}

#tabla-articulos thead tr {
	background: linear-gradient(135deg, #003399 0%, #0055bb 100%);
	color: #fff;
}

#tabla-articulos thead th {
	padding: 12px 10px;
	text-align: left;
	font-size: 1em;
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
}

#tabla-articulos thead th:hover {
	background: rgba(255, 255, 255, .15);
}

#tabla-articulos thead th .sort-icon {
	margin-left: 4px;
	opacity: .6;
}

/* Filas alternadas */
#tabla-articulos tbody tr:nth-child(even) {
	background: #f0fff8;
}

#tabla-articulos tbody tr:nth-child(odd) {
	background: #fff;
}

#tabla-articulos tbody tr:hover {
	background: #cceeff;
	transition: background .15s;
}

#tabla-articulos td {
	padding: 9px 10px;
	border-bottom: 1px solid #ddd;
	vertical-align: middle;
}

.col-ref {
	width: 72px;
	color: var(--azul2);
	font-weight: bold;
}

.col-titulo {
	min-width: 220px;
}

.col-precio {
	width: 80px;
	text-align: right;
	font-weight: bold;
	color: #006600;
}

.col-pagina {
	width: 130px;
}

.col-almacen {
	width: 110px;
	text-align: center;
}

.col-accion {
	width: 120px;
	text-align: center;
}


/* ── Filas agotadas ── */

tr.agotado td {
	color: #cc0000 !important;
}

tr.agotado .col-ref {
	color: #cc0000 !important;
}

tr.agotado .col-precio {
	color: #cc0000 !important;
}

tr.agotado:nth-child(even) {
	background: #fff0f0 !important;
}

tr.agotado:nth-child(odd) {
	background: #fff5f5 !important;
}

tr.agotado:hover {
	background: #ffd6d6 !important;
}


/* ── Badge almacén ── */

.badge-disponible {
	display: inline-block;
	background: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
	border-radius: 12px;
	padding: 2px 10px;
	font-size: .8em;
	font-weight: bold;
}

.badge-agotado {
	display: inline-block;
	background: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
	border-radius: 12px;
	padding: 2px 10px;
	font-size: .8em;
	font-weight: bold;
}


/* ── Botón COMPRAR ── */

.btn-comprar {
	background: linear-gradient(135deg, #009933 0%, #00bb44 100%);
	color: #fff;
	border: none;
	border-radius: 5px;
	padding: 6px 14px;
	font-size: .88em;
	font-weight: bold;
	cursor: pointer;
	box-shadow: 0 2px 5px rgba(0, 100, 0, .3);
	transition: transform .12s, box-shadow .12s;
	white-space: nowrap;
}

.btn-comprar:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 9px rgba(0, 100, 0, .35);
}

.btn-comprar:active {
	transform: translateY(0);
}

.btn-agotado {
	background: #ccc;
	color: #888;
	border: none;
	border-radius: 5px;
	padding: 6px 14px;
	font-size: .88em;
	font-weight: bold;
	cursor: not-allowed;
}


/* ── Enlace a la página de colección ── */

.link-pagina {
	color: var(--azul);
	text-decoration: none;
	font-size: .85em;
}

.link-pagina:hover {
	text-decoration: underline;
}


/* ── Cabecera de sección ── */

.titulo-pagina {
	text-align: center;
	color: var(--azul2);
	font-size: 2em;
	font-weight: bold;
	margin: 18px 0 6px;
	text-shadow: 1px 1px 3px rgba(0, 0, 150, .15);
}

.info-pagina {
	text-align: center;
	color: #555;
	font-size: .95em;
	margin-bottom: 14px;
}


/* ── Ver pedido flotante ── */

#ver-pedido-flotante {
	position: fixed;
	bottom: 22px;
	right: 22px;
	background: linear-gradient(135deg, #003399, #0066cc);
	color: #fff;
	padding: 12px 22px;
	border-radius: 30px;
	font-weight: bold;
	font-size: 1em;
	text-decoration: none;
	box-shadow: 0 4px 14px rgba(0, 0, 150, .4);
	transition: transform .2s, box-shadow .2s;
	z-index: 200;
	display: none;
	/* se muestra al añadir al carro */
}

#ver-pedido-flotante:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 20px rgba(0, 0, 150, .5);
}


/* ── Spinner de carga ── */

#cargando {
	text-align: center;
	padding: 60px;
	color: var(--azul2);
	font-size: 1.3em;
}


/* ── Sin resultados ── */

#sin-resultados {
	text-align: center;
	padding: 40px;
	color: #888;
	font-size: 1.1em;
	display: none;
}


/* ── Botón volver ── */

.btn-volver {
	display: inline-block;
	margin: 10px 0 0 16px;
	padding: 7px 16px;
	background: var(--azul2);
	color: #fff;
	border-radius: 6px;
	font-weight: bold;
	font-size: .9em;
	text-decoration: none;
	transition: background .2s;
}

.btn-volver:hover {
	background: var(--azul);
	color: #fff;
}


/* ── Responsive ── */

@media (max-width: 640px) {
	.col-pagina {
		display: none;
	}

	.col-almacen {
		display: none;
	}

	#tabla-articulos {
		font-size: 13px;
	}
}
