/**
 * Estilos para el módulo de tracking en Pedidos
 */

/* Sección de tracking en la página de pedido */
.carrier-order-tracking-section {
	background: linear-gradient(135deg, var(--ct-primary) 0%, var(--ct-primary-dark) 100%);
	border: none;
	border-radius: 12px;
	padding: 0;
	margin: 30px 0;
	box-shadow: 0 4px 12px rgba(var(--ct-primary-rgb), 0.15);
	overflow: hidden;
}

.carrier-order-tracking-section h2 {
	background: rgba(255, 255, 255, 0.95);
	color: #333;
	margin: 0;
	padding: 20px 25px;
	font-size: 20px;
	font-weight: 600;
	border-bottom: 3px solid var(--ct-primary);
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
}

.carrier-order-tracking-section h2:before {
	content: "📦";
	font-size: 24px;
}

.tracking-info-header {
	background: white;
	padding: 20px 25px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 15px;
}

.tracking-info-header p {
	margin: 0;
	font-size: 15px;
	color: #555;
	display: flex;
	align-items: center;
	gap: 8px;
}

.tracking-info-header p:first-child:before {
	content: "🏷️";
	font-size: 18px;
}

.tracking-info-header p:nth-child(2):before {
	content: "🚚";
	font-size: 18px;
}

.tracking-info-header strong {
	color: var(--ct-primary);
	font-weight: 600;
	font-size: 16px;
}

.carrier-track-order-button {
	background: linear-gradient(135deg, var(--ct-primary) 0%, var(--ct-primary-dark) 100%);
	color: white;
	border: none;
	border-radius: 25px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(var(--ct-primary-rgb), 0.3);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.carrier-track-order-button:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(var(--ct-primary-rgb), 0.4);
	color: white;
	text-decoration: none;
	background: linear-gradient(135deg, var(--ct-primary-dark) 0%, var(--ct-primary-darker) 100%);
}

/* Contenedor de detalles desplegable */
.tracking-details-container {
	display: none;
	background: white;
	padding: 25px;
	border-top: 1px solid #eee;
}

.loading-spinner {
	text-align: center;
	padding: 40px;
	color: var(--ct-primary);
}

.loading-spinner span {
	display: inline-block;
	font-size: 16px;
	font-weight: 500;
	animation: pulse 1.5s ease-in-out infinite;
}

.loading-spinner:before {
	content: "⏳";
	font-size: 32px;
	display: block;
	margin-bottom: 15px;
	animation: spin 2s linear infinite;
}

@keyframes spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.5; }
}

.tracking-content {
	animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
	from { 
		opacity: 0;
		transform: translateY(-10px);
	}
	to { 
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* Status badge */
.tracking-status {
	background: linear-gradient(135deg, var(--ct-primary-light) 0%, var(--ct-primary-lighter) 100%);
	padding: 20px;
	border-radius: 10px;
	margin-bottom: 25px;
	text-align: center;
	position: relative;
	overflow: hidden;
}

.tracking-status h3 {
	margin: 0 0 10px 0;
	color: var(--ct-primary-text);
	font-size: 22px;
	font-weight: 700;
	text-transform: uppercase;
}

.tracking-status.success {
	background: linear-gradient(135deg, #C8E6C9 0%, #A5D6A7 100%);
}

.tracking-status.success h3 {
	color: #2E7D32;
}

.tracking-status.warning {
	background: linear-gradient(135deg, #FFF9C4 0%, #FFF59D 100%);
}

.tracking-status.warning h3 {
	color: #F57F17;
}

.tracking-badge {
	display: inline-block;
	padding: 6px 16px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.badge-success {
	background: #4CAF50;
	color: white;
}

.badge-info {
	background: var(--ct-primary);
	color: white;
}

.badge-warning {
	background: #FF9800;
	color: white;
}

/* Grid de detalles */
.tracking-details-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 15px;
	margin-bottom: 25px;
	padding: 20px;
	background: #F5F5F5;
	border-radius: 8px;
}

.detail-item {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.detail-item label {
	font-size: 12px;
	color: #757575;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.detail-item span {
	font-size: 14px;
	color: #212121;
	font-weight: 500;
}

/* Timeline */
.tracking-timeline {
	margin-top: 30px;
}

.tracking-timeline h4 {
	margin: 0 0 20px 0;
	color: var(--ct-primary-text);
	font-size: 18px;
	font-weight: 600;
	padding-bottom: 10px;
	border-bottom: 2px solid var(--ct-primary);
}

.timeline {
	position: relative;
	padding-left: 50px;
}

.timeline-item {
	position: relative;
	margin-bottom: 20px;
	animation: fadeIn 0.5s ease-out;
}

.timeline-item:last-child {
	margin-bottom: 0;
}

/* Línea de progreso para items completados */
.timeline-item:before {
	content: '';
	position: absolute;
	left: -28px;
	top: 50%;
	width: 3px;
	height: calc(100% + 20px);
	background: #E0E0E0;
	z-index: 0;
}

.timeline-item:last-child:before {
	display: none;
}

.timeline-item.completed:before {
	background-color: var(--ct-primary);
}

.timeline-marker {
	position: absolute;
	left: -42px;
	transform: translate(0, -50%);
	top: 50%;
	width: 33px;
	height: 33px;
	border-radius: 50%;
	background: white;
	border: 3px solid white;
	box-shadow: 0 0 0 2px #E0E0E0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
}

.timeline-marker .marker-icon {
	font-size: 14px;
	opacity: 0.5;
}

.timeline-item.completed .timeline-marker {
	background: var(--ct-primary);
	box-shadow: 0 0 0 2px var(--ct-primary), 0 0 8px rgba(var(--ct-primary-rgb), 0.3);
}

.timeline-item.completed .timeline-marker .marker-icon {
	opacity: 1;
}

.timeline-item.pending .timeline-marker {
	background: #E0E0E0;
	box-shadow: 0 0 0 2px #E0E0E0;
}

.timeline-content {
	padding: 12px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
    transition: transform 0.2s ease;
}

.timeline-item.completed .timeline-content:hover {
	transform: translateX(3px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.timeline-item.pending .timeline-content {
	background: #F5F5F5;
	border-left: 3px solid #E0E0E0;
	opacity: 0.6;
}

.timeline-content strong {
	display: block;
	color: #212121;
	font-size: 14px;
}

.timeline-item.pending .timeline-content strong {
	color: #9E9E9E;
}

.timeline-content span {
	display: block;
	color: #757575;
	font-size: 12px;
}

/* Novedades */
.tracking-novedades {
	margin-top: 30px;
	padding: 20px;
	background: #FFF3E0;
	border-radius: 8px;
	border-left: 4px solid #FF9800;
}

.tracking-novedades h4 {
	margin: 0 0 15px 0;
	color: #E65100;
	font-size: 16px;
	font-weight: 600;
}

.novedad-item {
	background: white;
	padding: 15px;
	border-radius: 6px;
	margin-bottom: 10px;
	border-left: 3px solid #FF9800;
}

.novedad-item:last-child {
	margin-bottom: 0;
}

.novedad-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
	flex-wrap: wrap;
	gap: 10px;
}

.novedad-header strong {
	color: #E65100;
	font-size: 14px;
}

.novedad-fecha {
	font-size: 12px;
	color: #757575;
	font-weight: 500;
}

.novedad-detalle {
	margin: 8px 0 0 0;
	color: #424242;
	font-size: 13px;
	line-height: 1.5;
}

/* Boton guía digital */
.tracking-guia-digital {
	margin-top: 25px;
	text-align: center;
}

.tracking-guia-digital .button {
	display: inline-block;
	background: var(--ct-primary);
	color: white;
	padding: 12px 30px;
	border-radius: 25px;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(0, 49, 124, 0.3);
}

.tracking-guia-digital .button:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 49, 124, 0.4);
	color: white;
}

/* Responsive */
@media (max-width: 768px) {
	.tracking-info-header {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.carrier-track-order-button {
		width: 100%;
		text-align: center;
	}
	
	.tracking-details-grid {
		grid-template-columns: 1fr;
	}
	
	.timeline {
		padding-left: 45px;
	}
	
	.timeline:before {
		left: 12px;
	}
	
	.timeline-marker {
		left: -33px;
		width: 24px;
		height: 24px;
	}
	
	.timeline-marker .marker-icon {
		font-size: 12px;
	}
	
	.timeline-item.completed:before {
		left: -33px;
	}
}

/* Error messages */
.woocommerce-error {
	background: #FFEBEE;
	color: #C62828;
	padding: 15px 20px;
	border-radius: 6px;
	border-left: 4px solid #C62828;
	margin: 0;
}

/* Tabla de pedidos - columna de tracking */
.woocommerce-orders-table .carrier-tracking {
	text-align: center;
}

.woocommerce-orders-table .carrier-tracking a.button {
	background: var(--ct-primary);
	color: white;
	padding: 8px 16px;
	font-size: 13px;
	border-radius: 4px;
	transition: all 0.2s ease;
}

.woocommerce-orders-table .carrier-tracking a.button:hover {
	background: var(--ct-primary-dark);
	color: white;
	text-decoration: none;
	transform: translateY(-1px);
}
